Skip to content

Commit

Permalink
Combine Windows wheel job into main wheel job
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilliamson committed Jun 14, 2024
1 parent 03960d3 commit 36bda94
Showing 1 changed file with 26 additions and 53 deletions.
79 changes: 26 additions & 53 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ jobs:
path: dist/*.tar.gz

build_wheels_matrix:
if: false
name: Generate matrix for building wheels
runs-on: ubuntu-latest

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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/[email protected]
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/[email protected]
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/[email protected]
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

Expand Down

0 comments on commit 36bda94

Please sign in to comment.