Migrate to pyproject.toml #175
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: build | |
| on: | |
| push: | |
| branches: [ master ] | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build-and-test: | |
| name: Testing with Python 3.${{ matrix.python_minor }} on Linux | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| python_minor: [ "9" , "10" , "11" , "12" , "13" ] | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| - name: Install cibuildwheel | |
| run: | | |
| python3 -m pip install --upgrade pip | |
| python3 -m pip install cibuildwheel "twine>=6.1.0" | |
| - name: 🛠 Build and Test Hexhamming Python C extension | |
| run: cibuildwheel | |
| env: | |
| CIBW_BUILD: ${{ format('cp3{0}-manylinux_x86_64', matrix.python_minor) }} | |
| CIBW_TEST_REQUIRES: pytest pytest-benchmark | |
| CIBW_TEST_COMMAND: "pytest -s {project}/test" | |
| CIBW_BUILD_VERBOSITY: 1 | |
| - name: Check built wheels | |
| run: | | |
| twine --version | |
| twine check wheelhouse/* | |
| sdist: | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: build-and-test | |
| name: Source distribution | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install requirements | |
| run: | | |
| uv tool install check-manifest | |
| uv tool install "twine>=6.1.0" | |
| uv tool install build | |
| - name: Run check-manifest | |
| run: check-manifest | |
| - name: Build sdist | |
| run: uv build --sdist --out-dir wheelhouse | |
| - name: Install from sdist | |
| run: uv pip install --system wheelhouse/*.tar.gz | |
| - name: Check sdist | |
| run: | | |
| twine --version | |
| twine check wheelhouse/* | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4.4.3 | |
| with: | |
| name: sdist | |
| path: wheelhouse/*.tar.gz | |
| wheels_macos: | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: [build-and-test, sdist] | |
| name: Build macOS ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels | |
| runs-on: ${{ matrix.cibw_arch == 'arm64' && 'macos-14' || 'macos-13' }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| cibw_python: [ "cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*" ] | |
| cibw_arch: [ "x86_64", "arm64" ] | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| - name: Install cibuildwheel | |
| run: | | |
| python3 -m pip install --upgrade pip | |
| python3 -m pip install cibuildwheel "twine>=6.1.0" | |
| - name: 🛠 Build Hexhamming Python C extension | |
| run: cibuildwheel | |
| env: | |
| CIBW_BUILD: ${{ matrix.cibw_python }} | |
| CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }} | |
| CIBW_TEST_SKIP: "*-macosx_arm64" | |
| CC: /usr/bin/clang | |
| CXX: /usr/bin/clang++ | |
| CFLAGS: "-Wno-implicit-function-declaration" | |
| CIBW_TEST_REQUIRES: pytest pytest-benchmark | |
| CIBW_TEST_COMMAND: "pytest -s {project}/test" | |
| CIBW_BUILD_VERBOSITY: 1 | |
| - name: Check built wheels | |
| run: | | |
| twine --version | |
| twine check wheelhouse/* | |
| - name: Upload built wheels | |
| uses: actions/upload-artifact@v4.4.3 | |
| with: | |
| name: wheels-macos-${{ matrix.cibw_arch }}-${{ matrix.cibw_python }} | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| wheels_linux: | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: [build-and-test, sdist] | |
| name: Build ${{ matrix.cibw_buildlinux }} ${{ matrix.cibw_arch }} wheels | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| cibw_buildlinux: [ manylinux, musllinux ] | |
| cibw_arch: [ "x86_64", "aarch64" ] | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| - name: Set up QEMU | |
| if: matrix.cibw_arch == 'aarch64' | |
| uses: docker/setup-qemu-action@v3.2.0 | |
| with: | |
| platforms: arm64 | |
| - name: Install cibuildwheel | |
| run: | | |
| python3 -m pip install --upgrade pip | |
| python3 -m pip install cibuildwheel "twine>=6.1.0" | |
| - name: 🛠 Build Hexhamming Python C extension | |
| run: cibuildwheel | |
| env: | |
| CIBW_BUILD: ${{ format('cp3*-{0}*', matrix.cibw_buildlinux) }} | |
| CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }} | |
| CIBW_TEST_REQUIRES: pytest pytest-benchmark | |
| CIBW_TEST_COMMAND: "pytest -s {project}/test" | |
| CIBW_BUILD_VERBOSITY: 1 | |
| - name: Check built wheels | |
| run: | | |
| twine --version | |
| twine check wheelhouse/* | |
| - name: Upload built wheels | |
| uses: actions/upload-artifact@v4.4.3 | |
| with: | |
| name: wheels-linux-${{ matrix.cibw_buildlinux }}-${{ matrix.cibw_arch }} | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| wheels_windows: | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: [build-and-test, sdist] | |
| name: Build Windows wheels | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| - name: Install cibuildwheel | |
| run: | | |
| python3 -m pip install --upgrade pip | |
| python3 -m pip install cibuildwheel "twine>=6.1.0" | |
| - name: 🛠 Build Hexhamming Python C extension | |
| run: cibuildwheel | |
| env: | |
| CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*" | |
| CIBW_ARCHS_WINDOWS: "AMD64" | |
| CIBW_TEST_REQUIRES: pytest pytest-benchmark | |
| CIBW_TEST_COMMAND: "pytest -s {project}/test" | |
| CIBW_BUILD_VERBOSITY: 1 | |
| - name: Check built wheels | |
| run: | | |
| twine --version | |
| twine check wheelhouse/* | |
| - name: Upload built wheels | |
| uses: actions/upload-artifact@v4.4.3 | |
| with: | |
| name: wheels-windows | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish-wheels: | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: [wheels_macos, wheels_linux, wheels_windows] | |
| name: Publish wheels | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Collect sdist and wheels | |
| uses: actions/download-artifact@v4.1.8 | |
| with: | |
| pattern: '{sdist,wheels-*}' | |
| path: wheelhouse | |
| merge-multiple: true | |
| - name: Install twine | |
| run: python -m pip install "twine>=6.1.0" | |
| - name: 📦 Publish distribution to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: twine upload --skip-existing wheelhouse/* |