@@ -10,24 +10,118 @@ permissions:
1010 id-token : write
1111
1212jobs :
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)
44+ if : matrix.os == 'ubuntu-latest'
45+ run : |
46+ maturin build --release --compatibility manylinux2014 -m crates/codex_native/Cargo.toml -i python -o dist
47+
48+ - name : Build wheels on macOS/Windows
49+ if : matrix.os != 'ubuntu-latest'
50+ run : |
51+ maturin build --release -m crates/codex_native/Cargo.toml -i python -o dist
52+
53+ - name : Upload wheels
54+ uses : actions/upload-artifact@v4
55+ with :
56+ name : wheels-${{ matrix.os }}-${{ matrix.python-version }}
57+ path : dist/*.whl
58+
59+ build-sdist :
60+ name : Build sdist
1461 runs-on : ubuntu-latest
1562 steps :
16- - name : Check out repository
63+ - name : Checkout repository
1764 uses : actions/checkout@v4
1865
66+ - name : Set up Rust
67+ uses : dtolnay/rust-toolchain@stable
68+
1969 - name : Set up Python
2070 uses : actions/setup-python@v5
2171 with :
2272 python-version : ' 3.13'
2373
24- - name : Install uv
25- uses : astral-sh/setup-uv@v4
74+ - name : Install build tool
75+ run : |
76+ python -m pip install --upgrade pip
77+ pip install build maturin
78+
79+ - name : Build sdist (PEP 517)
80+ run : |
81+ python -m build --sdist
82+
83+ - name : Upload sdist
84+ uses : actions/upload-artifact@v4
2685 with :
27- version : latest
86+ name : sdist
87+ path : dist/*.tar.gz
2888
29- - name : Build distribution
30- run : uv build
89+ publish :
90+ name : Publish to PyPI (Trusted Publishing)
91+ needs : [build-wheels, build-sdist]
92+ runs-on : ubuntu-latest
93+ steps :
94+ - name : Download all artifacts
95+ uses : actions/download-artifact@v4
96+ with :
97+ path : dist
98+ # Merge all artifacts directly into dist/ so Twine finds files
99+ merge-multiple : true
100+
101+ - name : Flatten artifacts into dist/
102+ shell : bash
103+ run : |
104+ shopt -s globstar nullglob
105+ mkdir -p dist_flat
106+ for f in dist/**/*.whl dist/**/*.tar.gz; do
107+ mv "$f" dist_flat/
108+ done
109+ rm -rf dist
110+ mv dist_flat dist
31111
32- - name : Publish to PyPI (Trusted Publishing)
33- run : uv publish --trusted-publishing=always
112+ - name : Verify artifacts present
113+ shell : bash
114+ run : |
115+ shopt -s nullglob
116+ files=(dist/*.whl dist/*.tar.gz)
117+ if [ ${#files[@]} -eq 0 ]; then
118+ echo "No distribution files found in dist/" >&2
119+ exit 1
120+ fi
121+ echo "Found ${#files[@]} files:" && ls -al dist
122+
123+ - name : Publish to PyPI
124+ uses : pypa/gh-action-pypi-publish@release/v1
125+ with :
126+ packages-dir : dist
127+ skip-existing : true
0 commit comments