Skip to content

Commit

Permalink
also build macos x86-64 & aarch64 wheels.
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Mar 12, 2024
1 parent 5546aea commit 533fe28
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ jobs:
- run:
name: cibuildwheel
command: |
source .github/workflows/wheel-prep.sh
export CIBW_ENVIRONMENT="SCHEMA_SALAD_USE_MYPYC=1 MYPYPATH=/project/mypy-stubs SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION}"
python3 -m cibuildwheel .
# "/project" is the project path inside the cibuildwheel container itself
- run:
name: move tests results out of the wheelhouse
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/wheel-prep.sh

This file was deleted.

46 changes: 32 additions & 14 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,17 @@ jobs:
fetch-depth: 0 # slow, but gets all the tags
ref: ${{ github.event.client_payload.ref }}

# Used to host cibuildwheel
- uses: actions/setup-python@v5

# - name: Set up QEMU
# if: runner.os == 'Linux'
# uses: docker/setup-qemu-action@v2
# with:
# platforms: all

- name: Install cibuildwheel
run: python -m pip install -rcibw-requirements.txt

- name: set version
run: pip install setuptools_scm[toml] wheel && python setup.py --version
run: python3 -m pip install -U setuptools setuptools_scm[toml] wheel && python3 setup.py --version

- name: Build wheels
run: |
source .github/workflows/wheel-prep.sh
export CIBW_ENVIRONMENT="SCHEMA_SALAD_USE_MYPYC=1 MYPYPATH=/project/mypy-stubs SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION}"
python -m cibuildwheel --output-dir wheelhouse
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BUILD: ${{ matrix.build }}
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }}
CIBW_MUSLLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }}
Expand Down Expand Up @@ -85,7 +74,7 @@ jobs:
ref: ${{ github.event.client_payload.ref }}

- name: set version
run: pip install setuptools_scm[toml] wheel && python setup.py --version
run: python3 -m pip install -U setuptools setuptools_scm[toml] wheel && python3 setup.py --version

- name: Build sdist
run: pipx run build --sdist
Expand All @@ -95,6 +84,35 @@ jobs:
name: artifact-source
path: dist/*.tar.gz

build_wheels_macos:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [macos-13, macos-14]
steps:
- uses: actions/checkout@v4
if: ${{ github.event_name != 'repository_dispatch' }}
with:
fetch-depth: 0 # slow, but gets all the tags
- uses: actions/checkout@v4
if: ${{ github.event_name == 'repository_dispatch' }}
with:
fetch-depth: 0 # slow, but gets all the tags
ref: ${{ github.event.client_payload.ref }}

- name: set version
run: python3 -m pip install -U setuptools setuptools_scm[toml] wheel && python3 setup.py --version

- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0

- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test-extras = "pycodegen"
skip = "pp*"
# ^ skip building wheels on PyPy (any version)
build-verbosity = "1"
environment = { SCHEMA_SALAD_USE_MYPYC="1", MYPYPATH="$(pwd)/mypy-stubs" } #, SETUPTOOLS_SCM_PRETEND_VERSION="$(grep __version__ schema_salad/_version.py | awk -F\\' '{ print $2 }')" }

[tool.black]
line-length = 100
Expand Down

0 comments on commit 533fe28

Please sign in to comment.