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 # perform system upgrade to work around https://github.com/rust-lang/rust-clippy/issues/5477 , revert as soon as that is fixed
81 sudo apt-get -y upgrade
82 sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
83 if: matrix.host == 'i686-unknown-linux-gnu'
85 - name: rust-toolchain
86 uses: actions-rs/toolchain@v1.0.3
89 target: ${{ matrix.host }}
93 uses: actions/checkout@v2.0.0
95 - name: Run cargo update
98 - name: Cache cargo dir
99 uses: actions/cache@v1
102 key: ${{ runner.os }}-${{ matrix.host }}-${{ hashFiles('Cargo.lock') }}
104 ${{ runner.os }}-${{ matrix.host }}
106 - name: Master Toolchain Setup
107 run: bash setup-toolchain.sh
109 HOST_TOOLCHAIN: ${{ matrix.host }}
113 - name: Set LD_LIBRARY_PATH (Linux)
114 if: runner.os == 'Linux'
116 SYSROOT=$(rustc --print sysroot)
117 echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
118 - name: Link rustc dylib (MacOS)
119 if: runner.os == 'macOS'
121 SYSROOT=$(rustc --print sysroot)
122 sudo mkdir -p /usr/local/lib
123 sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
124 - name: Set PATH (Windows)
125 if: runner.os == 'Windows'
127 $sysroot = rustc --print sysroot
128 $env:PATH += ';' + $sysroot + '\bin'
129 echo "::set-env name=PATH::$env:PATH"
132 run: cargo build --features deny-warnings
136 run: cargo test --features deny-warnings
139 - name: Test clippy_lints
140 run: cargo test --features deny-warnings
142 working-directory: clippy_lints
144 - name: Test rustc_tools_util
145 run: cargo test --features deny-warnings
147 working-directory: rustc_tools_util
149 - name: Test clippy_dev
150 run: cargo test --features deny-warnings
152 working-directory: clippy_dev
154 - name: Test cargo-clippy
155 run: ../target/debug/cargo-clippy
157 working-directory: clippy_workspace_tests
159 - name: Test clippy-driver
160 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.3
185 target: x86_64-unknown-linux-gnu
189 uses: actions/checkout@v2.0.0
191 - name: Run cargo update
194 - name: Cache cargo dir
195 uses: actions/cache@v1
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
239 - 'rust-lang/rustfmt'
242 - 'rust-lang/stdarch'
244 - 'chronotope/chrono'
247 - 'rust-lang/futures-rs'
248 - 'rust-itertools/itertools'
249 - 'rust-lang-nursery/failure'
252 runs-on: ubuntu-latest
256 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
258 github_token: "${{ secrets.github_token }}"
260 - name: rust-toolchain
261 uses: actions-rs/toolchain@v1.0.3
264 target: x86_64-unknown-linux-gnu
268 uses: actions/checkout@v2.0.0
270 - name: Run cargo update
273 - name: Cache cargo dir
274 uses: actions/cache@v1
277 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
279 ${{ runner.os }}-x86_64-unknown-linux-gnu
281 - name: Master Toolchain Setup
282 run: bash setup-toolchain.sh
285 - name: Download target dir
286 uses: actions/download-artifact@v1
291 - name: Make Binaries Executable
292 run: chmod +x $CARGO_TARGET_DIR/debug/*
295 - name: Test ${{ matrix.integration }}
296 run: $CARGO_TARGET_DIR/debug/integration
298 INTEGRATION: ${{ matrix.integration }}
299 RUSTUP_TOOLCHAIN: master
302 - name: Run cargo-cache --autoclean
304 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
307 # These jobs doesn't actually test anything, but they're only used to tell
308 # bors the build completed, as there is no practical way to detect when a
309 # workflow is successful listening to webhooks only.
311 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
314 name: bors test finished
315 if: github.event.pusher.name == 'bors' && success()
316 runs-on: ubuntu-latest
317 needs: [base, integration]
320 - name: Mark the job as successful
324 name: bors test finished
325 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
326 runs-on: ubuntu-latest
327 needs: [base, integration]
330 - name: Mark the job as a failure