1 name: Clippy Test (bors)
11 CARGO_TARGET_DIR: '${{ github.workspace }}/target'
20 runs-on: ubuntu-latest
23 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
25 github_token: "${{ secrets.github_token }}"
28 uses: actions/checkout@v2.3.3
30 ref: ${{ github.ref }}
33 - name: Check Changelog
35 MESSAGE=$(git log --format=%B -n 1)
36 PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
37 body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
38 python -c "import sys, json; print(json.load(sys.stdin)['body'])")
39 output=$(grep "^changelog:\s*\S" <<< "$body" | sed "s/changelog:\s*//g") || {
40 echo "ERROR: PR body must contain 'changelog: ...'"
43 if [[ "$output" = "none" ]]; then
44 echo "WARNING: changelog is 'none'"
46 echo "changelog: $output"
49 PYTHONIOENCODING: 'utf-8'
54 os: [ubuntu-latest, windows-latest, macos-latest]
55 host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
58 host: x86_64-apple-darwin
60 host: x86_64-pc-windows-msvc
62 host: x86_64-unknown-linux-gnu
64 host: i686-unknown-linux-gnu
66 host: x86_64-pc-windows-msvc
68 host: x86_64-unknown-linux-gnu
70 host: i686-unknown-linux-gnu
72 host: x86_64-apple-darwin
74 runs-on: ${{ matrix.os }}
76 # NOTE: If you modify this job, make sure you copy the changes to clippy.yml
79 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
81 github_token: "${{ secrets.github_token }}"
83 - name: Install dependencies (Linux-i686)
85 sudo dpkg --add-architecture i386
87 sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
88 if: matrix.host == 'i686-unknown-linux-gnu'
91 uses: actions/checkout@v2.3.3
93 - name: Install toolchain
94 run: rustup show active-toolchain
97 - name: Set LD_LIBRARY_PATH (Linux)
98 if: runner.os == 'Linux'
100 SYSROOT=$(rustc --print sysroot)
101 echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
102 - name: Link rustc dylib (MacOS)
103 if: runner.os == 'macOS'
105 SYSROOT=$(rustc --print sysroot)
106 sudo mkdir -p /usr/local/lib
107 sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
108 - name: Set PATH (Windows)
109 if: runner.os == 'Windows'
111 SYSROOT=$(rustc --print sysroot)
112 echo "$SYSROOT/bin" >> $GITHUB_PATH
115 run: cargo build --features deny-warnings,internal-lints,metadata-collector-lint
118 run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
120 - name: Test clippy_lints
121 run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
122 working-directory: clippy_lints
124 - name: Test rustc_tools_util
125 run: cargo test --features deny-warnings
126 working-directory: rustc_tools_util
128 - name: Test clippy_dev
129 run: cargo test --features deny-warnings
130 working-directory: clippy_dev
132 - name: Test cargo-clippy
133 run: ../target/debug/cargo-clippy
134 working-directory: clippy_workspace_tests
136 - name: Test cargo-clippy --fix
137 run: ../target/debug/cargo-clippy clippy --fix
138 working-directory: clippy_workspace_tests
140 - name: Test clippy-driver
141 run: bash .github/driver.sh
145 - name: Test cargo dev new lint
147 cargo dev new_lint --name new_early_pass --pass early
148 cargo dev new_lint --name new_late_pass --pass late
150 git reset --hard HEAD
154 runs-on: ubuntu-latest
158 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
160 github_token: "${{ secrets.github_token }}"
163 uses: actions/checkout@v2.3.3
165 - name: Install toolchain
166 run: rustup show active-toolchain
169 - name: Build Integration Test
170 run: cargo test --test integration --features integration --no-run
173 - name: Extract Binaries
175 DIR=$CARGO_TARGET_DIR/debug
176 rm $DIR/deps/integration-*.d
177 mv $DIR/deps/integration-* $DIR/integration
178 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
179 rm -rf $CARGO_TARGET_DIR/release
181 - name: Upload Binaries
182 uses: actions/upload-artifact@v1
188 needs: integration_build
195 # FIXME: re-enable once fmt_macros is renamed in RLS
198 - 'rust-lang/rustfmt'
201 - 'rust-lang/stdarch'
203 # FIXME: chrono currently cannot be compiled with `--all-targets`
204 # - 'chronotope/chrono'
207 - 'rust-lang/futures-rs'
208 - 'rust-itertools/itertools'
209 - 'rust-lang-nursery/failure'
212 runs-on: ubuntu-latest
216 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
218 github_token: "${{ secrets.github_token }}"
221 uses: actions/checkout@v2.3.3
223 - name: Install toolchain
224 run: rustup show active-toolchain
227 - name: Download target dir
228 uses: actions/download-artifact@v1
233 - name: Make Binaries Executable
234 run: chmod +x $CARGO_TARGET_DIR/debug/*
237 - name: Test ${{ matrix.integration }}
239 RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | grep -o -E "nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}")" \
240 $CARGO_TARGET_DIR/debug/integration
242 INTEGRATION: ${{ matrix.integration }}
244 # These jobs doesn't actually test anything, but they're only used to tell
245 # bors the build completed, as there is no practical way to detect when a
246 # workflow is successful listening to webhooks only.
248 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
251 name: bors test finished
252 if: github.event.pusher.name == 'bors' && success()
253 runs-on: ubuntu-latest
254 needs: [changelog, base, integration_build, integration]
257 - name: Mark the job as successful
261 name: bors test finished
262 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
263 runs-on: ubuntu-latest
264 needs: [changelog, base, integration_build, integration]
267 - name: Mark the job as a failure