]> git.lizzy.rs Git - rust.git/blob - .github/workflows/clippy.yml
Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2
[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:
7       - auto
8       - try
9     # Don't run Clippy tests, when only textfiles were modified
10     paths-ignore:
11     - 'COPYRIGHT'
12     - 'LICENSE-*'
13     - '**.md'
14     - '**.txt'
15   pull_request:
16     # Don't run Clippy tests, when only textfiles were modified
17     paths-ignore:
18     - 'COPYRIGHT'
19     - 'LICENSE-*'
20     - '**.md'
21     - '**.txt'
22
23 env:
24   RUST_BACKTRACE: 1
25   CARGO_TARGET_DIR: '${{ github.workspace }}/target'
26   NO_FMT_TEST: 1
27
28 jobs:
29   base:
30     runs-on: ubuntu-latest
31
32     steps:
33     # Setup
34     - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
35       with:
36         github_token: "${{ secrets.github_token }}"
37
38     - name: rust-toolchain
39       uses: actions-rs/toolchain@v1.0.3
40       with:
41         toolchain: nightly
42         target: x86_64-unknown-linux-gnu
43         profile: minimal
44
45     - name: Checkout
46       uses: actions/checkout@v2.0.0
47
48     - name: Run cargo update
49       run: cargo update
50
51     - name: Cache cargo dir
52       uses: actions/cache@v2
53       with:
54         path: ~/.cargo
55         key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
56         restore-keys: |
57           ${{ runner.os }}-x86_64-unknown-linux-gnu
58
59     - name: Master Toolchain Setup
60       run: bash setup-toolchain.sh
61
62     # Run
63     - name: Set LD_LIBRARY_PATH (Linux)
64       run: |
65         SYSROOT=$(rustc --print sysroot)
66         echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
67
68     - name: Build
69       run: cargo build --features deny-warnings
70
71     - name: Test
72       run: cargo test --features deny-warnings
73
74     - name: Test clippy_lints
75       run: cargo test --features deny-warnings
76       working-directory: clippy_lints
77
78     - name: Test rustc_tools_util
79       run: cargo test --features deny-warnings
80       working-directory: rustc_tools_util
81
82     - name: Test clippy_dev
83       run: cargo test --features deny-warnings
84       working-directory: clippy_dev
85
86     - name: Test cargo-clippy
87       run: ../target/debug/cargo-clippy
88       working-directory: clippy_workspace_tests
89
90     - name: Test clippy-driver
91       run: bash .github/driver.sh
92       env:
93         OS: ${{ runner.os }}
94
95     # Cleanup
96     - name: Run cargo-cache --autoclean
97       run: |
98         cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
99         cargo cache