.github/workflows/ci.yml
72 lines · 2016 bytes
1on:
2 push:
3 branches:
4 - main
5 pull_request:
6 branches:
7 - main
8
9name: CI
10
11jobs:
12 test:
13 strategy:
14 matrix:
15 platform: [ubuntu-latest, windows-latest, macos-latest]
16 runs-on: ${{ matrix.platform }}
17 env:
18 SCCACHE_GHA_ENABLED: "true"
19 RUSTC_WRAPPER: "sccache"
20 steps:
21 - name: Checkout code
22 uses: actions/checkout@v3
23 with:
24 submodules: true
25 - name: Install Rust (1.96 w/ clippy)
26 uses: dtolnay/rust-toolchain@1.96
27 with:
28 components: clippy
29 - name: Install Rust (nightly w/ rustfmt)
30 run: rustup toolchain install nightly --component rustfmt
31 - name: Cache cargo registry
32 uses: actions/cache@v3
33 with:
34 path: ~/.cargo/registry
35 key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
36 - name: Run sccache-cache
37 uses: mozilla-actions/sccache-action@v0.0.9
38 - name: Check formatting
39 run: cargo +nightly fmt --all -- --check
40 - name: Check imports formatting
41 run: find src -name '*.rs' | xargs ./.github/workflows/check-imports-format.sh
42 - name: Check Clippy
43 if: matrix.platform == 'ubuntu-latest'
44 uses: giraffate/clippy-action@v1
45 with:
46 github_token: ${{ secrets.GITHUB_TOKEN }}
47 reporter: 'github-check'
48 clippy_flags: --all-targets -- -D warnings
49 - name: Run tests
50 run: cargo test --locked
51
52 nix-flake-test:
53 name: Flake checks ❄️
54 strategy:
55 matrix:
56 platform: [ubuntu-latest, macos-latest]
57 runs-on: ${{ matrix.platform }}
58 steps:
59 - name: Checkout Code
60 uses: actions/checkout@v4
61 - uses: cachix/install-nix-action@v31
62 with:
63 github_access_token: ${{ secrets.GITHUB_TOKEN }}
64 - uses: cachix/cachix-action@v15
65 with:
66 name: iamb-prs
67 authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
68 - name: Flake check
69 run: |
70 nix flake show
71 nix flake check --print-build-logs
72