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
135 run: cargo test --features deny-warnings
137 - name: Test clippy_lints
138 run: cargo test --features deny-warnings
139 working-directory: clippy_lints
141 - name: Test rustc_tools_util
142 run: cargo test --features deny-warnings
143 working-directory: rustc_tools_util
145 - name: Test clippy_dev
146 run: cargo test --features deny-warnings
147 working-directory: clippy_dev
149 - name: Test cargo-clippy
150 run: ../target/debug/cargo-clippy
151 working-directory: clippy_workspace_tests
153 - name: Test clippy-driver
154 run: bash .github/driver.sh
159 - name: Run cargo-cache --autoclean
161 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
166 runs-on: ubuntu-latest
170 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
172 github_token: "${{ secrets.github_token }}"
174 - name: rust-toolchain
175 uses: actions-rs/toolchain@v1.0.6
178 target: x86_64-unknown-linux-gnu
182 uses: actions/checkout@v2.3.3
184 - name: Run cargo update
187 - name: Cache cargo dir
188 uses: actions/cache@v2
191 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
193 ${{ runner.os }}-x86_64-unknown-linux-gnu
195 - name: Master Toolchain Setup
196 run: bash setup-toolchain.sh
199 - name: Build Integration Test
200 run: cargo test --test integration --features integration --no-run
203 - name: Extract Binaries
205 DIR=$CARGO_TARGET_DIR/debug
206 rm $DIR/deps/integration-*.d
207 mv $DIR/deps/integration-* $DIR/integration
208 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
209 rm -rf $CARGO_TARGET_DIR/release
211 - name: Upload Binaries
212 uses: actions/upload-artifact@v1
218 - name: Run cargo-cache --autoclean
220 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
223 needs: integration_build
230 # FIXME: re-enable once fmt_macros is renamed in RLS
233 - 'rust-lang/rustfmt'
236 - 'rust-lang/stdarch'
238 # FIXME: chrono currently cannot be compiled with `--all-targets`
239 # - 'chronotope/chrono'
242 - 'rust-lang/futures-rs'
243 - 'rust-itertools/itertools'
244 - 'rust-lang-nursery/failure'
247 runs-on: ubuntu-latest
251 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
253 github_token: "${{ secrets.github_token }}"
255 - name: rust-toolchain
256 uses: actions-rs/toolchain@v1.0.6
259 target: x86_64-unknown-linux-gnu
263 uses: actions/checkout@v2.3.3
265 - name: Run cargo update
268 - name: Cache cargo dir
269 uses: actions/cache@v2
272 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
274 ${{ runner.os }}-x86_64-unknown-linux-gnu
276 - name: Master Toolchain Setup
277 run: bash setup-toolchain.sh
280 - name: Download target dir
281 uses: actions/download-artifact@v1
286 - name: Make Binaries Executable
287 run: chmod +x $CARGO_TARGET_DIR/debug/*
290 - name: Test ${{ matrix.integration }}
291 run: $CARGO_TARGET_DIR/debug/integration
293 INTEGRATION: ${{ matrix.integration }}
294 RUSTUP_TOOLCHAIN: master
297 - name: Run cargo-cache --autoclean
299 cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
302 # These jobs doesn't actually test anything, but they're only used to tell
303 # bors the build completed, as there is no practical way to detect when a
304 # workflow is successful listening to webhooks only.
306 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
309 name: bors test finished
310 if: github.event.pusher.name == 'bors' && success()
311 runs-on: ubuntu-latest
312 needs: [changelog, base, integration_build, integration]
315 - name: Mark the job as successful
319 name: bors test finished
320 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
321 runs-on: ubuntu-latest
322 needs: [changelog, base, integration_build, integration]
325 - name: Mark the job as a failure