From eca6bd6d648296ed8e745779070095338b48bfa2 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 14 Jun 2024 09:41:05 +0100 Subject: [PATCH] Combine Windows wheel job into main wheel job --- .github/workflows/build.yml | 79 ++++++++++++------------------------- 1 file changed, 26 insertions(+), 53 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02a59a0..2370de6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,7 +69,6 @@ jobs: path: dist/*.tar.gz build_wheels_matrix: - if: false name: Generate matrix for building wheels runs-on: ubuntu-latest @@ -99,13 +98,16 @@ jobs: cibuildwheel --print-build-identifiers --platform linux \ | sed 's/.*/{"cibw-only": "&", "os": "ubuntu-20.04"}/' \ && cibuildwheel --print-build-identifiers --platform macos \ - | sed 's/.*/{"cibw-only": "&", "os": "macos-13" }/' + | sed 's/.*/{"cibw-only": "&", "os": "macos-13" }/' \ + && CIBW_ARCHS_WINDOWS=AMD64 cibuildwheel --print-build-identifiers --platform windows \ + | sed 's/.*/{"cibw-only": "&", "os": "windows-2022", "arch": "AMD64" }/' \ + && CIBW_ARCHS_WINDOWS=x86 cibuildwheel --print-build-identifiers --platform windows \ + | sed 's/.*/{"cibw-only": "&", "os": "windows-2022", "arch": "x86" }/' } | jq --slurp --compact-output '{"include": .}' ) echo matrix="$MATRIX" >> $GITHUB_OUTPUT build_wheels: - if: false name: Build ${{ matrix.cibw-only }} wheel needs: build_wheels_matrix @@ -124,6 +126,12 @@ jobs: with: python-version: '3.11' + - name: Set up MSYS2 + if: runner.os == 'Windows' + uses: ./.github/actions/setup-msys2 + with: + arch: ${{ matrix.arch }} + - name: Set up QEMU if: runner.os == 'Linux' uses: docker/setup-qemu-action@v2 @@ -136,62 +144,27 @@ jobs: 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' }} + 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' + }} uses: pypa/cibuildwheel@v2.17.0 with: only: ${{ matrix.cibw-only }} - - - uses: actions/upload-artifact@v3 - if: ${{ (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || matrix.cibw-only == 'cp310-manylinux_x86_64' }} - with: - path: ./wheelhouse/*.whl - - build_wheels_win: - name: Build Windows wheel - - runs-on: windows-2022 - - strategy: - matrix: - arch: ["AMD64", "x86"] - - steps: - - - uses: actions/checkout@v4 - - - name: Use Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Set up MSYS2 - uses: ./.github/actions/setup-msys2 - with: - arch: ${{ matrix.arch }} - - - name: Print build identifiers - run: | - python -m pip install cibuildwheel==2.17.0 - python -m cibuildwheel --print-build-identifiers - env: - CIBW_ARCHS: ${{ matrix.arch }} - - - name: Build wheels - if: ${{ (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) }} - uses: pypa/cibuildwheel@v2.17.0 - env: - CIBW_ARCHS: ${{ matrix.arch }} - CIBW_ENVIRONMENT: ${{ matrix.arch == 'x86' && 'CC=i686-w64-mingw32-gcc.exe' || '' }} - - - name: Build wheels - if: ${{ !(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) }} - uses: pypa/cibuildwheel@v2.17.0 - with: - only: ${{ matrix.arch == 'x86' && 'cp310-win32' || 'cp310-win_amd64' }} env: - CIBW_ENVIRONMENT: ${{ matrix.arch == 'x86' && 'CC=i686-w64-mingw32-gcc.exe' || '' }} + 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' + }} with: path: ./wheelhouse/*.whl