Merge pull request #19 from unsplash/ci-cache #64
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
# The default GitHub runner image comes with a bunch of software preinstalled. | |
# Typically this doesn't matter, however with Cargo it appears to interfere, | |
# hence the `rm -rf ~/.cargo/` steps. | |
name: Check | |
on: | |
push: | |
jobs: | |
validate: | |
name: Validate Nix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v22 | |
- run: nix flake check | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rm -rf ~/.cargo/ | |
- uses: cachix/install-nix-action@v22 | |
- uses: ./.github/actions/cargo-cache | |
- run: nix develop -c cargo check | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rm -rf ~/.cargo/ | |
- uses: cachix/install-nix-action@v22 | |
- uses: ./.github/actions/cargo-cache | |
- run: nix develop -c cargo test | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rm -rf ~/.cargo/ | |
- uses: cachix/install-nix-action@v22 | |
- uses: ./.github/actions/cargo-cache | |
# See: https://github.com/rust-lang/rust-clippy/issues/1209 | |
- run: RUSTFLAGS="-D warnings" nix develop -c cargo clippy --all-targets | |
fmt: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rm -rf ~/.cargo/ | |
- uses: cachix/install-nix-action@v22 | |
- run: nix develop -c cargo fmt --check |