Update README #7
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: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
UV_CACHE_DIR: /tmp/.uv-cache | |
jobs: | |
lint-rust: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: Cache rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo clippy | |
run: cargo clippy -- -D warnings | |
rust-fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Cache rust | |
uses: Swatinem/[email protected] | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check | |
lint-python: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
run: curl -LsSf https://astral.sh/uv/0.4.2/install.sh | sh | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Restore uv cache | |
uses: actions/cache@v4 | |
with: | |
path: ${ env.UV_CACHE_DIR } | |
key: uv-${ runner.os }-${ hashFiles('uv.lock') } | |
restore-keys: | | |
uv-${ runner.os }-${ hashFiles('uv.lock') } | |
uv-${ runner.os } | |
- name: Install dev dependencies | |
run: uv sync --frozen --dev | |
- name: Ruff format check | |
run: uv run ruff format tests --check | |
- name: Lint with ruff | |
run: uv run ruff check . | |
- name: mypy check | |
run: uv run mypy tests --strict --allow-untyped-defs | |
- name: Minimize uv cache | |
run: uv cache prune --ci | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up uv | |
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} | |
run: curl -LsSf https://astral.sh/uv/0.4.2/install.sh | sh | |
- name: Set up uv | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: irm https://astral.sh/uv/0.4.2/install.ps1 | iex | |
shell: powershell | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Restore uv cache | |
uses: actions/cache@v4 | |
with: | |
path: ${ env.UV_CACHE_DIR } | |
key: uv-${ runner.os }-${ hashFiles('uv.lock') } | |
restore-keys: | | |
uv-${ runner.os }-${ hashFiles('uv.lock') } | |
uv-${ runner.os } | |
- name: Install project and dev dependencies | |
run: uv sync --frozen --dev | |
- name: Run tests | |
run: uv run pytest tests -vv | |
- name: Minimize uv cache | |
run: uv cache prune --ci |