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 }}"
27 uses: actions/checkout@v2.3.3
29 ref: ${{ github.ref }}
32 - name: Check Changelog
34 MESSAGE=$(git log --format=%B -n 1)
35 PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
36 output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
37 python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
38 grep "^changelog: " | \
39 sed "s/changelog: //g")
40 if [[ -z "$output" ]]; then
41 echo "ERROR: PR body must contain 'changelog: ...'"
43 elif [[ "$output" = "none" ]]; then
44 echo "WARNING: changelog is 'none'"
47 PYTHONIOENCODING: 'utf-8'
52 os: [ubuntu-latest, windows-latest, macos-latest]
53 host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
56 host: x86_64-apple-darwin
58 host: x86_64-pc-windows-msvc
60 host: x86_64-unknown-linux-gnu
62 host: i686-unknown-linux-gnu
64 host: x86_64-pc-windows-msvc
66 host: x86_64-unknown-linux-gnu
68 host: i686-unknown-linux-gnu
70 host: x86_64-apple-darwin
72 runs-on: ${{ matrix.os }}
76 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
78 github_token: "${{ secrets.github_token }}"
80 - name: Install dependencies (Linux-i686)
82 sudo dpkg --add-architecture i386
84 sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
85 if: matrix.host == 'i686-unknown-linux-gnu'
87 - name: rust-toolchain
88 uses: actions-rs/toolchain@v1.0.6
91 target: ${{ matrix.host }}
95 uses: actions/checkout@v2.3.3
97 - name: Run cargo update
100 - name: Cache cargo dir
101 uses: actions/cache@v2
104 key: ${{ runner.os }}-${{ matrix.host }}-${{ hashFiles('Cargo.lock') }}
106 ${{ runner.os }}-${{ matrix.host }}
108 - name: Master Toolchain Setup
109 run: bash setup-toolchain.sh
111 HOST_TOOLCHAIN: ${{ matrix.host }}
114 - name: Set LD_LIBRARY_PATH (Linux)
115 if: runner.os == 'Linux'
117 SYSROOT=$(rustc --print sysroot)
118 echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
119 - name: Link rustc dylib (MacOS)
120 if: runner.os == 'macOS'
122 SYSROOT=$(rustc --print sysroot)
123 sudo mkdir -p /usr/local/lib
124 sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
125 - name: Set PATH (Windows)
126 if: runner.os == 'Windows'
128 SYSROOT=$(rustc --print sysroot)
129 echo "$SYSROOT/bin" >> $GITHUB_PATH
132 run: cargo build --features deny-warnings
134 # compiletest would panic due to "Found multiple rlibs for crate `clippy_lints`"
136 run: rm -f ./target/debug/deps/libclippy_lints*
138 - name: Build with internal lints
139 run: cargo build --features deny-warnings,internal-lints
141 - name: Test with internal lints
142 run: cargo test --features deny-warnings,internal-lints
144 - name: Test clippy_lints with internal lints
145 run: cargo test --features deny-warnings,internal-lints
146 working-directory: clippy_lints
148 - name: Test rustc_tools_util
149 run: cargo test --features deny-warnings
150 working-directory: rustc_tools_util
152 - name: Test clippy_dev
153 run: cargo test --features deny-warnings
154 working-directory: clippy_dev
156 - name: Test cargo-clippy
157 run: ../target/debug/cargo-clippy
158 working-directory: clippy_workspace_tests
160 - name: Test clippy-driver
161 run: bash .github/driver.sh
166 - name: Run cargo-cache --autoclean
168 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
173 runs-on: ubuntu-latest
177 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
179 github_token: "${{ secrets.github_token }}"
181 - name: rust-toolchain
182 uses: actions-rs/toolchain@v1.0.6
185 target: x86_64-unknown-linux-gnu
189 uses: actions/checkout@v2.3.3
191 - name: Run cargo update
194 - name: Cache cargo dir
195 uses: actions/cache@v2
198 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
200 ${{ runner.os }}-x86_64-unknown-linux-gnu
202 - name: Master Toolchain Setup
203 run: bash setup-toolchain.sh
206 - name: Build Integration Test
207 run: cargo test --test integration --features integration --no-run
210 - name: Extract Binaries
212 DIR=$CARGO_TARGET_DIR/debug
213 rm $DIR/deps/integration-*.d
214 mv $DIR/deps/integration-* $DIR/integration
215 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
216 rm -rf $CARGO_TARGET_DIR/release
218 - name: Upload Binaries
219 uses: actions/upload-artifact@v1
225 - name: Run cargo-cache --autoclean
227 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
230 needs: integration_build
237 # FIXME: re-enable once fmt_macros is renamed in RLS
240 - 'rust-lang/rustfmt'
243 - 'rust-lang/stdarch'
245 # FIXME: chrono currently cannot be compiled with `--all-targets`
246 # - 'chronotope/chrono'
249 - 'rust-lang/futures-rs'
250 - 'rust-itertools/itertools'
251 - 'rust-lang-nursery/failure'
254 runs-on: ubuntu-latest
258 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
260 github_token: "${{ secrets.github_token }}"
262 - name: rust-toolchain
263 uses: actions-rs/toolchain@v1.0.6
266 target: x86_64-unknown-linux-gnu
270 uses: actions/checkout@v2.3.3
272 - name: Run cargo update
275 - name: Cache cargo dir
276 uses: actions/cache@v2
279 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
281 ${{ runner.os }}-x86_64-unknown-linux-gnu
283 - name: Master Toolchain Setup
284 run: bash setup-toolchain.sh
287 - name: Download target dir
288 uses: actions/download-artifact@v1
293 - name: Make Binaries Executable
294 run: chmod +x $CARGO_TARGET_DIR/debug/*
297 - name: Test ${{ matrix.integration }}
298 run: $CARGO_TARGET_DIR/debug/integration
300 INTEGRATION: ${{ matrix.integration }}
301 RUSTUP_TOOLCHAIN: master
304 - name: Run cargo-cache --autoclean
306 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
309 # These jobs doesn't actually test anything, but they're only used to tell
310 # bors the build completed, as there is no practical way to detect when a
311 # workflow is successful listening to webhooks only.
313 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
316 name: bors test finished
317 if: github.event.pusher.name == 'bors' && success()
318 runs-on: ubuntu-latest
319 needs: [changelog, base, integration_build, integration]
322 - name: Mark the job as successful
326 name: bors test finished
327 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
328 runs-on: ubuntu-latest
329 needs: [changelog, base, integration_build, integration]
332 - name: Mark the job as a failure