-
Notifications
You must be signed in to change notification settings - Fork 31
117 lines (103 loc) · 3.73 KB
/
Copy pathbuild_wheels.yml
File metadata and controls
117 lines (103 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Build Python Wheels
on:
pull_request:
branches: [main]
# ready_for_review is included so that marking a draft PR "Ready for
# review" triggers a build (the draft guard below skips draft PRs);
# it is not in GitHub's default set (opened/synchronize/reopened).
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'lib/**'
- 'components/**'
- 'pyproject.toml'
- '.github/workflows/build_wheels.yml'
push:
branches: [main]
release:
types: [published]
workflow_dispatch:
# default for all jobs; the publish job additionally grants itself the
# id-token permission required for PyPI trusted publishing
permissions:
contents: read
# Supersede in-progress runs: a new commit on the same PR cancels the earlier,
# now-stale build. Keyed by the workflow (so it never cross-cancels other
# workflows) + the PR number, which is globally unique - unlike the head branch
# name, two fork PRs can't collide on it. For non-PR events (push, release) we
# fall back to github.run_id, which is unique per run, so those runs each get
# their own group and never serialize or cancel each other.
# cancel-in-progress is gated to pull_request events only so that push-to-main
# (and release) runs are never cancelled.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
# Skip build CI for draft PRs; still runs on push-to-main and non-draft PRs.
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest # linux x86_64
- os: ubuntu-24.04-arm # linux aarch64
- os: macos-latest # macos universal2 (arm64 + x86_64)
- os: windows-latest # windows amd64
steps:
- name: Checkout repo
uses: actions/checkout@v7
with:
submodules: 'recursive'
# full history + tags so setuptools-scm can compute the version
fetch-depth: 0
- name: Build wheels
run: pipx run cibuildwheel
# configuration (python versions, test command, etc.) lives in
# [tool.cibuildwheel] in pyproject.toml
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
build_sdist:
name: Build source distribution
# Skip build CI for draft PRs; still runs on push-to-main and non-draft PRs.
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v7
with:
submodules: 'recursive'
fetch-depth: 0
- name: Build sdist
run: pipx run build --sdist
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/*.tar.gz
publish_pypi:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# only publish on published releases; PR / push builds just verify the
# wheels build and import correctly
if: github.event_name == 'release' && github.event.action == 'published'
environment:
name: pypi
url: https://pypi.org/p/espp
permissions:
# required for PyPI trusted publishing (OIDC)
id-token: write
steps:
- name: Download all distributions
uses: actions/download-artifact@v5
with:
pattern: '*'
merge-multiple: true
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1