Debian Codegraph @

.github/workflows/wheels.yml

raw
1 name: Wheels
2
3 on:
4 push:
5 branches:
6 - main
7 - wheels
8 tags:
9 - "v*.*.*"
10 workflow_dispatch:
11 inputs:
12 debug_enabled:
13 description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
14 required: false
15 default: false
16 schedule:
17 # run monthly on the 1st
18 - cron: "0 0 1 * *"
19
20 concurrency:
21 group: ${{ github.workflow }}-${{ github.ref }}
22 cancel-in-progress: true
23
24 env:
25 CIBW_ENABLE: pypy
26 CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
27 # manylinux2014 can't build on aarch64
28 CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
29 CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
30 CIBW_MUSLLINUX_AARCH64_IMAGE: musllinux_1_2
31 CIBW_ARCHS_LINUX: auto64 aarch64
32 CIBW_BEFORE_BUILD_LINUX: "{project}/ci/linux-deps"
33 CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib64" && auditwheel repair -w {dest_dir} {wheel}'
34 CIBW_ARCHS_MACOS: auto64
35 CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-deps"
36 CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
37 CIBW_ENVIRONMENT: >-
38 CYVCF2_HTSLIB_CONFIGURE_OPTIONS="--enable-libcurl --enable-s3 --enable-lzma --enable-bz2 --with-libdeflate"
39 CIBW_TEST_COMMAND: "{project}/ci/test"
40
41 jobs:
42 build_wheels:
43 # Full wheel matrix for releases, schedule, and manual runs.
44 if: github.event_name != 'push' || github.ref != 'refs/heads/main'
45 name: Build wheels (full matrix)
46 runs-on: ${{ matrix.buildplat[0] }}
47 strategy:
48 matrix:
49 buildplat:
50 - [ubuntu-22.04, manylinux_x86_64]
51 - [ubuntu-22.04, musllinux_x86_64]
52 - [ubuntu-22.04, manylinux_aarch64]
53 - [ubuntu-22.04, musllinux_aarch64]
54 - [macos-15-intel, macosx_x86_64]
55 - [macos-14, macosx_arm64]
56 python-version: [pp311, cp39, cp310, cp311, cp312, cp313, cp314]
57 exclude:
58 # pp311 not built on musllinux or manylinux_aarch64
59 # cp39, cp310 on musllinux_aarch64, wheel building may hangup, ignore it
60 # drop 37 so we can use newer cibuildwheel
61 - buildplat: [ubuntu-22.04, manylinux_aarch64]
62 python-version: pp311
63 - buildplat: [ubuntu-22.04, musllinux_x86_64]
64 python-version: pp311
65 - buildplat: [ubuntu-22.04, musllinux_aarch64]
66 python-version: cp39
67 - buildplat: [ubuntu-22.04, musllinux_aarch64]
68 python-version: cp310
69 - buildplat: [ubuntu-22.04, musllinux_aarch64]
70 python-version: pp311
71
72 steps:
73 - uses: actions/checkout@v4
74 with:
75 submodules: recursive
76
77 - name: Cache wheel build downloads
78 uses: actions/cache@v4
79 with:
80 path: |
81 ~/.cache/pip
82 ~/.cache/cibuildwheel
83 key: ${{ runner.os }}-${{ matrix.buildplat[1] }}-cibw-${{ hashFiles('pyproject.toml', 'requirements.txt', 'ci/linux-deps', 'ci/osx-deps') }}
84 restore-keys: |
85 ${{ runner.os }}-${{ matrix.buildplat[1] }}-cibw-
86 ${{ runner.os }}-cibw-
87
88 - name: Set up QEMU
89 if: runner.os == 'Linux' && contains(matrix.buildplat[1], 'aarch64')
90 uses: docker/setup-qemu-action@v3
91
92 - name: Build wheels
93 uses: pypa/[email protected]
94 with:
95 package-dir: .
96 output-dir: wheelhouse
97 config-file: "{package}/pyproject.toml"
98 env:
99 CIBW_BUILD: ${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
100
101 # Enable tmate debugging of manually-triggered workflows if the input option was provided
102 - name: Setup tmate session
103 if: ${{ always() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
104 uses: mxschmitt/action-tmate@v3
105
106 - uses: actions/upload-artifact@v4
107 with:
108 name: artifact-${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
109 path: ./wheelhouse/*.whl
110
111 build_wheels_smoke:
112 # Smaller matrix on main to keep CI cost controlled.
113 if: github.event_name == 'push' && github.ref == 'refs/heads/main'
114 name: Build wheels (smoke matrix)
115 runs-on: ${{ matrix.buildplat[0] }}
116 strategy:
117 matrix:
118 include:
119 - buildplat: [ubuntu-22.04, manylinux_x86_64]
120 python-version: cp39
121 - buildplat: [ubuntu-22.04, manylinux_x86_64]
122 python-version: cp314
123 - buildplat: [ubuntu-22.04, manylinux_x86_64]
124 python-version: pp311
125 - buildplat: [ubuntu-22.04, musllinux_x86_64]
126 python-version: cp314
127 - buildplat: [ubuntu-22.04, manylinux_aarch64]
128 python-version: cp314
129 - buildplat: [ubuntu-22.04, musllinux_aarch64]
130 python-version: cp314
131 - buildplat: [macos-15-intel, macosx_x86_64]
132 python-version: cp314
133 - buildplat: [macos-14, macosx_arm64]
134 python-version: cp314
135
136 steps:
137 - uses: actions/checkout@v4
138 with:
139 submodules: recursive
140
141 - name: Cache wheel build downloads
142 uses: actions/cache@v4
143 with:
144 path: |
145 ~/.cache/pip
146 ~/.cache/cibuildwheel
147 key: ${{ runner.os }}-${{ matrix.buildplat[1] }}-cibw-${{ hashFiles('pyproject.toml', 'requirements.txt', 'ci/linux-deps', 'ci/osx-deps') }}
148 restore-keys: |
149 ${{ runner.os }}-${{ matrix.buildplat[1] }}-cibw-
150 ${{ runner.os }}-cibw-
151
152 - name: Set up QEMU
153 if: runner.os == 'Linux' && contains(matrix.buildplat[1], 'aarch64')
154 uses: docker/setup-qemu-action@v3
155
156 - name: Build wheels
157 uses: pypa/[email protected]
158 with:
159 package-dir: .
160 output-dir: wheelhouse
161 config-file: "{package}/pyproject.toml"
162 env:
163 CIBW_BUILD: ${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
164
165 - uses: actions/upload-artifact@v4
166 with:
167 name: artifact-smoke-${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
168 path: ./wheelhouse/*.whl
169
170 build_sdist:
171 name: Build source distribution
172 runs-on: ubuntu-22.04
173 steps:
174 - uses: actions/checkout@v4
175 with:
176 submodules: recursive
177 - uses: actions/setup-python@v5
178 name: Install Python
179 with:
180 python-version: "3.14"
181 cache: pip
182 cache-dependency-path: requirements.txt
183
184 - name: Install dependencies
185 run: |
186 python -m pip install --upgrade pip build
187
188 - name: Build sdist
189 run: python -m build --sdist
190
191 - uses: actions/upload-artifact@v4
192 with:
193 name: artifact-sdist
194 path: dist/*.tar.gz
195
196 upload_pypi:
197 needs: [build_wheels, build_sdist]
198 runs-on: ubuntu-22.04
199 # upload to PyPI on every tag starting with 'v'
200 if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
201 steps:
202 - uses: actions/download-artifact@v4
203 with:
204 pattern: artifact-*
205 merge-multiple: true
206 path: dist
207
208 - uses: pypa/gh-action-pypi-publish@release/v1
209 with:
210 user: __token__
211 password: ${{ secrets.PYPI_API_TOKEN }}