Modernize the build system and version tracking. #910
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: samplerate | |
| on: | |
| push: | |
| branches: [master] | |
| tags: ["v*", "test-*"] | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| workflow_dispatch: | |
| jobs: | |
| build_sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.9" | |
| - name: Build sdist | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -U setuptools setuptools_scm build twine | |
| python -m build --sdist | |
| twine check dist/* | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| build_wheels_pr: | |
| if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'full-build') | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| cibw_build: "cp314-manylinux_x86_64" | |
| cibw_archs: "x86_64" | |
| - os: macos-latest | |
| cibw_build: "cp314-macosx_universal2" | |
| cibw_archs: "universal2" | |
| - os: windows-latest | |
| cibw_build: "cp314-win_amd64" | |
| cibw_archs: "AMD64" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - uses: pypa/cibuildwheel@v3.4.0 | |
| env: | |
| CIBW_BUILD: ${{ matrix.cibw_build }} | |
| CIBW_ARCHS: ${{ matrix.cibw_archs }} | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
| CIBW_TEST_REQUIRES: "pytest numpy" | |
| CIBW_TEST_COMMAND: "pytest {project}/tests" | |
| build_wheels: | |
| if: >- | |
| github.event_name == 'push' || | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'full-build')) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Set up QEMU | |
| if: runner.os == 'Linux' | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - uses: pypa/cibuildwheel@v3.4.0 | |
| env: | |
| CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*" | |
| CIBW_SKIP: "*-musllinux_* cp39-*aarch64 cp310-*aarch64" | |
| CIBW_ARCHS_LINUX: "x86_64 aarch64" | |
| CIBW_ARCHS_MACOS: "universal2" | |
| CIBW_ARCHS_WINDOWS: "AMD64" | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
| CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 | |
| CIBW_TEST_REQUIRES: "pytest numpy" | |
| CIBW_TEST_COMMAND: "pytest {project}/tests" | |
| CIBW_TEST_SKIP: "cp314-*" | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: wheelhouse/*.whl | |
| publish: | |
| needs: [build_sdist, build_wheels] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Validate wheels | |
| run: | | |
| pip install --upgrade twine packaging | |
| twine check dist/* | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
| run: | | |
| twine upload --skip-existing dist/* | |
| publish-test: | |
| needs: [build_sdist, build_wheels] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-') | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Validate wheels | |
| run: | | |
| pip install --upgrade twine packaging | |
| twine check dist/* | |
| - name: Publish to PyPI Test | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }} | |
| TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }} | |
| TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ | |
| run: | | |
| twine upload --skip-existing dist/* |