]> git.lizzy.rs Git - rust.git/blob - .github/workflows/clippy.yml
Apply review comments
[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   NO_FMT_TEST: 1
25
26 jobs:
27   base:
28     runs-on: ubuntu-latest
29
30     steps:
31     # Setup
32     - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
33       with:
34         github_token: "${{ secrets.github_token }}"
35
36     - name: rust-toolchain
37       uses: actions-rs/toolchain@v1.0.3
38       with:
39         toolchain: nightly
40         target: x86_64-unknown-linux-gnu
41         profile: minimal
42
43     - name: Checkout
44       uses: actions/checkout@v2.0.0
45
46     - name: Run cargo update
47       run: cargo update
48
49     - name: Cache cargo dir
50       uses: actions/cache@v1
51       with:
52         path: ~/.cargo
53         key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
54         restore-keys: |
55           ${{ runner.os }}-x86_64-unknown-linux-gnu
56
57     - name: Master Toolchain Setup
58       run: bash setup-toolchain.sh
59
60     # Run
61     - name: Set LD_LIBRARY_PATH (Linux)
62       run: |
63         SYSROOT=$(rustc --print sysroot)
64         echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
65
66     - name: Build
67       run: cargo build --features deny-warnings
68
69     - name: Test
70       run: cargo test --features deny-warnings
71
72     - name: Test clippy_lints
73       run: cargo test --features deny-warnings
74       working-directory: clippy_lints
75
76     - name: Test rustc_tools_util
77       run: cargo test --features deny-warnings
78       working-directory: rustc_tools_util
79
80     - name: Test clippy_dev
81       run: cargo test --features deny-warnings
82       working-directory: clippy_dev
83
84     - name: Test cargo-clippy
85       run: ../target/debug/cargo-clippy
86       working-directory: clippy_workspace_tests
87
88     - name: Test clippy-driver
89       run: bash .github/driver.sh
90       env:
91         OS: ${{ runner.os }}
92
93     # Cleanup
94     - name: Run cargo-cache --autoclean
95       run: |
96         cargo install cargo-cache --debug
97         find ~/.cargo/bin ! -type d -exec strip {} \;
98         cargo cache --autoclean