]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/.github/workflows/clippy_bors.yml
New upstream version 1.65.0+dfsg1
[rustc.git] / src / tools / clippy / .github / workflows / clippy_bors.yml
CommitLineData
f20569fa
XL
1name: Clippy Test (bors)
2
3on:
4 push:
5 branches:
6 - auto
7 - try
8
9env:
10 RUST_BACKTRACE: 1
11 CARGO_TARGET_DIR: '${{ github.workspace }}/target'
12 NO_FMT_TEST: 1
f2b60f7d 13 CARGO_INCREMENTAL: 0
f20569fa
XL
14
15defaults:
16 run:
17 shell: bash
18
19jobs:
20 changelog:
21 runs-on: ubuntu-latest
22
23 steps:
24 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
25 with:
26 github_token: "${{ secrets.github_token }}"
27
28 - name: Checkout
04454e1e 29 uses: actions/checkout@v3.0.2
f20569fa
XL
30 with:
31 ref: ${{ github.ref }}
32
33 # Run
34 - name: Check Changelog
35 run: |
36 MESSAGE=$(git log --format=%B -n 1)
37 PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
cdc7bbd5
XL
38 body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
39 python -c "import sys, json; print(json.load(sys.stdin)['body'])")
40 output=$(grep "^changelog:\s*\S" <<< "$body" | sed "s/changelog:\s*//g") || {
f20569fa
XL
41 echo "ERROR: PR body must contain 'changelog: ...'"
42 exit 1
cdc7bbd5
XL
43 }
44 if [[ "$output" = "none" ]]; then
f20569fa 45 echo "WARNING: changelog is 'none'"
cdc7bbd5
XL
46 else
47 echo "changelog: $output"
f20569fa
XL
48 fi
49 env:
50 PYTHONIOENCODING: 'utf-8'
51 base:
52 needs: changelog
53 strategy:
54 matrix:
55 os: [ubuntu-latest, windows-latest, macos-latest]
56 host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
57 exclude:
58 - os: ubuntu-latest
59 host: x86_64-apple-darwin
60 - os: ubuntu-latest
61 host: x86_64-pc-windows-msvc
62 - os: macos-latest
63 host: x86_64-unknown-linux-gnu
64 - os: macos-latest
65 host: i686-unknown-linux-gnu
66 - os: macos-latest
67 host: x86_64-pc-windows-msvc
68 - os: windows-latest
69 host: x86_64-unknown-linux-gnu
70 - os: windows-latest
71 host: i686-unknown-linux-gnu
72 - os: windows-latest
73 host: x86_64-apple-darwin
74
75 runs-on: ${{ matrix.os }}
76
77 # NOTE: If you modify this job, make sure you copy the changes to clippy.yml
78 steps:
79 # Setup
80 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
81 with:
82 github_token: "${{ secrets.github_token }}"
83
84 - name: Install dependencies (Linux-i686)
85 run: |
86 sudo dpkg --add-architecture i386
87 sudo apt-get update
88 sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
89 if: matrix.host == 'i686-unknown-linux-gnu'
90
91 - name: Checkout
04454e1e 92 uses: actions/checkout@v3.0.2
f20569fa
XL
93
94 - name: Install toolchain
95 run: rustup show active-toolchain
96
97 # Run
98 - name: Set LD_LIBRARY_PATH (Linux)
99 if: runner.os == 'Linux'
100 run: |
101 SYSROOT=$(rustc --print sysroot)
102 echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
103 - name: Link rustc dylib (MacOS)
104 if: runner.os == 'macOS'
105 run: |
106 SYSROOT=$(rustc --print sysroot)
107 sudo mkdir -p /usr/local/lib
108 sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
109 - name: Set PATH (Windows)
110 if: runner.os == 'Windows'
111 run: |
112 SYSROOT=$(rustc --print sysroot)
113 echo "$SYSROOT/bin" >> $GITHUB_PATH
114
115 - name: Build
5099ac24 116 run: cargo build --features deny-warnings,internal
f20569fa
XL
117
118 - name: Test
5099ac24
FG
119 if: runner.os == 'Linux'
120 run: cargo test --features deny-warnings,internal
121
122 - name: Test
123 if: runner.os != 'Linux'
124 run: cargo test --features deny-warnings,internal -- --skip dogfood
f20569fa
XL
125
126 - name: Test clippy_lints
5099ac24 127 run: cargo test --features deny-warnings,internal
f20569fa
XL
128 working-directory: clippy_lints
129
a2a8927a 130 - name: Test clippy_utils
5099ac24 131 run: cargo test --features deny-warnings,internal
a2a8927a
XL
132 working-directory: clippy_utils
133
f20569fa
XL
134 - name: Test rustc_tools_util
135 run: cargo test --features deny-warnings
136 working-directory: rustc_tools_util
137
138 - name: Test clippy_dev
139 run: cargo test --features deny-warnings
140 working-directory: clippy_dev
141
f20569fa
XL
142 - name: Test clippy-driver
143 run: bash .github/driver.sh
144 env:
145 OS: ${{ runner.os }}
146
923072b8 147 metadata_collection:
064997fb 148 needs: changelog
923072b8
FG
149 runs-on: ubuntu-latest
150
151 steps:
152 # Setup
153 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
154 with:
155 github_token: "${{ secrets.github_token }}"
156
157 - name: Checkout
158 uses: actions/checkout@v3.0.2
159
160 - name: Install toolchain
161 run: rustup show active-toolchain
162
163 - name: Test metadata collection
164 run: cargo collect-metadata
165
f20569fa
XL
166 integration_build:
167 needs: changelog
168 runs-on: ubuntu-latest
169
170 steps:
171 # Setup
172 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
173 with:
174 github_token: "${{ secrets.github_token }}"
175
176 - name: Checkout
04454e1e 177 uses: actions/checkout@v3.0.2
f20569fa
XL
178
179 - name: Install toolchain
180 run: rustup show active-toolchain
181
182 # Run
183 - name: Build Integration Test
184 run: cargo test --test integration --features integration --no-run
185
186 # Upload
187 - name: Extract Binaries
188 run: |
189 DIR=$CARGO_TARGET_DIR/debug
190 rm $DIR/deps/integration-*.d
191 mv $DIR/deps/integration-* $DIR/integration
192 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
193 rm -rf $CARGO_TARGET_DIR/release
194
195 - name: Upload Binaries
196 uses: actions/upload-artifact@v1
197 with:
198 name: target
199 path: target
200
201 integration:
202 needs: integration_build
203 strategy:
204 fail-fast: false
205 max-parallel: 6
206 matrix:
207 integration:
208 - 'rust-lang/cargo'
209 # FIXME: re-enable once fmt_macros is renamed in RLS
210 # - 'rust-lang/rls'
211 - 'rust-lang/chalk'
212 - 'rust-lang/rustfmt'
213 - 'Marwes/combine'
214 - 'Geal/nom'
215 - 'rust-lang/stdarch'
216 - 'serde-rs/serde'
217 # FIXME: chrono currently cannot be compiled with `--all-targets`
218 # - 'chronotope/chrono'
219 - 'hyperium/hyper'
220 - 'rust-random/rand'
221 - 'rust-lang/futures-rs'
222 - 'rust-itertools/itertools'
223 - 'rust-lang-nursery/failure'
224 - 'rust-lang/log'
225
226 runs-on: ubuntu-latest
227
228 steps:
229 # Setup
230 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
231 with:
232 github_token: "${{ secrets.github_token }}"
233
234 - name: Checkout
04454e1e 235 uses: actions/checkout@v3.0.2
f20569fa
XL
236
237 - name: Install toolchain
238 run: rustup show active-toolchain
239
240 # Download
241 - name: Download target dir
242 uses: actions/download-artifact@v1
243 with:
244 name: target
245 path: target
246
247 - name: Make Binaries Executable
248 run: chmod +x $CARGO_TARGET_DIR/debug/*
249
250 # Run
251 - name: Test ${{ matrix.integration }}
252 run: |
253 RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | grep -o -E "nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}")" \
254 $CARGO_TARGET_DIR/debug/integration
255 env:
256 INTEGRATION: ${{ matrix.integration }}
257
258 # These jobs doesn't actually test anything, but they're only used to tell
259 # bors the build completed, as there is no practical way to detect when a
260 # workflow is successful listening to webhooks only.
261 #
262 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
263
264 end-success:
265 name: bors test finished
266 if: github.event.pusher.name == 'bors' && success()
267 runs-on: ubuntu-latest
064997fb 268 needs: [changelog, base, metadata_collection, integration_build, integration]
f20569fa
XL
269
270 steps:
271 - name: Mark the job as successful
272 run: exit 0
273
274 end-failure:
275 name: bors test finished
276 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
277 runs-on: ubuntu-latest
064997fb 278 needs: [changelog, base, metadata_collection, integration_build, integration]
f20569fa
XL
279
280 steps:
281 - name: Mark the job as a failure
282 run: exit 1