@@ -2,159 +2,232 @@ 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+ # NOTE: On Linux we need to manually export LD_LIBRARY_PATH
43+ - name : Set up Python
44+ run : |
45+ uv python install --default
46+ LIBDIR=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
47+ echo "LD_LIBRARY_PATH=${LIBDIR}:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
48+
49+ - name : Run Python tests
50+ run : uv run pytest
2351
24- - name : Install Rust toolchain
25- uses : dtolnay/rust-toolchain@stable
52+ - name : Run Rust tests
53+ run : cargo run
54+
55+ - name : Clean Rust build cache
56+ run : cargo clean
57+
58+ - name : Build wheels
59+ uses : PyO3/maturin-action@v1
2660 with :
27- targets : x86_64-pc-windows-msvc
61+ target : ${{ matrix.target }}
62+ args : --release --out dist --find-interpreter
63+ manylinux : auto
2864
29- - name : Build
65+ - name : Upload wheels
66+ uses : actions/upload-artifact@v4
67+ with :
68+ name : wheels-linux-${{ matrix.target }}
69+ path : dist
70+
71+ windows :
72+ # Skip building pull requests from the same repository
73+ if : ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
74+ runs-on : windows-latest
75+ steps :
76+ - uses : actions/checkout@v5
77+ with :
78+ submodules : ' true'
79+
80+ - name : Update pyproject.toml version
81+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
3082 shell : bash
3183 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"
84+ # Extract version from tag (strip 'v' prefix if present)
85+ VERSION=${GITHUB_REF#refs/tags/}
86+ VERSION=${VERSION#v}
87+ echo "Extracted version: $VERSION"
88+
89+ # Update version in pyproject.toml (works on both GNU and BSD sed)
90+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
91+ rm pyproject.toml.bak
92+
93+ - name : Install uv
94+ uses : astral-sh/setup-uv@v7
95+ with :
96+ version : " 0.9.3"
97+
98+ - name : Set up Python
99+ run : uv python install --default
100+
101+ - name : Run Rust tests
102+ run : cargo run
103+
104+ - name : Build wheels
105+ uses : PyO3/maturin-action@v1
106+ with :
107+ target : x64
108+ args : --release --out dist --find-interpreter
109+
110+ - name : Run Python tests
111+ run : uv run pytest
37112
38- - name : Test
39- run : |
40- pip install -r tests/requirements.txt
41- python tests/example.py
42- python tests/invalid.py
43-
44113 - name : Upload wheels
45114 uses : actions/upload-artifact@v4
46115 with :
47- name : wheels-windows
116+ name : wheels-windows-x64
48117 path : dist
49118
50119 macos :
51120 # Skip building pull requests from the same repository
52121 if : ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
53122 runs-on : macos-latest
54- env :
55- # Disable output buffering in an attempt to get readable errors
56- PYTHONUNBUFFERED : ' 1'
123+ strategy :
124+ matrix :
125+ target : [x86_64, aarch64]
126+ fail-fast : false
57127 steps :
58- - name : Checkout
59- uses : actions/checkout@v4
128+ - uses : actions/checkout@v5
60129 with :
61130 submodules : ' true'
62-
63- - name : Python environment
64- uses : actions/setup-python@v5
65- with :
66- python-version : ' 3.12'
67131
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
132+ - name : Update pyproject.toml version
133+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
74134 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
87135 run : |
88- pip install -r tests/requirements.txt
89- python tests/example.py
90- python tests/invalid.py
91-
136+ # Extract version from tag (strip 'v' prefix if present)
137+ VERSION=${GITHUB_REF#refs/tags/}
138+ VERSION=${VERSION#v}
139+ echo "Extracted version: $VERSION"
140+
141+ # Update version in pyproject.toml (works on both GNU and BSD sed)
142+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
143+ rm pyproject.toml.bak
144+
145+ - name : Install uv
146+ uses : astral-sh/setup-uv@v7
147+ with :
148+ version : " 0.9.3"
149+
150+ - name : Set up Python
151+ run : uv python install --default
152+
153+ - name : Run Rust tests
154+ if : matrix.target == 'aarch64'
155+ run : cargo run --release
156+
157+ - name : Build wheels
158+ uses : PyO3/maturin-action@v1
159+ with :
160+ target : ${{ matrix.target }}
161+ args : --release --out dist --find-interpreter
162+
163+ - name : Run Python tests
164+ if : matrix.target == 'aarch64'
165+ run : uv run pytest
166+
92167 - name : Upload wheels
93168 uses : actions/upload-artifact@v4
94169 with :
95- name : wheels-macos
170+ name : wheels-macos-${{ matrix.target }}
96171 path : dist
97172
98- linux :
173+ sdist :
99174 # Skip building pull requests from the same repository
100175 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'
176+ runs-on : ubuntu-latest
106177 steps :
107- - name : Checkout
108- uses : actions/checkout@v4
178+ - uses : actions/checkout@v5
109179 with :
110180 submodules : ' true'
111-
112- - name : Build
181+
182+ - name : Update pyproject.toml version
183+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
113184 shell : bash
114185 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
186+ # Extract version from tag (strip 'v' prefix if present)
187+ VERSION=${GITHUB_REF#refs/tags/}
188+ VERSION=${VERSION#v}
189+ echo "Extracted version: $VERSION"
190+
191+ # Update version in pyproject.toml (works on both GNU and BSD sed)
192+ sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
193+ rm pyproject.toml.bak
194+
195+ - name : Build sdist
196+ uses : PyO3/maturin-action@v1
197+ with :
198+ command : sdist
199+ args : --out dist
200+
201+ - name : Upload sdist
132202 uses : actions/upload-artifact@v4
133203 with :
134- name : wheels-linux
204+ name : wheels-sdist
135205 path : dist
136206
137207 release :
138208 if : ${{ startsWith(github.ref, 'refs/tags/') }}
139- runs-on : ubuntu-24.04
140- needs : [windows, macos, linux ]
209+ runs-on : ubuntu-latest
210+ needs : [linux, windows, macos, sdist ]
141211 permissions :
142212 contents : write
143213 discussions : write
144214 id-token : write
145215 steps :
146216 - name : Download wheels
147- uses : actions/download-artifact@v4
217+ uses : actions/download-artifact@v5
148218 with :
149219 pattern : wheels-*
150220 merge-multiple : true
151221 path : dist
152222
153223 - name : Publish to PyPI
154- uses : pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.13
224+ uses : PyO3/maturin-action@v1
225+ with :
226+ command : upload
227+ args : --non-interactive --skip-existing dist/*
155228
156229 - name : Release
157- uses : softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
230+ uses : softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1
158231 with :
159232 generate_release_notes : true
160233 files : dist/*
0 commit comments