@@ -3,73 +3,92 @@ name: samplerate
33on : [push, pull_request]
44
55jobs :
6- build :
6+ build_sdist :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - uses : actions/checkout@v6
10+ with :
11+ submodules : recursive
12+ fetch-depth : 0
13+ - name : Set up Python
14+ uses : actions/setup-python@v6
15+ with :
16+ python-version : " 3.12"
17+ - name : Build sdist
18+ run : |
19+ python -m pip install --upgrade pip
20+ pip install -U setuptools setuptools_scm build twine
21+ python -m build --sdist
22+ twine check dist/*
23+ - uses : actions/upload-artifact@v6
24+ with :
25+ name : sdist
26+ path : dist/*.tar.gz
727
28+ build_wheels :
829 runs-on : ${{ matrix.os }}
930 strategy :
1031 fail-fast : false
11- max-parallel : 12
1232 matrix :
1333 os : [ubuntu-latest, macos-latest, windows-latest]
14- python-version : [3.9, "3.10", "3.11", "3.12", "3.13", "3.14"]
1534 steps :
16- - uses : actions/checkout@v3
17- - name : Checkout submodules
18- shell : bash
19- run : |
20- auth_header="$(git config --local --get http.https://github.com/.extraheader)"
21- git submodule sync --recursive
22- git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
23- - name : Set up Python ${{ matrix.python-version }}
24- uses : actions/setup-python@v4
35+ - uses : actions/checkout@v6
2536 with :
26- python-version : ${{ matrix.python-version }}
27- - name : Install dependencies
28- run : |
29- python -m pip install --upgrade pip
30- pip install -U setuptools setuptools_scm wheel build twine
31- pip install -r requirements.txt
32- - name : Build package
33- run : |
34- python -m pip install -e .
35- - name : Test with pytest
36- run : |
37- pytest
38- - name : Test the universal wheels
39- if : matrix.os == 'ubuntu-latest'
40- run : |
41- # do not build binary wheels on linux
42- python -m build --sdist
43- twine check dist/*
44- - name : Test the binary wheels
45- if : matrix.os != 'ubuntu-latest'
46- run : |
47- python -m build
48- twine check dist/*
49- - name : Publish sdist to pypi
50- if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest'
37+ submodules : recursive
38+ fetch-depth : 0
39+ - name : Set up QEMU
40+ if : runner.os == 'Linux'
41+ uses : docker/setup-qemu-action@v3
42+ with :
43+ platforms : all
44+ - uses : pypa/cibuildwheel@v3.4.0
5145 env :
52- TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
53- TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
46+ CIBW_BUILD : " cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
47+ CIBW_ARCHS_LINUX : " x86_64 aarch64"
48+ CIBW_ARCHS_WINDOWS : " AMD64"
49+ CIBW_MANYLINUX_X86_64_IMAGE : manylinux2014
50+ CIBW_MANYLINUX_AARCH64_IMAGE : manylinux2014
51+ CIBW_TEST_REQUIRES : " pytest numpy"
52+ CIBW_TEST_COMMAND : " pytest {project}/tests"
53+ - uses : actions/upload-artifact@v6
54+ with :
55+ name : wheels-${{ matrix.os }}
56+ path : wheelhouse/*.whl
57+
58+ publish :
59+ needs : [build_sdist, build_wheels]
60+ runs-on : ubuntu-latest
61+ if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
62+ steps :
63+ - uses : actions/download-artifact@v8
64+ with :
65+ path : dist
66+ merge-multiple : true
67+ - name : Validate wheels
5468 run : |
55- twine upload --skip-existing dist/*
56- - name : Publish bdist to pypi
57- if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && matrix.os != 'ubuntu-latest'
69+ pip install twine
70+ twine check dist/*
71+ - name : Publish to PyPI
5872 env :
5973 TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
6074 TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
6175 run : |
6276 twine upload --skip-existing dist/*
63- - name : Publish sdist to pypi-test
64- if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-') && matrix.os == 'ubuntu-latest'
65- env :
66- TWINE_USERNAME : ${{ secrets.PYPITEST_USERNAME }}
67- TWINE_PASSWORD : ${{ secrets.PYPITEST_PASSWORD }}
68- TWINE_REPOSITORY_URL : https://test.pypi.org/legacy/
77+
78+ publish-test :
79+ needs : [build_sdist, build_wheels]
80+ runs-on : ubuntu-latest
81+ if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-')
82+ steps :
83+ - uses : actions/download-artifact@v8
84+ with :
85+ path : dist
86+ merge-multiple : true
87+ - name : Validate wheels
6988 run : |
70- twine upload --skip-existing dist/*
71- - name : Publish bdist to pypi-test
72- if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-') && matrix.os != 'ubuntu-latest'
89+ pip install twine
90+ twine check dist/*
91+ - name : Publish to PyPI Test
7392 env :
7493 TWINE_USERNAME : ${{ secrets.PYPITEST_USERNAME }}
7594 TWINE_PASSWORD : ${{ secrets.PYPITEST_PASSWORD }}
0 commit comments