diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 21467eeb..f2974b87 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -22,12 +22,32 @@ concurrency: cancel-in-progress: true jobs: + meta: + runs-on: ubuntu-latest + outputs: + commit-message: ${{ steps.get-commit-message.outputs.commit-message }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} # gets correct commit message + - name: Show commit + run: git show -s + - name: Output commit message + id: get-commit-message + run: | + { + echo 'commit-message<> "$GITHUB_OUTPUT" + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true + ref: ${{ github.event.pull_request.head.sha }} # gets correct commit message - uses: actions/setup-python@v5 with: python-version: "3.10" @@ -63,7 +83,6 @@ jobs: # https://github.com/actions/setup-python/issues/852 - os: macos-latest python-version: "3.7" - steps: - uses: actions/checkout@v4 with: @@ -87,9 +106,11 @@ jobs: run: | pytest -v --benchmark-disable -n auto + # NOTE: build step only runs on tag builds or when the commit message contains + # "[ci test build]" for testing build: - needs: [test] - if: "startsWith(github.ref, 'refs/tags/')" + needs: [meta, test] + if: "${{ startsWith(github.ref, 'refs/tags/') || contains(needs.meta.outputs.commit-message, '[ci test build]') }}" runs-on: ${{ matrix.os }} strategy: fail-fast: true @@ -104,7 +125,7 @@ jobs: uses: docker/setup-qemu-action@v3 with: platforms: arm64 - - uses: pypa/cibuildwheel@v2.17.0 + - uses: pypa/cibuildwheel@v2.20.0 env: CIBW_SKIP: cp36-* pp*-win* pp*-macosx* *_i686 CIBW_TEST_SKIP: "*-win_arm64" @@ -118,10 +139,11 @@ jobs: name: wheels-${{ runner.os }} path: dist + # NOTE: release step only runs on tag builds release: name: Release runs-on: ubuntu-latest - if: "startsWith(github.ref, 'refs/tags/')" + if: ${{ startsWith(github.ref, 'refs/tags/') }} needs: [build] steps: - uses: actions/download-artifact@v4