1 name: Clippy Test (bors)
11 CARGO_TARGET_DIR: '${{ github.workspace }}/target'
16 runs-on: ubuntu-latest
19 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
21 github_token: "${{ secrets.github_token }}"
23 uses: actions/checkout@v2.0.0
25 ref: ${{ github.ref }}
28 - name: Check Changelog
30 MESSAGE=$(git log --format=%B -n 1)
31 PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
32 output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
33 python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
34 grep "^changelog: " | \
35 sed "s/changelog: //g")
36 if [[ -z "$output" ]]; then
37 echo "ERROR: PR body must contain 'changelog: ...'"
39 elif [[ "$output" = "none" ]]; then
40 echo "WARNING: changelog is 'none'"
43 PYTHONIOENCODING: 'utf-8'
48 os: [ubuntu-latest, windows-latest, macos-latest]
49 host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
52 host: x86_64-apple-darwin
54 host: x86_64-pc-windows-msvc
56 host: x86_64-unknown-linux-gnu
58 host: i686-unknown-linux-gnu
60 host: x86_64-pc-windows-msvc
62 host: x86_64-unknown-linux-gnu
64 host: i686-unknown-linux-gnu
66 host: x86_64-apple-darwin
68 runs-on: ${{ matrix.os }}
72 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
74 github_token: "${{ secrets.github_token }}"
76 - name: Install dependencies (Linux-i686)
78 sudo dpkg --add-architecture i386
80 sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
81 if: matrix.host == 'i686-unknown-linux-gnu'
83 - name: rust-toolchain
84 uses: actions-rs/toolchain@v1.0.3
87 target: ${{ matrix.host }}
91 uses: actions/checkout@v2.0.0
93 - name: Run cargo update
96 - name: Cache cargo dir
97 uses: actions/cache@v2
100 key: ${{ runner.os }}-${{ matrix.host }}-${{ hashFiles('Cargo.lock') }}
102 ${{ runner.os }}-${{ matrix.host }}
104 - name: Master Toolchain Setup
105 run: bash setup-toolchain.sh
107 HOST_TOOLCHAIN: ${{ matrix.host }}
111 - name: Set LD_LIBRARY_PATH (Linux)
112 if: runner.os == 'Linux'
114 SYSROOT=$(rustc --print sysroot)
115 echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
116 - name: Link rustc dylib (MacOS)
117 if: runner.os == 'macOS'
119 SYSROOT=$(rustc --print sysroot)
120 sudo mkdir -p /usr/local/lib
121 sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
122 - name: Set PATH (Windows)
123 if: runner.os == 'Windows'
125 $sysroot = rustc --print sysroot
126 $env:PATH += ';' + $sysroot + '\bin'
127 echo "::set-env name=PATH::$env:PATH"
130 run: cargo build --features deny-warnings
134 run: cargo test --features deny-warnings
137 - name: Test clippy_lints
138 run: cargo test --features deny-warnings
140 working-directory: clippy_lints
142 - name: Test rustc_tools_util
143 run: cargo test --features deny-warnings
145 working-directory: rustc_tools_util
147 - name: Test clippy_dev
148 run: cargo test --features deny-warnings
150 working-directory: clippy_dev
152 - name: Test cargo-clippy
153 run: ../target/debug/cargo-clippy
155 working-directory: clippy_workspace_tests
157 - name: Test clippy-driver
158 run: bash .github/driver.sh
164 - name: Run cargo-cache --autoclean
166 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
171 runs-on: ubuntu-latest
175 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
177 github_token: "${{ secrets.github_token }}"
179 - name: rust-toolchain
180 uses: actions-rs/toolchain@v1.0.3
183 target: x86_64-unknown-linux-gnu
187 uses: actions/checkout@v2.0.0
189 - name: Run cargo update
192 - name: Cache cargo dir
193 uses: actions/cache@v2
196 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
198 ${{ runner.os }}-x86_64-unknown-linux-gnu
200 - name: Master Toolchain Setup
201 run: bash setup-toolchain.sh
204 - name: Build Integration Test
205 run: cargo test --test integration --features integration --no-run
208 - name: Extract Binaries
210 DIR=$CARGO_TARGET_DIR/debug
211 rm $DIR/deps/integration-*.d
212 mv $DIR/deps/integration-* $DIR/integration
213 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
214 rm -rf $CARGO_TARGET_DIR/release
216 - name: Upload Binaries
217 uses: actions/upload-artifact@v1
223 - name: Run cargo-cache --autoclean
225 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
228 needs: integration_build
237 - 'rust-lang/rustfmt'
240 - 'rust-lang/stdarch'
242 - 'chronotope/chrono'
245 - 'rust-lang/futures-rs'
246 - 'rust-itertools/itertools'
247 - 'rust-lang-nursery/failure'
250 runs-on: ubuntu-latest
254 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
256 github_token: "${{ secrets.github_token }}"
258 - name: rust-toolchain
259 uses: actions-rs/toolchain@v1.0.3
262 target: x86_64-unknown-linux-gnu
266 uses: actions/checkout@v2.0.0
268 - name: Run cargo update
271 - name: Cache cargo dir
272 uses: actions/cache@v2
275 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
277 ${{ runner.os }}-x86_64-unknown-linux-gnu
279 - name: Master Toolchain Setup
280 run: bash setup-toolchain.sh
283 - name: Download target dir
284 uses: actions/download-artifact@v1
289 - name: Make Binaries Executable
290 run: chmod +x $CARGO_TARGET_DIR/debug/*
293 - name: Test ${{ matrix.integration }}
294 run: $CARGO_TARGET_DIR/debug/integration
296 INTEGRATION: ${{ matrix.integration }}
297 RUSTUP_TOOLCHAIN: master
300 - name: Run cargo-cache --autoclean
302 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
305 # These jobs doesn't actually test anything, but they're only used to tell
306 # bors the build completed, as there is no practical way to detect when a
307 # workflow is successful listening to webhooks only.
309 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
312 name: bors test finished
313 if: github.event.pusher.name == 'bors' && success()
314 runs-on: ubuntu-latest
315 needs: [changelog, base, integration_build, integration]
318 - name: Mark the job as successful
322 name: bors test finished
323 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
324 runs-on: ubuntu-latest
325 needs: [changelog, base, integration_build, integration]
328 - name: Mark the job as a failure