]> git.lizzy.rs Git - rust.git/blob - .github/workflows/clippy.yml
Use hash of Cargo.lock file in cache name
[rust.git] / .github / workflows / clippy.yml
1 name: Clippy Test
2
3 on:
4   push:
5     # Ignore bors branches, since they are covered by `clippy_bors.yml`
6     branches-ignore: [auto, try]
7     # Don't run Clippy tests, when only textfiles were modified
8     paths-ignore:
9     - 'COPYRIGHT'
10     - 'LICENSE-*'
11     - '**.md'
12     - '**.txt'
13   pull_request:
14     # Don't run Clippy tests, when only textfiles were modified
15     paths-ignore:
16     - 'COPYRIGHT'
17     - 'LICENSE-*'
18     - '**.md'
19     - '**.txt'
20
21 env:
22   RUST_BACKTRACE: 1
23   CARGO_TARGET_DIR: '${{ github.workspace }}/target'
24   GHA_CI: 1
25
26 jobs:
27   base:
28     runs-on: ubuntu-latest
29
30     steps:
31     - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
32       with:
33         github_token: "${{ secrets.github_token }}"
34     - name: rust-toolchain
35       uses: actions-rs/toolchain@v1.0.3
36       with:
37         toolchain: nightly
38         target: x86_64-unknown-linux-gnu
39         profile: minimal
40     - name: Checkout
41       uses: actions/checkout@v2.0.0
42     - name: Run cargo update
43       run: cargo update
44     - name: Cache cargo dir
45       uses: actions/cache@v1
46       with:
47         path: ~/.cargo
48         key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
49         restore-keys: |
50           ${{ runner.os }}-x86_64-unknown-linux-gnu
51     - name: Master Toolchain Setup
52       run: bash setup-toolchain.sh
53
54     - name: Set LD_LIBRARY_PATH (Linux)
55       run: |
56         SYSROOT=$(rustc --print sysroot)
57         echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
58     - name: Build
59       run: cargo build --features deny-warnings
60     - name: Test
61       run: cargo test --features deny-warnings
62     - name: Test clippy_lints
63       run: cargo test --features deny-warnings
64       working-directory: clippy_lints
65     - name: Test rustc_tools_util
66       run: cargo test --features deny-warnings
67       working-directory: rustc_tools_util
68     - name: Test clippy_dev
69       run: cargo test --features deny-warnings
70       working-directory: clippy_dev
71     - name: Test cargo-clippy
72       run: ../target/debug/cargo-clippy
73       working-directory: clippy_workspace_tests
74     - name: Test clippy-driver
75       run: bash .github/driver.sh
76       env:
77         OS: ${{ runner.os }}
78
79     - name: Run cargo-cache --autoclean
80       run: |
81         cargo install cargo-cache --debug
82         find ~/.cargo/bin ! -type d -exec strip {} \;
83         cargo cache --autoclean