name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cargo/bin
key: lint-cache-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
lint-cache-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
lint-cache-${{ runner.os }}-
- run: rustup update stable && rustup default stable
- name: Run cargo install cargo-machete
run: |
if [ ! -f ~/.cargo/bin/cargo-machete ]; then
cargo install cargo-machete
fi
- run: cargo machete
- run: cargo fmt --all -- --check
- run: cargo generate-lockfile --locked
- run: cargo clippy --locked -- --deny warnings
- run: cargo verify-project --locked
- run: cargo doc --no-deps
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: testdata
key: test-cache-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
- run: rustup update stable && rustup default stable
- name: Download test data
run: |
if [ ! -f testdata/AllPrintings.json ]; then
./tools/download-testdata
fi
if [ ! -f testdata/AtomicCards.json ]; then
./tools/download-testdata
fi
- run: cargo build --verbose
- run: cargo test --features local_tests --verbose