Skip to content

Commit

Permalink
Merge pull request airspeed-velocity#1339 from HaoZeke/makeWheels
Browse files Browse the repository at this point in the history
CI: Enable wheel builds again
  • Loading branch information
mattip authored Sep 10, 2023
2 parents 935be55 + 4e24d5a commit 6722131
Showing 1 changed file with 40 additions and 7 deletions.
47 changes: 40 additions & 7 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,47 @@
# Build on every branch push, tag push, and pull request change:
# From: https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
# Also:
# https://github.com/airspeed-velocity/asv/blob/main/.github/workflows/wheels.yml
# include [wheel build] in the commit to trigger wheel builds
name: Build wheels
on:
release:
types:
- published
on: [push, pull_request, workflow_dispatch]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
get_commit_message:
name: Get commit message
runs-on: ubuntu-latest
if: "github.repository == 'airspeed-velocity/asv'"
outputs:
message: ${{ steps.commit_message.outputs.message }}
steps:
- name: Checkout asv
uses: actions/checkout@v3
# Gets the correct commit message for pull request
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get commit message
id: commit_message
run: |
set -xe
COMMIT_MSG=$(git log --no-merges -1 --oneline)
echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo github.ref ${{ github.ref }}
build_wheels:
name: Build wheel for ${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
needs: get_commit_message
if: >-
contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
runs-on: ${{ matrix.buildplat[0] }}
environment: pypi
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
Expand All @@ -28,7 +55,7 @@ jobs:
- [macos-12, macosx_x86_64]
- [macos-12, macosx_arm64]
- [windows-2019, win_amd64]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy3.8', 'pypy3.9']

steps:
- uses: actions/checkout@v3
Expand All @@ -44,6 +71,12 @@ jobs:

build_sdist:
name: Build source distribution
needs: get_commit_message
if: >-
contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -65,7 +98,7 @@ jobs:
permissions:
id-token: write # for trusted publishing
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'airspeed-velocity/asv'
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
Expand Down

0 comments on commit 6722131

Please sign in to comment.