Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh workflow: test the built wheels with different versions of python #927

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 62 additions & 4 deletions .github/workflows/python-build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,64 @@ jobs:
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform.runner }}-${{ matrix.platform.target }}
name: wheel-${{ matrix.platform.runner }}-${{ matrix.platform.target }}
path: dist

# Download, install, and test the wheels with different versions of python
test-wheels:
needs: [build-wheels]
runs-on: ${{ matrix.platform.runner }}
strategy:
# We want to know in which exact situation the tests fail
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
platform:
- runner: ubuntu-latest
target: x86_64
- runner: windows-latest
target: x64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: wheel-${{ matrix.platform.runner }}-${{ matrix.platform.target }}
path: dist
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # pin@v5
with:
python-version: '${{ matrix.python-version }}'
- name: Install uv
run: curl -LsSf https://astral.sh/uv/0.5.22/install.sh | sh
- if: matrix.platform.runner != 'windows-latest'
name: Check that `uv add magika.whl` works
run: |
mkdir /tmp/test-uv
cp -vR dist/*.whl /tmp/test-uv
cd /tmp/test-uv
uv init
uv add ./$(\ls -1 *.whl | head -n 1)
- if: matrix.platform.runner == 'windows-latest'
name: Check that `uv add magika.whl` works
shell: pwsh
run: |
mkdir C:\test-uv
Copy-Item -Path dist\*.whl -Destination C:\test-uv
cd C:\test-uv
$env:PATH += ";$HOME/.local/bin"
uv init
$wheel = Get-ChildItem -Filter *.whl | Select-Object -ExpandProperty Name
uv add ".\$wheel"
- name: Install the wheel
run: python3 -m pip install $(python -c "import glob; print(glob.glob('dist/*.whl')[0])")
- run: magika --version
- run: "python3 -c 'import magika; m = magika.Magika(); print(m)'"
- run: magika -r tests_data/basic
- run: python3 ./python/scripts/run_quick_test_magika_cli.py
- run: python3 ./python/scripts/run_quick_test_magika_module.py

build-pure-python-wheel:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -117,15 +172,18 @@ jobs:
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheels-pure-python
name: wheel-pure-python
path: dist

# Download, install, and test the pure python wheel on multiple platforms
test-pure-python-wheel:
needs: [build-pure-python-wheel]
runs-on: ${{ matrix.platform.runner }}
strategy:
# We want to know in which exact situation the tests fail
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
platform:
- runner: ubuntu-latest
target: x86_64
Expand All @@ -137,12 +195,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: wheels-pure-python
name: wheel-pure-python
path: dist
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # pin@v5
with:
python-version: '3.12'
python-version: '${{ matrix.python-version }}'
- name: Install uv
run: curl -LsSf https://astral.sh/uv/0.5.22/install.sh | sh
- if: matrix.platform.runner != 'windows-latest'
Expand Down
Loading