Skip to content

Commit

Permalink
ci: build linux-arm64 wheels using emulation
Browse files Browse the repository at this point in the history
Stop using self-hosted runner
  • Loading branch information
zsol committed Feb 3, 2024
1 parent e5cc07c commit c12590c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
35 changes: 12 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,13 @@ on:

jobs:
# Build python wheels
build_matrix:
name: Prepare job matrix for build job
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
# match github.ref to the on_ref_regex field in the json
# to skip running linux/aarch64 builds on PRs
run: |
matrix=$(jq --arg ref "${{ github.ref }}" \
'map(select(.on_ref_regex as $pat | $pat == null or ($ref | test($pat))) | del(.on_ref_regex))' \
.github/build-matrix.json)
echo matrix={\"include\":$(echo $matrix)}\" >> $GITHUB_OUTPUT
build:
name: Build wheels on ${{ join(matrix.os, '/') }}/${{ matrix.vers }}
needs: build_matrix
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build_matrix.outputs.matrix)}}
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
env:
SCCACHE_VERSION: 0.2.13
CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | env -u CARGO_HOME sh -s -- --default-toolchain stable --profile minimal -y"
Expand All @@ -36,25 +20,30 @@ jobs:
CIBW_BEFORE_ALL_WINDOWS: "rustup target add x86_64-pc-windows-msvc i686-pc-windows-msvc"
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin" LIBCST_NO_LOCAL_SCHEME=$LIBCST_NO_LOCAL_SCHEME'
CIBW_SKIP: "cp27-* cp34-* cp35-* pp* *-win32 *-win_arm64 *-musllinux_*"
CIBW_ARCHS: ${{ matrix.vers }}
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BUILD_VERBOSITY: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
if: ${{ !contains(matrix.os, 'self-hosted') }}
with:
cache: pip
cache-dependency-path: "pyproject.toml"
python-version: "3.10"
python-version: "3.12"
- name: Disable scmtools local scheme
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: >-
echo LIBCST_NO_LOCAL_SCHEME=1 >> $GITHUB_ENV
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
- uses: actions/upload-artifact@v4
with:
path: wheelhouse/*.whl
name: wheels-${{matrix.os}}-${{matrix.vers}}
name: wheels-${{matrix.os}}
6 changes: 3 additions & 3 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ jobs:
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
packages_dir: ${{ steps.download.outputs.download-path }}
repository-url: https://test.pypi.org/legacy/
packages-dir: ${{ steps.download.outputs.download-path }}
- name: Publish distribution 📦 to PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: ${{ steps.download.outputs.download-path }}
packages-dir: ${{ steps.download.outputs.download-path }}

0 comments on commit c12590c

Please sign in to comment.