Skip to content

Commit 2c18b7c

Browse files
committed
Fixing workflow full build conditions
Also simplifying workflow conditions by splitting steps.
1 parent 2f1e34a commit 2c18b7c

2 files changed

Lines changed: 25 additions & 13 deletions

File tree

.github/workflows/build_wheels.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ jobs:
2424
- os: macos-13 # Intel Mac for x86_64 - could not build without specifying 13.0
2525
cibw_archs: "x86_64"
2626
deployment_target: "13.0"
27-
needs_cpp: true
2827

2928
- os: macos-14 # Apple Silicon - could not build without specifying 14.0
3029
cibw_archs: "arm64"
3130
deployment_target: "14.0"
32-
needs_cpp: true
3331

3432
steps:
35-
- uses: actions/checkout@v4
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
3635
with:
3736
fetch-depth: 0 # full history with tags for setuptools_scm
3837

@@ -70,18 +69,29 @@ jobs:
7069
contains(matrix.cibw_archs, 'aarch64')
7170
uses: docker/setup-qemu-action@v3
7271

73-
- name: Build wheels
72+
# Do not set CIBW_BUILD here, let pyproject.toml handle it
73+
- name: Build wheels (full build)
74+
if: steps.check.outputs.full_build == 'true'
75+
uses: pypa/cibuildwheel@v3.2.1
76+
with:
77+
output-dir: dist
78+
config-file: pyproject.toml
79+
env:
80+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
81+
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '' }}
82+
83+
# Set CIBW_BUILD for quick builds (Linux only, Python 3.11 only)
84+
- name: Build wheels (quick build)
7485
if: |
75-
!matrix.needs_cpp ||
76-
steps.check.outputs.full_build == 'true'
86+
steps.check.outputs.full_build == 'false' &&
87+
runner.os == 'Linux'
7788
uses: pypa/cibuildwheel@v3.2.1
7889
with:
7990
output-dir: dist
8091
config-file: pyproject.toml
8192
env:
82-
# Only build x86_64 and Python 3.11 for quick builds
83-
CIBW_ARCHS: ${{ steps.check.outputs.full_build == 'true' && matrix.cibw_archs || 'x86_64' }}
84-
CIBW_BUILD: ${{ steps.check.outputs.full_build == 'true' && '' || 'cp311-*' }}
93+
CIBW_ARCHS: x86_64
94+
CIBW_BUILD: cp311-*
8595
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '' }}
8696

8797
# Create a sanitized string for the artifact name
@@ -93,13 +103,14 @@ jobs:
93103
archs="${{ matrix.cibw_archs }}"
94104
echo "arch_string=${archs// /-}" >> $GITHUB_OUTPUT
95105
96-
- uses: actions/upload-artifact@v4
97-
if: |
98-
!env.ACT &&
99-
(!matrix.needs_cpp || steps.check.outputs.full_build == 'true')
106+
# Upload built wheels
107+
- name: Upload wheels
108+
uses: actions/upload-artifact@v4
109+
if: "!env.ACT"
100110
with:
101111
name: wheels-${{ matrix.os }}-${{ steps.check.outputs.full_build == 'true' && steps.artifact_name.outputs.arch_string || 'x86_64' }}
102112
path: dist/*.whl
113+
if-no-files-found: ignore # Don't fail if no wheels were built
103114

104115
build_sdist:
105116
name: Build source distribution

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Makefile
1515
# Python build artifacts
1616
build/
1717
dist/
18+
wheelhouse/
1819
*.egg-info/
1920
__pycache__/
2021
_version.py

0 commit comments

Comments
 (0)