aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 287bc4e5cee3a2304ce7182630948d751fc180d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
on: [push, pull_request]

name: Continuous integration

jobs:
  ci:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - stable
          - beta
          - nightly
          - 1.36.0  # MSRV

    steps:
      - uses: actions/checkout@v2

      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}

      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
          components: rustfmt, clippy

      - run: cargo test

      - if: ${{ matrix.rust == 'stable' }}
        run: cargo fmt --all -- --check
        
      - if: ${{ matrix.rust == 'stable' }}
        run: cargo clippy --all -- -D warnings

      # Delete things that shouldn't be cached
      - run: find ./target/debug -maxdepth 1 -type f -delete
      - run: rm -rf ./target/debug/deps/tinytemplate*
      - run: rm -rf ./target/debug/.fingerprint/tinytemplate*
      - run: rm -f  ./target/.rustc_info.json
      - run: rm -rf ~/.cargo/registry/index/