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 8fdb179
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
33 changes: 11 additions & 22 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,22 +20,27 @@ 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-quemu-action@v3
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
- uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
release:
types: [published]
push:
branches: [main]
branches: [main, pr1102]

permissions:
contents: read

jobs:
build:
uses: Instagram/LibCST/.github/workflows/build.yml@main
uses: Instagram/LibCST/.github/workflows/build.yml@pr1102
upload_release:
name: Upload wheels to pypi
runs-on: ubuntu-latest
Expand Down

0 comments on commit 8fdb179

Please sign in to comment.