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