@@ -131,11 +131,17 @@ jobs:
131
131
- name : Build pure python wheel and source distribution
132
132
run : uv build --out-dir ../dist
133
133
working-directory : python
134
- - name : Upload wheel and sdist
134
+ - name : Upload pure python wheel
135
135
uses : actions/upload-artifact@v4
136
136
with :
137
- name : wheel-pure-python-and-sdist
138
- path : dist
137
+ name : wheel-pure-python
138
+ path : dist/*.whl
139
+ - name : Upload sdist
140
+ uses : actions/upload-artifact@v4
141
+ with :
142
+ name : sdist
143
+ path : dist/*.tar.gz
144
+
139
145
140
146
# Download, install, and test the pure python wheel on multiple platforms
141
147
test-pure-python-wheel :
@@ -157,7 +163,7 @@ jobs:
157
163
- uses : actions/checkout@v4
158
164
- uses : actions/download-artifact@v4
159
165
with :
160
- name : wheel-pure-python-and-sdist
166
+ name : wheel-pure-python
161
167
path : dist
162
168
- name : Setup Python
163
169
uses : actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # pin@v5
@@ -196,3 +202,62 @@ jobs:
196
202
# Test the python module
197
203
- run : " python3 -c 'import magika; m = magika.Magika(); print(m)'"
198
204
- run : python3 ./python/scripts/run_quick_test_magika_module.py
205
+
206
+ test-sdist :
207
+ needs : [build-pure-python-wheel-and-sdist]
208
+ runs-on : ${{ matrix.platform.runner }}
209
+ strategy :
210
+ # We want to know in which exact situation the tests fail
211
+ fail-fast : false
212
+ matrix :
213
+ python-version : [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
214
+ platform :
215
+ - runner : ubuntu-latest
216
+ target : x86_64
217
+ - runner : windows-latest
218
+ target : x64
219
+ - runner : macos-14
220
+ target : aarch64
221
+ steps :
222
+ - uses : actions/checkout@v4
223
+ - uses : actions/download-artifact@v4
224
+ with :
225
+ name : sdist
226
+ path : dist
227
+ - name : Setup Python
228
+ uses : actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # pin@v5
229
+ with :
230
+ python-version : ' ${{ matrix.python-version }}'
231
+ - name : Install uv
232
+ run : curl -LsSf https://astral.sh/uv/0.5.22/install.sh | sh
233
+ - if : matrix.platform.runner != 'windows-latest'
234
+ name : Check that `uv add magika.tar.gz` works
235
+ run : |
236
+ mkdir /tmp/test-uv
237
+ cp -vR dist/*.tar.gz /tmp/test-uv
238
+ cd /tmp/test-uv
239
+ uv init
240
+ uv add ./$(\ls -1 *.tar.gz | head -n 1)
241
+ - if : matrix.platform.runner == 'windows-latest'
242
+ name : Check that `uv add magika.tar.gz` works
243
+ shell : pwsh
244
+ run : |
245
+ mkdir C:\test-uv
246
+ Copy-Item -Path dist\*.tar.gz -Destination C:\test-uv
247
+ cd C:\test-uv
248
+ $env:PATH += ";$HOME\.local\bin"
249
+ uv init
250
+ $sdist = Get-ChildItem -Filter *.tar.gz | Select-Object -ExpandProperty Name
251
+ uv add ".\$sdist"
252
+ - name : Install the sdist
253
+ run : python3 -m pip install $(python -c "import glob; print(glob.glob('dist/*.tar.gz')[0])")
254
+
255
+ # Check that the magika script points to the placeholder raising a warning
256
+ - run : magika --version | grep -C10 WARNING | grep -C10 magika-python-client
257
+ # Check that the fallback magika's python client can be run
258
+ - run : magika-python-client -r tests_data/basic
259
+ # Check that the results of the python's client are correct
260
+ - run : python3 ./python/scripts/run_quick_test_magika_cli.py --client-path magika-python-client
261
+ # Test the python module
262
+ - run : " python3 -c 'import magika; m = magika.Magika(); print(m)'"
263
+ - run : python3 ./python/scripts/run_quick_test_magika_module.py
0 commit comments