1 name: Clippy Test (bors)
9 CARGO_TARGET_DIR: '${{ github.workspace }}/target'
14 runs-on: ubuntu-latest
17 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
19 github_token: "${{ secrets.github_token }}"
21 uses: actions/checkout@v2.0.0
23 ref: ${{ github.ref }}
24 - name: Check Changelog
26 MESSAGE=$(git log --format=%B -n 1)
27 PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
28 output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
29 python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
30 grep "^changelog: " | \
31 sed "s/changelog: //g")
32 if [[ -z "$output" ]]; then
33 echo "ERROR: PR body must contain 'changelog: ...'"
35 elif [[ "$output" = "none" ]]; then
36 echo "WARNING: changelog is 'none'"
39 PYTHONIOENCODING: 'utf-8'
44 os: [ubuntu-latest, windows-latest, macos-latest]
45 host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
48 host: x86_64-apple-darwin
50 host: x86_64-pc-windows-msvc
52 host: x86_64-unknown-linux-gnu
54 host: i686-unknown-linux-gnu
56 host: x86_64-pc-windows-msvc
58 host: x86_64-unknown-linux-gnu
60 host: i686-unknown-linux-gnu
62 host: x86_64-apple-darwin
64 runs-on: ${{ matrix.os }}
67 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
69 github_token: "${{ secrets.github_token }}"
70 - name: Install dependencies (Linux-i686)
72 sudo dpkg --add-architecture i386
74 sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
75 if: matrix.host == 'i686-unknown-linux-gnu'
76 - name: rust-toolchain
77 uses: actions-rs/toolchain@v1.0.3
80 target: ${{ matrix.host }}
83 uses: actions/checkout@v2.0.0
84 - name: Run cargo update
86 - name: Cache cargo dir
87 uses: actions/cache@v1
90 key: ${{ runner.os }}-${{ matrix.host }}-${{ hashFiles('Cargo.lock') }}
92 ${{ runner.os }}-${{ matrix.host }}
93 - name: Master Toolchain Setup
94 run: bash setup-toolchain.sh
96 HOST_TOOLCHAIN: ${{ matrix.host }}
99 - name: Set LD_LIBRARY_PATH (Linux)
100 if: runner.os == 'Linux'
102 SYSROOT=$(rustc --print sysroot)
103 echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
104 - name: Link rustc dylib (MacOS)
105 if: runner.os == 'macOS'
107 SYSROOT=$(rustc --print sysroot)
108 sudo mkdir -p /usr/local/lib
109 sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
110 - name: Set PATH (Windows)
111 if: runner.os == 'Windows'
113 $sysroot = rustc --print sysroot
114 $env:PATH += ';' + $sysroot + '\bin'
115 echo "::set-env name=PATH::$env:PATH"
117 run: cargo build --features deny-warnings
120 run: cargo test --features deny-warnings
122 - name: Test clippy_lints
123 run: cargo test --features deny-warnings
125 working-directory: clippy_lints
126 - name: Test rustc_tools_util
127 run: cargo test --features deny-warnings
129 working-directory: rustc_tools_util
130 - name: Test clippy_dev
131 run: cargo test --features deny-warnings
133 working-directory: clippy_dev
134 - name: Test cargo-clippy
135 run: ../target/debug/cargo-clippy
137 working-directory: clippy_workspace_tests
138 - name: Test clippy-driver
139 run: bash .github/driver.sh
144 - name: Run cargo-cache --autoclean
146 cargo install cargo-cache --debug
147 /usr/bin/find ~/.cargo/bin ! -type d -exec strip {} \;
148 cargo cache --autoclean
152 runs-on: ubuntu-latest
155 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
157 github_token: "${{ secrets.github_token }}"
158 - name: rust-toolchain
159 uses: actions-rs/toolchain@v1.0.3
162 target: x86_64-unknown-linux-gnu
165 uses: actions/checkout@v2.0.0
166 - name: Run cargo update
168 - name: Cache cargo dir
169 uses: actions/cache@v1
172 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
174 ${{ runner.os }}-x86_64-unknown-linux-gnu
175 - name: Master Toolchain Setup
176 run: bash setup-toolchain.sh
178 - name: Build Integration Test
179 run: cargo test --test integration --features integration --no-run
180 - name: Extract Binaries
182 DIR=$CARGO_TARGET_DIR/debug
183 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
184 mv $DIR/integration-* $DIR/integration
185 - name: Upload Binaries
186 uses: actions/upload-artifact@v1
191 - name: Run cargo-cache --autoclean
193 cargo install cargo-cache --debug
194 find ~/.cargo/bin ! -type d -exec strip {} \;
195 cargo cache --autoclean
197 needs: integration_build
206 - 'rust-lang/rustfmt'
209 - 'rust-lang/stdarch'
211 - 'chronotope/chrono'
214 - 'rust-lang/futures-rs'
215 - 'rust-itertools/itertools'
216 - 'rust-lang-nursery/failure'
219 runs-on: ubuntu-latest
222 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
224 github_token: "${{ secrets.github_token }}"
225 - name: rust-toolchain
226 uses: actions-rs/toolchain@v1.0.3
229 target: x86_64-unknown-linux-gnu
232 uses: actions/checkout@v2.0.0
233 - name: Run cargo update
235 - name: Cache cargo dir
236 uses: actions/cache@v1
239 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
241 ${{ runner.os }}-x86_64-unknown-linux-gnu
242 - name: Master Toolchain Setup
243 run: bash setup-toolchain.sh
245 - name: Download target dir
246 uses: actions/download-artifact@v1
250 - name: Make Binaries Executable
251 run: chmod +x $CARGO_TARGET_DIR/debug/*
252 - name: Test ${{ matrix.integration }}
253 run: $CARGO_TARGET_DIR/debug/integration
255 INTEGRATION: ${{ matrix.integration }}
256 RUSTUP_TOOLCHAIN: master
258 - name: Run cargo-cache --autoclean
260 cargo install cargo-cache --debug
261 find ~/.cargo/bin ! -type d -exec strip {} \;
262 cargo cache --autoclean
264 # These jobs doesn't actually test anything, but they're only used to tell
265 # bors the build completed, as there is no practical way to detect when a
266 # workflow is successful listening to webhooks only.
268 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
271 name: bors test finished
272 if: github.event.pusher.name == 'bors' && success()
273 runs-on: ubuntu-latest
274 needs: [base, integration]
277 - name: Mark the job as successful
281 name: bors test finished
282 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
283 runs-on: ubuntu-latest
284 needs: [base, integration]
287 - name: Mark the job as a failure