Skip to content

Commit

Permalink
ci: skip long-running wheels build except when publishing (#50)
Browse files Browse the repository at this point in the history
* ci: skip long-running wheels build except when publishing
  • Loading branch information
nh13 authored Jan 28, 2025
1 parent 5ae190b commit cb75c71
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/publish_pybwa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
name: build wheels
needs: tests
uses: "./.github/workflows/wheels.yml"
with:
skip: false

build-sdist:
name: build source distribution
Expand Down
48 changes: 32 additions & 16 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,44 @@ name: build wheels
on:
pull_request:
workflow_call:
inputs:
skip:
description: skip known long-running builds build (>10 minutes)
required: false
type: boolean
default: true
workflow_dispatch:

inputs:
skip:
description: skip known long-running builds build (>10 minutes)
required: false
type: boolean
default: true

jobs:
build_wheels:
name: Build wheels for ${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
define-buildplat:
name: Builds os-runner and platform tag matrix to build wheels
runs-on: ubuntu-latest
outputs:
buildplat: ${{ steps.buildplat.outputs.buildplat }}
steps:
- name: Define the build platform (short-running builds)
id: buildplat
run: |
if [[ "${{ github.event_name == 'pull_request' || inputs.skip }}" == "true" ]]; then
echo 'buildplat=[["ubuntu-22.04", "manylinux_x86_64"], ["ubuntu-22.04", "musllinux_x86_64"], ["macos-13", "macosx_x86_64"], ["macos-15", "macosx_arm64"]]' >> "$GITHUB_OUTPUT"
else
echo 'buildplat=[["ubuntu-22.04", "manylinux_x86_64"], ["ubuntu-22.04", "musllinux_x86_64"], ["ubuntu-22.04", "manylinux_aarch64"], ["ubuntu-22.04", "musllinux_aarch64"], ["macos-13", "macosx_x86_64"], ["macos-15", "macosx_arm64"]]' >> "$GITHUB_OUTPUT"
fi
build-wheels:
name: Build wheels for ${{ matrix.python-version }}-${{ matrix.buildplat[1] }} input-${{ inputs.skip }}
runs-on: ${{ matrix.buildplat[0] }}
needs: define-buildplat
strategy:
matrix:
buildplat:
- [ubuntu-22.04, manylinux_x86_64]
- [ubuntu-22.04, musllinux_x86_64]
- [ubuntu-22.04, manylinux_aarch64]
- [ubuntu-22.04, musllinux_aarch64]
- [macos-13, macosx_x86_64]
- [macos-15, macosx_arm64]
buildplat: ${{ fromJSON(needs.define-buildplat.outputs.buildplat) }}
python-version: [cp39, cp310, cp311, cp312]
exclude:
# cp39, cp310 on musllinux_aarch64, wheel building may hangup, ignore it
- buildplat: [ubuntu-22.04, musllinux_aarch64]
python-version: cp39
- buildplat: [ubuntu-22.04, musllinux_aarch64]
python-version: cp310

steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit cb75c71

Please sign in to comment.