1name: Clippy Test
2
3on:
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
23env:
24  RUST_BACKTRACE: 1
25  CARGO_TARGET_DIR: '${{ github.workspace }}/target'
26  NO_FMT_TEST: 1
27
28jobs:
29  base:
30    # NOTE: If you modify this job, make sure you copy the changes to clippy_bors.yml
31    runs-on: ubuntu-latest
32
33    steps:
34    # Setup
35    - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
36      with:
37        github_token: "${{ secrets.github_token }}"
38
39    - name: Checkout
40      uses: actions/checkout@v2.3.3
41
42    - name: Install toolchain
43      run: rustup show active-toolchain
44
45    # Run
46    - name: Set LD_LIBRARY_PATH (Linux)
47      run: |
48        SYSROOT=$(rustc --print sysroot)
49        echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
50
51    - name: Build
52      run: cargo build --features deny-warnings,internal-lints,metadata-collector-lint
53
54    - name: Test
55      run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
56
57    - name: Test clippy_lints
58      run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
59      working-directory: clippy_lints
60
61    - name: Test rustc_tools_util
62      run: cargo test --features deny-warnings
63      working-directory: rustc_tools_util
64
65    - name: Test clippy_dev
66      run: cargo test --features deny-warnings
67      working-directory: clippy_dev
68
69    - name: Test cargo-clippy
70      run: ../target/debug/cargo-clippy
71      working-directory: clippy_workspace_tests
72
73    - name: Test cargo-clippy --fix
74      run: ../target/debug/cargo-clippy clippy --fix
75      working-directory: clippy_workspace_tests
76
77    - name: Test clippy-driver
78      run: bash .github/driver.sh
79      env:
80        OS: ${{ runner.os }}
81
82    - name: Test cargo dev new lint
83      run: |
84        cargo dev new_lint --name new_early_pass --pass early
85        cargo dev new_lint --name new_late_pass --pass late
86        cargo check
87        git reset --hard HEAD
88