Skip to content

[workflow] Also cache rustup toolchains, update-hashes #46

[workflow] Also cache rustup toolchains, update-hashes

[workflow] Also cache rustup toolchains, update-hashes #46

Workflow file for this run

name: CI
on:
push:
pull_request:
schedule:
- cron: "23 1 * * *"
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
name: Build and test
strategy:
matrix:
include:
- os: ubuntu-latest
toolchain: stable
- os: ubuntu-latest
toolchain: beta
- os: ubuntu-latest
toolchain: nightly
- os: windows-2022
toolchain: stable
- os: macos-latest
toolchain: stable
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/cache@v4
with:
path: |
~/.cache/uv/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.rustup/toolchains/
~/.rustup/update-hashes/
.venv/
target/
key: build_and_test-${{ matrix.toolchain }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Setup rust
run: rustup toolchain install --profile minimal ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v5
- run: cargo build --verbose
- run: cargo test --verbose
- run: uv run --package integration pytest
features:
name: Test non-default feature sets
strategy:
matrix:
include:
- features: ""
- features: "rayon"
- features: "full-geolib"
- features: "cli"
runs-on: ubuntu-latest
# Integration tests need the `cli` feature and some of their test cases may
# be painfully slow without the `floor` feature, so here we just make sure
# it builds and the Rust tests work.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/cache@v4
with:
path: |
~/.cache/uv/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.rustup/toolchains/
~/.rustup/update-hashes/
.venv/
target/
key: features-${{ matrix.features }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Setup rust
run: rustup toolchain install --profile minimal stable && rustup default stable
- run: cargo test --no-default-features -F "${{ matrix.features }}" --verbose
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/cache@v4
with:
path: |
~/.cache/uv/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.rustup/toolchains/
~/.rustup/update-hashes/
.venv/
target/
key: lint-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Setup rust
run: rustup toolchain install --profile minimal -c rustfmt nightly && rustup default nightly
- name: rustfmt
run: cargo fmt --check
- name: Cargo check
run: cargo check
- uses: astral-sh/ruff-action@v3
with:
args: "check"
- uses: astral-sh/ruff-action@v3
with:
args: "format --check --diff"