Skip to content

Commit 8636ed6

Browse files
committed
ci: build Linux wheels with manylinux2014 via maturin; verify dist contents; remove python-source
1 parent 513517b commit 8636ed6

11 files changed

Lines changed: 278 additions & 304 deletions

File tree

.github/workflows/native-wheels.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 108 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,123 @@ permissions:
1010
id-token: write
1111

1212
jobs:
13-
build-and-publish:
13+
build-wheels:
14+
name: Build native wheels
15+
continue-on-error: ${{ matrix.allow-failure == true }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, macos-14, windows-latest]
20+
python-version: ['3.12', '3.13']
21+
include:
22+
- os: ubuntu-latest
23+
python-version: '3.14'
24+
allow-failure: true
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Rust
31+
uses: dtolnay/rust-toolchain@stable
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
38+
- name: Install build backend
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install build maturin
42+
43+
- name: Build wheels on Linux (manylinux2014 + zig)
44+
if: matrix.os == 'ubuntu-latest'
45+
run: |
46+
maturin build --release \
47+
--zig \
48+
--compatibility manylinux2014 \
49+
-m crates/codex_native/Cargo.toml \
50+
-i python \
51+
-o dist
52+
53+
- name: Build wheels on macOS/Windows
54+
if: matrix.os != 'ubuntu-latest'
55+
run: |
56+
maturin build --release -m crates/codex_native/Cargo.toml -i python -o dist
57+
58+
- name: Upload wheels
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
62+
path: dist/*.whl
63+
64+
build-sdist:
65+
name: Build sdist
1466
runs-on: ubuntu-latest
1567
steps:
16-
- name: Check out repository
68+
- name: Checkout repository
1769
uses: actions/checkout@v4
1870

71+
- name: Set up Rust
72+
uses: dtolnay/rust-toolchain@stable
73+
1974
- name: Set up Python
2075
uses: actions/setup-python@v5
2176
with:
2277
python-version: '3.13'
2378

24-
- name: Install uv
25-
uses: astral-sh/setup-uv@v4
79+
- name: Install build tool
80+
run: |
81+
python -m pip install --upgrade pip
82+
pip install build maturin
83+
84+
- name: Build sdist (PEP 517)
85+
run: |
86+
python -m build --sdist
87+
88+
- name: Upload sdist
89+
uses: actions/upload-artifact@v4
2690
with:
27-
version: latest
91+
name: sdist
92+
path: dist/*.tar.gz
2893

29-
- name: Build distribution
30-
run: uv build
94+
publish:
95+
name: Publish to PyPI (Trusted Publishing)
96+
needs: [build-wheels, build-sdist]
97+
runs-on: ubuntu-latest
98+
steps:
99+
- name: Download all artifacts
100+
uses: actions/download-artifact@v4
101+
with:
102+
path: dist
103+
# Merge all artifacts directly into dist/ so Twine finds files
104+
merge-multiple: true
105+
106+
- name: Flatten artifacts into dist/
107+
shell: bash
108+
run: |
109+
shopt -s globstar nullglob
110+
mkdir -p dist_flat
111+
for f in dist/**/*.whl dist/**/*.tar.gz; do
112+
mv "$f" dist_flat/
113+
done
114+
rm -rf dist
115+
mv dist_flat dist
31116
32-
- name: Publish to PyPI (Trusted Publishing)
33-
run: uv publish --trusted-publishing=always
117+
- name: Verify artifacts present
118+
shell: bash
119+
run: |
120+
shopt -s nullglob
121+
files=(dist/*.whl dist/*.tar.gz)
122+
if [ ${#files[@]} -eq 0 ]; then
123+
echo "No distribution files found in dist/" >&2
124+
exit 1
125+
fi
126+
echo "Found ${#files[@]} files:" && ls -al dist
127+
128+
- name: Publish to PyPI
129+
uses: pypa/gh-action-pypi-publish@release/v1
130+
with:
131+
packages-dir: dist
132+
skip-existing: true

.gitignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,4 @@ crates/**/Cargo.lock
6363
# Local environment files
6464
.env
6565
.env.*
66-
/.idea/inspectionProfiles/profiles_settings.xml
67-
/.idea/inspectionProfiles/Project_Default.xml
68-
/.idea/.gitignore
69-
/.idea/codex-python.iml
70-
/.idea/misc.xml
71-
/.idea/modules.xml
72-
/.idea/ruff.xml
73-
/.idea/vcs.xml
66+
/.idea/

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,21 @@ The format is based on Keep a Changelog and this project adheres to Semantic Ver
4141
[0.1.0]: https://github.com/gersmann/codex-python/releases/tag/v0.1.0
4242
[0.1.1]: https://github.com/gersmann/codex-python/releases/tag/v0.1.1
4343
[0.2.0]: https://github.com/gersmann/codex-python/releases/tag/v0.2.0
44+
## [0.2.1] - 2025-09-10
45+
### Changed
46+
- Consolidate PyPI Trusted Publishing into a single publish.yml workflow: builds native wheels (Linux/macOS/Windows) and sdist, then publishes via OIDC.
47+
- Remove separate native-wheels.yml to avoid split workflows.
48+
49+
[0.2.1]: https://github.com/gersmann/codex-python/releases/tag/v0.2.1
50+
51+
## [0.2.2] - 2025-09-10
52+
### Fixed
53+
- sdist build: add `crates/codex_native/pyproject.toml` (maturin PEP 517) so `maturin sdist -m crates/codex_native/Cargo.toml` succeeds under publish.yml.
54+
- Ensure distribution naming is consistent for sdist and wheels (`codex-python`).
55+
56+
[0.2.2]: https://github.com/gersmann/codex-python/releases/tag/v0.2.2
57+
\n+## [0.2.3] - 2025-09-11
58+
### Fixed
59+
- Publish workflow: flatten downloaded artifacts with `merge-multiple: true` so `twine` sees files directly in `dist/` (resolves "Unknown distribution format: 'sdist'" / "no packages in dist/").
60+
61+
[0.2.3]: https://github.com/gersmann/codex-python/releases/tag/v0.2.3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Releasing
9292
- Bump `codex/__init__.py` and `crates/codex_native/Cargo.toml` versions.
9393
- Update `CHANGELOG.md`.
9494
- Tag and push: `git tag -a vX.Y.Z -m "codex-python X.Y.Z" && git push origin vX.Y.Z`.
95-
- GitHub Actions publishes both sdist/pure wheel and platform wheels via Trusted Publishing.
95+
- GitHub Actions (publish.yml) builds native wheels across platforms and an sdist, then publishes them via Trusted Publishing (OIDC).
9696

9797
Project layout
9898
```

codex/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
"CodexConfig",
3131
]
3232

33-
# Managed by Hatch via pyproject.toml [tool.hatch.version]
34-
__version__ = "0.2.0"
33+
# Package version. Kept in sync with Cargo.toml via CI before builds.
34+
__version__ = "0.2.7"

0 commit comments

Comments
 (0)