From bd3b37f48b2b94b11c4ecdd96006efcab39a75a0 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 14 Jun 2024 09:52:28 +0100 Subject: Disable all steps in job when not building wheel --- .github/workflows/build.yml | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9bdb3de..69596a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,36 +116,45 @@ jobs: steps: + - name: Check whether to build wheel + id: should-build-wheel + if: | + (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || + matrix.cibw-only == 'cp310-manylinux_x86_64' || + matrix.cibw-only == 'cp310-win_amd64' || + matrix.cibw-only == 'cp310-win32' + shell: bash + run: echo true=1 >> $GITHUB_OUTPUT + - uses: actions/checkout@v4 + if: steps.should-build-wheel.outputs.true - name: Use Python 3.11 + if: steps.should-build-wheel.outputs.true uses: actions/setup-python@v5 with: python-version: '3.11' - name: Set up MSYS2 - if: runner.os == 'Windows' + if: steps.should-build-wheel.outputs.true && runner.os == 'Windows' uses: ./.github/actions/setup-msys2 with: arch: ${{ matrix.arch }} - name: Set up QEMU - if: runner.os == 'Linux' + if: steps.should-build-wheel.outputs.true && runner.os == 'Linux' uses: docker/setup-qemu-action@v2 with: platforms: all - name: Print build identifiers + if: steps.should-build-wheel.outputs.true run: | python -m pip install cibuildwheel==2.17.0 python -m cibuildwheel --only ${{ matrix.cibw-only }} --print-build-identifiers - name: Build wheels - if: | - (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || - matrix.cibw-only == 'cp310-manylinux_x86_64' || - matrix.cibw-only == 'cp310-win_amd64' || - matrix.cibw-only == 'cp310-win32' + if: steps.should-build-wheel.outputs.true uses: pypa/cibuildwheel@v2.17.0 with: only: ${{ matrix.cibw-only }} @@ -153,11 +162,7 @@ jobs: CIBW_ENVIRONMENT: ${{ runner.os == 'Windows' && matrix.arch == 'x86' && 'CC=i686-w64-mingw32-gcc.exe' || '' }} - uses: actions/upload-artifact@v3 - if: | - (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || - matrix.cibw-only == 'cp310-manylinux_x86_64' || - matrix.cibw-only == 'cp310-win_amd64' || - matrix.cibw-only == 'cp310-win32' + if: steps.should-build-wheel.outputs.true with: path: ./wheelhouse/*.whl -- cgit v1.2.3