@@ -3,158 +3,224 @@ name: CI
33on : [push, pull_request]
44
55jobs :
6- windows :
6+ linux :
77 # Skip building pull requests from the same repository
88 if : ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
9- runs-on : windows-latest
10- env :
11- # Disable output buffering in an attempt to get readable errors
12- PYTHONUNBUFFERED : ' 1'
9+ runs-on : ubuntu-latest
10+ strategy :
11+ matrix :
12+ target : [x86_64, aarch64]
13+ fail-fast : false
1314 steps :
14- - name : Checkout
15- uses : actions/checkout@v4
15+ - uses : actions/checkout@v5
1616 with :
1717 submodules : ' true'
18-
19- - name : Python environment
20- uses : actions/setup-python@v5
18+
19+ - name : Update pyproject.toml version
20+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
21+ shell : bash
22+ run : |
23+ # Extract version from tag (strip 'v' prefix if present)
24+ VERSION=${GITHUB_REF#refs/tags/}
25+ VERSION=${VERSION#v}
26+ echo "Extracted version: $VERSION"
27+
28+ # Update version in pyproject.toml (works on both GNU and BSD sed)
29+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
30+ rm pyproject.toml.bak
31+
32+ - name : Install uv
33+ uses : astral-sh/setup-uv@v6
34+ with :
35+ version : " 0.9.3"
36+
37+ - name : Set up Python
38+ run : uv python install --default
39+
40+ - name : Run Rust tests
41+ run : |
42+ echo "Python: $(which python)"
43+ python --version
44+ ldd $(which python)
45+ cargo run --release
46+
47+ - name : Build wheels
48+ uses : PyO3/maturin-action@v1
49+ with :
50+ target : ${{ matrix.target }}
51+ args : --release --out dist --find-interpreter
52+ sccache : ' true'
53+ manylinux : auto
54+
55+ - name : Run Python tests
56+ run : uv run pytest
57+
58+ - name : Upload wheels
59+ uses : actions/upload-artifact@v4
2160 with :
22- python-version : ' 3.12'
61+ name : wheels-linux-${{ matrix.target }}
62+ path : dist
2363
24- - name : Install Rust toolchain
25- uses : dtolnay/rust-toolchain@stable
64+ windows :
65+ # Skip building pull requests from the same repository
66+ if : ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
67+ runs-on : windows-latest
68+ steps :
69+ - uses : actions/checkout@v5
2670 with :
27- targets : x86_64-pc-windows-msvc
71+ submodules : ' true '
2872
29- - name : Build
73+ - name : Update pyproject.toml version
74+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
3075 shell : bash
3176 run : |
32- pip install -r requirements.txt
33- python setup.py sdist
34- python setup.py bdist_wheel --py-limited-api=cp37
35- pip install --force-reinstall dist/*.whl
36- python -c "import icicle"
77+ # Extract version from tag (strip 'v' prefix if present)
78+ VERSION=${GITHUB_REF#refs/tags/}
79+ VERSION=${VERSION#v}
80+ echo "Extracted version: $VERSION"
81+
82+ # Update version in pyproject.toml (works on both GNU and BSD sed)
83+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
84+ rm pyproject.toml.bak
85+
86+ - name : Install uv
87+ uses : astral-sh/setup-uv@v7
88+ with :
89+ version : " 0.9.3"
90+
91+ - name : Set up Python
92+ run : uv python install --default
93+
94+ - name : Run Rust tests
95+ run : cargo run --release
96+
97+ - name : Build wheels
98+ uses : PyO3/maturin-action@v1
99+ with :
100+ target : x64
101+ args : --release --out dist --find-interpreter
102+
103+ - name : Run Python tests
104+ run : uv run pytest
37105
38- - name : Test
39- run : |
40- pip install -r tests/requirements.txt
41- python tests/example.py
42- python tests/invalid.py
43-
44106 - name : Upload wheels
45107 uses : actions/upload-artifact@v4
46108 with :
47- name : wheels-windows
109+ name : wheels-windows-x64
48110 path : dist
49111
50112 macos :
51113 # Skip building pull requests from the same repository
52114 if : ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
53115 runs-on : macos-latest
54- env :
55- # Disable output buffering in an attempt to get readable errors
56- PYTHONUNBUFFERED : ' 1'
116+ strategy :
117+ matrix :
118+ target : [x86_64, aarch64]
119+ fail-fast : false
57120 steps :
58- - name : Checkout
59- uses : actions/checkout@v4
121+ - uses : actions/checkout@v5
60122 with :
61123 submodules : ' true'
62-
63- - name : Python environment
64- uses : actions/setup-python@v5
65- with :
66- python-version : ' 3.12'
67124
68- - name : Install Rust toolchain
69- uses : dtolnay/rust-toolchain@stable
70- with :
71- targets : aarch64-apple-darwin, x86_64-apple-darwin
72-
73- - name : Build
125+ - name : Update pyproject.toml version
126+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
74127 shell : bash
75- env :
76- DEVELOPER_DIR : /Applications/Xcode.app/Contents/Developer
77- MACOSX_DEPLOYMENT_TARGET : ' 10.9'
78- ARCHFLAGS : -arch x86_64 -arch arm64
79- PYO3_CROSS_LIB_DIR : /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib
80- run : |
81- pip install -r requirements.txt
82- python setup.py bdist_wheel --py-limited-api=cp37
83- pip install --force-reinstall dist/*_universal2.whl
84- python -c "import icicle"
85-
86- - name : Test
87128 run : |
88- pip install -r tests/requirements.txt
89- python tests/example.py
90- python tests/invalid.py
91-
129+ # Extract version from tag (strip 'v' prefix if present)
130+ VERSION=${GITHUB_REF#refs/tags/}
131+ VERSION=${VERSION#v}
132+ echo "Extracted version: $VERSION"
133+
134+ # Update version in pyproject.toml (works on both GNU and BSD sed)
135+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
136+ rm pyproject.toml.bak
137+
138+ - name : Install uv
139+ uses : astral-sh/setup-uv@v7
140+ with :
141+ version : " 0.9.3"
142+
143+ - name : Set up Python
144+ run : uv python install --default
145+
146+ - name : Run Rust tests
147+ if : matrix.target == 'aarch64'
148+ run : cargo run --release
149+
150+ - name : Build wheels
151+ uses : PyO3/maturin-action@v1
152+ with :
153+ target : ${{ matrix.target }}
154+ args : --release --out dist --find-interpreter
155+
156+ - name : Run Python tests
157+ if : matrix.target == 'aarch64'
158+ run : uv run pytest
159+
92160 - name : Upload wheels
93161 uses : actions/upload-artifact@v4
94162 with :
95- name : wheels-macos
163+ name : wheels-macos-${{ matrix.target }}
96164 path : dist
97165
98- linux :
166+ sdist :
99167 # Skip building pull requests from the same repository
100168 if : ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
101- runs-on : ubuntu-24.04
102- container : quay.io/pypa/manylinux_2_28_x86_64
103- env :
104- # Disable output buffering in an attempt to get readable errors
105- PYTHONUNBUFFERED : ' 1'
169+ runs-on : ubuntu-latest
106170 steps :
107- - name : Checkout
108- uses : actions/checkout@v4
171+ - uses : actions/checkout@v5
109172 with :
110173 submodules : ' true'
111-
112- - name : Build
174+
175+ - name : Update pyproject.toml version
176+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
113177 shell : bash
114178 run : |
115- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y && yum install -y openssl-devel
116- export PATH="$PATH:$HOME/.cargo/bin"
117- export PATH="/opt/python/cp38-cp38/bin:$PATH"
118- pip install -r requirements.txt
119- python setup.py bdist_wheel --py-limited-api=cp37 --plat-name manylinux_2_28_x86_64
120- auditwheel show dist/*.whl
121- pip install --force-reinstall dist/*.whl
122- python -c "import icicle"
123-
124- - name : Test
125- run : |
126- export PATH="/opt/python/cp38-cp38/bin:$PATH"
127- pip install -r tests/requirements.txt
128- python tests/example.py
129- python tests/invalid.py
130-
131- - name : Upload wheels
179+ # Extract version from tag (strip 'v' prefix if present)
180+ VERSION=${GITHUB_REF#refs/tags/}
181+ VERSION=${VERSION#v}
182+ echo "Extracted version: $VERSION"
183+
184+ # Update version in pyproject.toml (works on both GNU and BSD sed)
185+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
186+ rm pyproject.toml.bak
187+
188+ - name : Build sdist
189+ uses : PyO3/maturin-action@v1
190+ with :
191+ command : sdist
192+ args : --out dist
193+
194+ - name : Upload sdist
132195 uses : actions/upload-artifact@v4
133196 with :
134- name : wheels-linux
197+ name : wheels-sdist
135198 path : dist
136199
137200 release :
138201 if : ${{ startsWith(github.ref, 'refs/tags/') }}
139- runs-on : ubuntu-24.04
140- needs : [windows, macos, linux ]
202+ runs-on : ubuntu-latest
203+ needs : [linux, windows, macos, sdist ]
141204 permissions :
142205 contents : write
143206 discussions : write
144207 id-token : write
145208 steps :
146209 - name : Download wheels
147- uses : actions/download-artifact@v4
210+ uses : actions/download-artifact@v5
148211 with :
149212 pattern : wheels-*
150213 merge-multiple : true
151214 path : dist
152215
153216 - name : Publish to PyPI
154- uses : pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.13
217+ uses : PyO3/maturin-action@v1
218+ with :
219+ command : upload
220+ args : --non-interactive --skip-existing dist/*
155221
156222 - name : Release
157- uses : softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
223+ uses : softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1
158224 with :
159225 generate_release_notes : true
160226 files : dist/*
0 commit comments