@@ -2,159 +2,230 @@ name: CI
22
33on : [push, pull_request]
44
5+ # Automatically cancel previous runs of this workflow on the same branch
6+ concurrency :
7+ group : ${{ github.workflow }}-${{ github.ref }}
8+ cancel-in-progress : true
9+
510jobs :
6- windows :
11+ linux :
712 # Skip building pull requests from the same repository
813 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'
14+ runs-on : ubuntu-latest
15+ strategy :
16+ matrix :
17+ target : [x86_64, aarch64]
18+ fail-fast : false
1319 steps :
14- - name : Checkout
15- uses : actions/checkout@v4
20+ - uses : actions/checkout@v5
1621 with :
1722 submodules : ' true'
18-
19- - name : Python environment
20- uses : actions/setup-python@v5
23+
24+ - name : Update pyproject.toml version
25+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
26+ shell : bash
27+ run : |
28+ # Extract version from tag (strip 'v' prefix if present)
29+ VERSION=${GITHUB_REF#refs/tags/}
30+ VERSION=${VERSION#v}
31+ echo "Extracted version: $VERSION"
32+
33+ # Update version in pyproject.toml (works on both GNU and BSD sed)
34+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
35+ rm pyproject.toml.bak
36+
37+ - name : Install uv
38+ uses : astral-sh/setup-uv@v6
2139 with :
22- python-version : ' 3.12'
40+ version : " 0.9.3"
41+
42+ - name : Set up Python
43+ run : uv python install --default
44+
45+ - name : Run Rust tests
46+ run : |
47+ echo "Python: $(which python)"
48+ python --version
49+ ldd $(which python)
50+ PYO3_PRINT_CONFIG=1 cargo run --release
2351
24- - name : Install Rust toolchain
25- uses : dtolnay/rust-toolchain@stable
52+ - name : Build wheels
53+ uses : PyO3/maturin-action@v1
2654 with :
27- targets : x86_64-pc-windows-msvc
55+ target : ${{ matrix.target }}
56+ args : --release --out dist --find-interpreter
57+ sccache : ' true'
58+ manylinux : auto
2859
29- - name : Build
60+ - name : Run Python tests
61+ run : uv run pytest
62+
63+ - name : Upload wheels
64+ uses : actions/upload-artifact@v4
65+ with :
66+ name : wheels-linux-${{ matrix.target }}
67+ path : dist
68+
69+ windows :
70+ # Skip building pull requests from the same repository
71+ if : ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
72+ runs-on : windows-latest
73+ steps :
74+ - uses : actions/checkout@v5
75+ with :
76+ submodules : ' true'
77+
78+ - name : Update pyproject.toml version
79+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
3080 shell : bash
3181 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"
82+ # Extract version from tag (strip 'v' prefix if present)
83+ VERSION=${GITHUB_REF#refs/tags/}
84+ VERSION=${VERSION#v}
85+ echo "Extracted version: $VERSION"
86+
87+ # Update version in pyproject.toml (works on both GNU and BSD sed)
88+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
89+ rm pyproject.toml.bak
90+
91+ - name : Install uv
92+ uses : astral-sh/setup-uv@v7
93+ with :
94+ version : " 0.9.3"
95+
96+ - name : Set up Python
97+ run : uv python install --default
98+
99+ - name : Run Rust tests
100+ run : cargo run --release
101+
102+ - name : Build wheels
103+ uses : PyO3/maturin-action@v1
104+ with :
105+ target : x64
106+ args : --release --out dist --find-interpreter
107+
108+ - name : Run Python tests
109+ run : uv run pytest
37110
38- - name : Test
39- run : |
40- pip install -r tests/requirements.txt
41- python tests/example.py
42- python tests/invalid.py
43-
44111 - name : Upload wheels
45112 uses : actions/upload-artifact@v4
46113 with :
47- name : wheels-windows
114+ name : wheels-windows-x64
48115 path : dist
49116
50117 macos :
51118 # Skip building pull requests from the same repository
52119 if : ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
53120 runs-on : macos-latest
54- env :
55- # Disable output buffering in an attempt to get readable errors
56- PYTHONUNBUFFERED : ' 1'
121+ strategy :
122+ matrix :
123+ target : [x86_64, aarch64]
124+ fail-fast : false
57125 steps :
58- - name : Checkout
59- uses : actions/checkout@v4
126+ - uses : actions/checkout@v5
60127 with :
61128 submodules : ' true'
62-
63- - name : Python environment
64- uses : actions/setup-python@v5
65- with :
66- python-version : ' 3.12'
67129
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
130+ - name : Update pyproject.toml version
131+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
74132 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
87133 run : |
88- pip install -r tests/requirements.txt
89- python tests/example.py
90- python tests/invalid.py
91-
134+ # Extract version from tag (strip 'v' prefix if present)
135+ VERSION=${GITHUB_REF#refs/tags/}
136+ VERSION=${VERSION#v}
137+ echo "Extracted version: $VERSION"
138+
139+ # Update version in pyproject.toml (works on both GNU and BSD sed)
140+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
141+ rm pyproject.toml.bak
142+
143+ - name : Install uv
144+ uses : astral-sh/setup-uv@v7
145+ with :
146+ version : " 0.9.3"
147+
148+ - name : Set up Python
149+ run : uv python install --default
150+
151+ - name : Run Rust tests
152+ if : matrix.target == 'aarch64'
153+ run : cargo run --release
154+
155+ - name : Build wheels
156+ uses : PyO3/maturin-action@v1
157+ with :
158+ target : ${{ matrix.target }}
159+ args : --release --out dist --find-interpreter
160+
161+ - name : Run Python tests
162+ if : matrix.target == 'aarch64'
163+ run : uv run pytest
164+
92165 - name : Upload wheels
93166 uses : actions/upload-artifact@v4
94167 with :
95- name : wheels-macos
168+ name : wheels-macos-${{ matrix.target }}
96169 path : dist
97170
98- linux :
171+ sdist :
99172 # Skip building pull requests from the same repository
100173 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'
174+ runs-on : ubuntu-latest
106175 steps :
107- - name : Checkout
108- uses : actions/checkout@v4
176+ - uses : actions/checkout@v5
109177 with :
110178 submodules : ' true'
111-
112- - name : Build
179+
180+ - name : Update pyproject.toml version
181+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
113182 shell : bash
114183 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
184+ # Extract version from tag (strip 'v' prefix if present)
185+ VERSION=${GITHUB_REF#refs/tags/}
186+ VERSION=${VERSION#v}
187+ echo "Extracted version: $VERSION"
188+
189+ # Update version in pyproject.toml (works on both GNU and BSD sed)
190+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
191+ rm pyproject.toml.bak
192+
193+ - name : Build sdist
194+ uses : PyO3/maturin-action@v1
195+ with :
196+ command : sdist
197+ args : --out dist
198+
199+ - name : Upload sdist
132200 uses : actions/upload-artifact@v4
133201 with :
134- name : wheels-linux
202+ name : wheels-sdist
135203 path : dist
136204
137205 release :
138206 if : ${{ startsWith(github.ref, 'refs/tags/') }}
139- runs-on : ubuntu-24.04
140- needs : [windows, macos, linux ]
207+ runs-on : ubuntu-latest
208+ needs : [linux, windows, macos, sdist ]
141209 permissions :
142210 contents : write
143211 discussions : write
144212 id-token : write
145213 steps :
146214 - name : Download wheels
147- uses : actions/download-artifact@v4
215+ uses : actions/download-artifact@v5
148216 with :
149217 pattern : wheels-*
150218 merge-multiple : true
151219 path : dist
152220
153221 - name : Publish to PyPI
154- uses : pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.13
222+ uses : PyO3/maturin-action@v1
223+ with :
224+ command : upload
225+ args : --non-interactive --skip-existing dist/*
155226
156227 - name : Release
157- uses : softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
228+ uses : softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1
158229 with :
159230 generate_release_notes : true
160231 files : dist/*
0 commit comments