Skip to content

Update actions/{upload,download}-artifact to v4 (#13) #77

Update actions/{upload,download}-artifact to v4 (#13)

Update actions/{upload,download}-artifact to v4 (#13) #77

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- 'v*.*.*'
jobs:
test:
strategy:
matrix:
runs-on: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: dtolnay/rust-toolchain@stable
- name: Build package
uses: PyO3/maturin-action@v1
with:
manylinux: auto
args: -i ${{ matrix.python-version }} --release
- name: Test package
run: |
python -m pip install --upgrade pip
pip install pytest mypy zstandard
python -c "import zstandard;zstandard.ZstdDecompressor().copy_stream(open('tests/data/vaporetto.model.zst','rb'),open('tests/data/vaporetto.model','wb'))"
pip install vaporetto --no-index --find-links target/wheels --force-reinstall
mypy --strict tests
pytest tests/test_vaporetto.py
python -m doctest README.md
python -m doctest docs/source/examples.rst
pack-sdist:
needs: [ test ]
if: "startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- uses: dtolnay/rust-toolchain@stable
- name: Build package
uses: PyO3/maturin-action@v1
with:
command: sdist
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.runs-on }}
path: target/wheels
pack-linux:
needs: [ test ]
if: "startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
target: [ x86_64, i686 ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: dtolnay/rust-toolchain@stable
- name: Build package
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: -i ${{ matrix.python-version }} --release
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.runs-on }}
path: target/wheels
pack-windows:
needs: [ test ]
if: "startsWith(github.ref, 'refs/tags/')"
runs-on: windows-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
target: [ x64, x86 ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.target }}
- uses: dtolnay/rust-toolchain@stable
- name: Build package
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: -i ${{ matrix.python-version }} --release
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.runs-on }}
path: target/wheels
pack-macos:
needs: [ test ]
if: "startsWith(github.ref, 'refs/tags/')"
runs-on: macos-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: dtolnay/rust-toolchain@stable
- name: Build package
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: -i ${{ matrix.python-version }} --release --universal2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.runs-on }}
path: target/wheels
release:
name: Release
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ pack-sdist, pack-linux, pack-windows, pack-macos ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
- name: Publish to PyPI
uses: messense/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing *