Skip to content

Commit bc66841

Browse files
committed
fix(release): split macOS binary wheels
1 parent 5773093 commit bc66841

2 files changed

Lines changed: 50 additions & 8 deletions

File tree

.github/workflows/release-published.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ jobs:
177177
linux-aarch64,
178178
linux-musl-x86_64,
179179
linux-musl-aarch64,
180-
macos-universal2,
180+
macos-aarch64,
181+
macos-x86_64,
181182
windows-amd64,
182183
windows-arm64,
183184
]
@@ -198,10 +199,16 @@ jobs:
198199
os: ubuntu-latest
199200
python-interpreter: "3.12"
200201
codex-targets: aarch64-unknown-linux-musl
201-
- platform: macos-universal2
202+
- platform: macos-aarch64
202203
os: macos-14
203204
python-interpreter: 3.12
204-
codex-targets: x86_64-apple-darwin,aarch64-apple-darwin
205+
codex-targets: aarch64-apple-darwin
206+
rust-target: aarch64-apple-darwin
207+
- platform: macos-x86_64
208+
os: macos-13
209+
python-interpreter: 3.12
210+
codex-targets: x86_64-apple-darwin
211+
rust-target: x86_64-apple-darwin
205212
- platform: windows-amd64
206213
os: windows-latest
207214
python-interpreter: 3.12
@@ -232,7 +239,7 @@ jobs:
232239
pip install zstandard
233240
234241
- name: Install build backend (host)
235-
if: ${{ matrix.platform == 'macos-universal2' || matrix.platform == 'windows-amd64' || matrix.platform == 'windows-arm64' }}
242+
if: ${{ startsWith(matrix.platform, 'macos-') || matrix.platform == 'windows-amd64' || matrix.platform == 'windows-arm64' }}
236243
run: |
237244
pip install build maturin
238245
@@ -322,13 +329,13 @@ jobs:
322329
apk add --no-cache curl perl perl-text-template >/dev/null 2>&1 || true
323330
args: --release -i python3.12 -o dist
324331

325-
- name: Build macOS universal2 wheel
326-
if: ${{ matrix.platform == 'macos-universal2' }}
332+
- name: Build macOS wheel
333+
if: ${{ startsWith(matrix.platform, 'macos-') }}
327334
run: |
328335
python -m pip install --upgrade pip
329336
pip install maturin
330-
rustup target add x86_64-apple-darwin aarch64-apple-darwin
331-
maturin build --release -i python -o dist --target universal2-apple-darwin
337+
rustup target add "${{ matrix.rust-target }}"
338+
maturin build --release -i python -o dist --target "${{ matrix.rust-target }}"
332339
333340
- name: Build Windows wheel
334341
if: ${{ matrix.platform == 'windows-amd64' }}
@@ -417,6 +424,19 @@ jobs:
417424
fi
418425
echo "Found ${#files[@]} files:" && ls -al dist
419426
427+
- name: Verify PyPI file size limit
428+
shell: bash
429+
run: |
430+
set -euo pipefail
431+
max_bytes=$((100 * 1024 * 1024))
432+
for file in dist/*.whl dist/*.tar.gz; do
433+
size=$(wc -c < "$file")
434+
if [ "$size" -gt "$max_bytes" ]; then
435+
echo "$file is $size bytes, exceeding PyPI's 100 MB file limit" >&2
436+
exit 1
437+
fi
438+
done
439+
420440
- name: Publish to PyPI
421441
uses: pypa/gh-action-pypi-publish@release/v1
422442
with:

tests/test_release_workflows.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,25 @@ def test_binary_fetch_workflows_default_to_pinned_codex_release() -> None:
1414

1515
assert f"vars.CODEX_BINARY_RELEASE_TAG || '{PINNED_CODEX_BINARY_RELEASE_TAG}'" in workflow
1616
assert "vars.CODEX_BINARY_RELEASE_TAG || 'latest'" not in workflow
17+
18+
19+
def test_release_workflow_builds_split_macos_wheels() -> None:
20+
workflow = Path(".github/workflows/release-published.yml").read_text()
21+
22+
assert "macos-aarch64" in workflow
23+
assert "macos-x86_64" in workflow
24+
assert "codex-targets: aarch64-apple-darwin" in workflow
25+
assert "codex-targets: x86_64-apple-darwin" in workflow
26+
assert "macos-universal2" not in workflow
27+
assert "universal2-apple-darwin" not in workflow
28+
29+
30+
def test_release_workflow_rejects_pypi_oversized_files_before_publish() -> None:
31+
workflow = Path(".github/workflows/release-published.yml").read_text()
32+
33+
assert "Verify PyPI file size limit" in workflow
34+
assert "100 * 1024 * 1024" in workflow
35+
assert "pypa/gh-action-pypi-publish" in workflow
36+
assert workflow.index("Verify PyPI file size limit") < workflow.index(
37+
"pypa/gh-action-pypi-publish"
38+
)

0 commit comments

Comments
 (0)