Skip to content

Update Github actions #52

Update Github actions

Update Github actions #52

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
release:
types:
- published
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install pre-commit
- name: Lint
run: pre-commit run --all-files --show-diff-on-failure
test-rust:
name: Test Rust source
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
rust-toolchain:
- stable
- nightly
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rustup default ${{ matrix.rust-toolchain }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.rust-toolchain }}
- name: Run
run: cargo test -p md-ulb-pwrap
test-python:
name: Test Python bindings
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- 3.8
- 3.9
- "3.10"
- "3.11"
- 3.12.3
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/python/dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
cd python
pip install -r dev-requirements.txt
- name: Test
run: python python/test.py
linux-py-wheels:
name: Build Linux Python wheels
runs-on: ubuntu-latest
needs: [test-rust, test-python]
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
manylinux: auto
command: build
args: --release --sdist -o dist --find-interpreter
working-directory: python
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: python/dist
windows-py-wheels:
name: Build Windows Python wheels
needs: [test-rust, test-python]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release -o dist --find-interpreter
working-directory: python
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: python/dist
macos-py-wheels:
name: Build MacOS Python wheels
needs: [test-rust, test-python]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release -o dist --target universal2-apple-darwin --find-interpreter
working-directory: python
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: python/dist
test-release-rust-crate:
name: Test Rust crate release
needs: test-rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Publish
run: |
cd rust
cargo login ${{ secrets.CRATES_TOKEN }}
cargo publish -v --dry-run
release-rust-crate:
name: Release Rust crate
if: startsWith(github.ref, 'refs/tags/')
needs: test-release-rust-crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Publish
run: |
cd rust
cargo login ${{ secrets.CRATES_TOKEN }}
cargo publish -v
release-py-wheels:
name: Release Python wheels
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- macos-py-wheels
- windows-py-wheels
- linux-py-wheels
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
with:
command: upload
args: --skip-existing *