Skip to content

Commit 3abea79

Browse files
committed
ci: Setup cibuildwheel for building wheels
1 parent cbd9892 commit 3abea79

File tree

1 file changed

+79
-27
lines changed

1 file changed

+79
-27
lines changed

.github/workflows/pipeline.yml

Lines changed: 79 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: [ubuntu-latest, windows-latest, macos-latest]
23-
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
23+
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"]
2424
config: [Release]
2525
include:
2626
- os: windows-latest
2727
python-version: "3.13"
2828
config: Debug
2929
exclude:
30-
- os: ubuntu-latest
31-
python-version: "3.8"
3230
- os: ubuntu-latest
3331
python-version: "3.9"
3432
- os: ubuntu-latest
@@ -37,8 +35,6 @@ jobs:
3735
python-version: "3.11"
3836
- os: ubuntu-latest
3937
python-version: "3.12"
40-
- os: macos-latest
41-
python-version: "3.8"
4238
- os: macos-latest
4339
python-version: "3.9"
4440
- os: macos-latest
@@ -86,27 +82,6 @@ jobs:
8682
cd docs/rtd
8783
pip install -r requirements.txt
8884
make clean && make html SPHINXOPTS="-W --keep-going -n"
89-
- name: Build package
90-
if: ${{ matrix.config == 'Release' && (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu')) }}
91-
run: |
92-
pip install -U wheel setuptools
93-
python setup.py ${{ startsWith(matrix.os, 'windows') && 'bdist_wheel' || 'sdist' }}
94-
- name: Build manylinux binary wheel
95-
if: ${{ matrix.config == 'Release' && startsWith(matrix.os, 'ubuntu') }}
96-
uses: RalfG/python-wheels-manylinux-build@ff8504699f7a33a08d3ff85b3c6d4e8f0e70462b
97-
with:
98-
pre-build-command: "rm -rf build"
99-
python-versions: "cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313"
100-
- name: Upload package
101-
if: ${{ matrix.config == 'Release' && (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu')) }}
102-
uses: actions/upload-artifact@v4
103-
with:
104-
name: package-${{ matrix.os }}-py${{ matrix.python-version }}-${{ matrix.config }}
105-
path: |
106-
dist/*.${{ startsWith(matrix.os, 'windows') && 'whl' || 'tar.gz' }}
107-
dist/*-manylinux*.whl
108-
if-no-files-found: error
109-
retention-days: 7
11085
11186
asan:
11287
runs-on: ubuntu-latest
@@ -129,17 +104,94 @@ jobs:
129104
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
130105
./build/tests/cpp/yaramod_tests
131106
107+
build_sdist:
108+
needs:
109+
- tests
110+
- asan
111+
runs-on: ubuntu-latest
112+
steps:
113+
- name: Setup Git
114+
run: |
115+
git config --global core.autocrlf false
116+
git config --global core.eol lf
117+
- name: Checkout sources
118+
uses: actions/checkout@v4
119+
- name: Setup Python
120+
uses: actions/setup-python@v5
121+
- name: Build sdist
122+
run: |
123+
pip install -U setuptools
124+
python setup.py sdist
125+
- name: Upload sdist
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: python-sdist
129+
path: |
130+
./dist/*.tar.gz
131+
if-no-files-found: error
132+
retention-days: 7
133+
134+
build_wheel:
135+
needs:
136+
- tests
137+
- asan
138+
strategy:
139+
fail-fast: false
140+
matrix:
141+
include:
142+
- os: ubuntu-latest
143+
platform: linux
144+
arch: manylinux_x86_64
145+
- runs-on: windows-latest
146+
platform: windows
147+
arch: win_amd64
148+
- runs-on: macos-latest
149+
platform: macos
150+
arch: macosx_arm64
151+
152+
runs-on: ${{ matrix.runs-on }}
153+
154+
steps:
155+
- name: Setup Git
156+
run: |
157+
git config --global core.autocrlf false
158+
git config --global core.eol lf
159+
- name: Checkout sources
160+
uses: actions/checkout@v4
161+
- name: Setup Python
162+
uses: actions/setup-python@v5
163+
- name: Install cibuildwheel
164+
run: |
165+
python -m pip install cibuildwheel==3.1.4
166+
- name: Build wheels
167+
env:
168+
CIBW_PLATFORM: ${{ matrix.platform }}
169+
CIBW_BUILD: "cp3*-${{ matrix.arch }}"
170+
CIBW_SKIP: "cp3?t-* cp3??t-*"
171+
run: |
172+
python -m cibuildwheel --output-dir wheelhouse
173+
- name: Upload wheels
174+
uses: actions/upload-artifact@v4
175+
with:
176+
name: python-wheel-${{ matrix.platform }}-${{ matrix.arch }}-${{ strategy.job-index }}
177+
path: |
178+
./wheelhouse/*.whl
179+
if-no-files-found: error
180+
retention-days: 7
181+
132182
release:
133183
if: ${{ startsWith(github.ref, 'refs/tags/v') || inputs.force_release }}
134184
needs:
135185
- tests
136186
- asan
187+
- build_sdist
188+
- build_wheel
137189
runs-on: ubuntu-latest
138190
steps:
139191
- name: Downloads wheels
140192
uses: actions/download-artifact@v4
141193
with:
142-
pattern: package-*
194+
pattern: python-*
143195
path: package
144196
merge-multiple: true
145197
- name: Setup Python

0 commit comments

Comments
 (0)