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 weekly on a Monday
18 - cron: "0 0 * * 1"
19
20 jobs:
21 build_wheels:
22 name: Build wheels for ${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
23 runs-on: ${{ matrix.buildplat[0] }}
24 strategy:
25 matrix:
26 buildplat:
27 - [ubuntu-22.04, manylinux_x86_64]
28 - [ubuntu-22.04, musllinux_x86_64]
29 - [ubuntu-22.04, manylinux_aarch64]
30 - [ubuntu-22.04, musllinux_aarch64]
31 - [macos-13, macosx_x86_64]
32 - [macos-14, macosx_arm64]
33 python-version: [pp310, cp38, cp39, cp310, cp311, cp312, cp313, cp314]
34 exclude:
35 # pp310, cp38 on musllinux is not support
36 # cp39, cp310 on musllinux_aarch64, wheel building may hangup, ignore it
37 # drop 37 so we can use newer cibuildwheel
38 - buildplat: [ubuntu-22.04, musllinux_x86_64]
39 python-version: cp38
40 - buildplat: [ubuntu-22.04, musllinux_x86_64]
41 python-version: pp310
42 - buildplat: [ubuntu-22.04, musllinux_aarch64]
43 python-version: cp38
44 - buildplat: [ubuntu-22.04, musllinux_aarch64]
45 python-version: cp39
46 - buildplat: [ubuntu-22.04, musllinux_aarch64]
47 python-version: cp310
48 - buildplat: [ubuntu-22.04, musllinux_aarch64]
49 python-version: pp310
50
51 steps:
52 - uses: actions/checkout@v4
53 with:
54 submodules: recursive
55
56 - name: Set up QEMU
57 if: runner.os == 'Linux'
58 uses: docker/setup-qemu-action@v3
59
60 - name: Build wheels
61 uses: pypa/[email protected]
62 with:
63 package-dir: .
64 output-dir: wheelhouse
65 config-file: "{package}/pyproject.toml"
66 env:
67 # select
68 CIBW_BUILD: ${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
69 CIBW_ENABLE: pypy
70 CIBW_PRERELEASE_PYTHONS: 1
71
72 # linux
73 CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
74 # manylinux2014 can't build on aarch64
75 CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
76 CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
77 CIBW_MUSLLINUX_AARCH64_IMAGE: musllinux_1_2
78 CIBW_ARCHS_LINUX: auto64 aarch64
79 CIBW_BEFORE_BUILD_LINUX: "{project}/ci/linux-deps"
80 CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib64" && auditwheel repair -w {dest_dir} {wheel}'
81
82 # macos
83 CIBW_ARCHS_MACOS: auto64
84 CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-deps"
85 CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
86
87 # build
88 CIBW_ENVIRONMENT: >-
89 CYVCF2_HTSLIB_CONFIGURE_OPTIONS="--enable-libcurl --enable-s3 --enable-lzma --enable-bz2 --with-libdeflate"
90 CYTHONIZE=1
91 CIBW_TEST_COMMAND: "{project}/ci/test"
92
93 # Enable tmate debugging of manually-triggered workflows if the input option was provided
94 - name: Setup tmate session
95 if: ${{ always() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
96 uses: mxschmitt/action-tmate@v3
97
98 - uses: actions/upload-artifact@v4
99 with:
100 name: artifact-${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
101 path: ./wheelhouse/*.whl
102
103 build_sdist:
104 name: Build source distribution
105 runs-on: ubuntu-22.04
106 steps:
107 - uses: actions/checkout@v4
108 with:
109 submodules: recursive
110 - uses: actions/setup-python@v5
111 name: Install Python
112 with:
113 python-version: "3.14"
114
115 - name: Install dependencies
116 run: |
117 pip install -r requirements.txt
118
119 - name: Build sdist
120 run: CYTHONIZE=1 python setup.py sdist
121
122 - uses: actions/upload-artifact@v4
123 with:
124 name: artifact-sdist
125 path: dist/*.tar.gz
126
127 upload_pypi:
128 needs: [build_wheels, build_sdist]
129 runs-on: ubuntu-22.04
130 # upload to PyPI on every tag starting with 'v'
131 if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
132 steps:
133 - uses: actions/download-artifact@v4
134 with:
135 pattern: artifact-*
136 merge-multiple: true
137 path: dist
138
139 - uses: pypa/gh-action-pypi-publish@release/v1
140 with:
141 user: __token__
142 password: ${{ secrets.PYPI_API_TOKEN }}