restructure build matrix #2
This file contains 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 wheels | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
outputs: | |
SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with : | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Install test dependencies | |
run: | | |
python -m pip install build twine flake8 pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
python -m pip install -e . | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 SuchTree --count --ignore=E201,E202,E203 \ | |
--select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 SuchTree --count --ignore=E201,E202,E203 \ | |
--exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
run: pytest | |
- name: Build source distribution | |
id: sdist | |
run: | | |
python -m build --sdist | |
python -m .github/export_sdist_name.py | |
- name: Upload sdist result | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
if-no-files-found: error | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} for python ${{ matrix.python-version }} | |
needs: build_sdist | |
runs-on: ${{ matrix.os }} | |
env: | |
CIBW_BEFORE_BUILD: >- | |
rm -rf {package}/build | |
CIBW_BEFORE_BUILD_WINDOWS: >- | |
pip install delvewheel && | |
rm -rf {package}/build | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- | |
delvewheel repair -w {dest_dir} {wheel} | |
CIBW_AFTER_BUILD: >- | |
twine check {wheel} | |
CIBW_TEST_COMMAND: >- | |
python {package}/.github/check_version_number.py | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
cibw_archs: "x86_64" | |
- os: ubuntu-latest | |
cibw_archs: "aarch64" | |
- os: windows-latest | |
cibw_archs: "auto64" | |
- os: macos-latest | |
cibw_archs: "x86_64" | |
- os: macos-latest | |
cibw_archs: "arm64" | |
steps: | |
- name: Download sdist | |
uses: actions/download-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/ | |
- name: Build wheels for CPython 3.12 | |
uses: pypa/[email protected] | |
with: | |
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} | |
env: | |
CIBW_BUILD: "cp312-*" | |
CIBW_ARCHS: ${{ matrix.cibw_archs }} | |
- name: Build wheels for CPython 3.11 | |
uses: pypa/[email protected] | |
with: | |
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} | |
env: | |
CIBW_BUILD: "cp311-*" | |
CIBW_ARCHS: ${{ matrix.cibw_archs }} | |
- name: Build wheels for CPython 3.10 | |
uses: pypa/[email protected] | |
with: | |
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} | |
env: | |
CIBW_BUILD: "cp310-*" | |
CIBW_ARCHS: ${{ matrix.cibw_archs }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }} | |
path: ./wheelhouse/*.whl | |
merge: | |
runs-on: ubuntu-latest | |
needs: build_wheels | |
steps: | |
- name: Merge Artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: wheelhouse | |
pattern: cibw-wheels-* |