Update actions/{upload,download}-artifact to v4 (#12) #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 -r requirements-dev.txt zstandard | |
python -c "import zstandard;zstandard.ZstdDecompressor().copy_stream(open('tests/data/system.dic.zst','rb'),open('tests/data/system.dic','wb'))" | |
pip install vibrato --no-index --find-links target/wheels --force-reinstall | |
mypy --strict tests | |
pytest | |
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 * |