1 name: Clippy Test (bors)
11 CARGO_TARGET_DIR: '${{ github.workspace }}/target'
14 CARGO_UNSTABLE_SPARSE_REGISTRY: true
25 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
27 github_token: "${{ secrets.github_token }}"
30 uses: actions/checkout@v3.0.2
32 ref: ${{ github.ref }}
35 - name: Check Changelog
37 MESSAGE=$(git log --format=%B -n 1)
38 PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
39 body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
40 python -c "import sys, json; print(json.load(sys.stdin)['body'])")
41 output=$(grep "^changelog:\s*\S" <<< "$body" | sed "s/changelog:\s*//g") || {
42 echo "ERROR: PR body must contain 'changelog: ...'"
45 if [[ "$output" = "none" ]]; then
46 echo "WARNING: changelog is 'none'"
48 echo "changelog: $output"
51 PYTHONIOENCODING: 'utf-8'
56 os: [ubuntu-20.04, windows-latest, macos-latest]
57 host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
60 host: x86_64-apple-darwin
62 host: x86_64-pc-windows-msvc
64 host: x86_64-unknown-linux-gnu
66 host: i686-unknown-linux-gnu
68 host: x86_64-pc-windows-msvc
70 host: x86_64-unknown-linux-gnu
72 host: i686-unknown-linux-gnu
74 host: x86_64-apple-darwin
76 runs-on: ${{ matrix.os }}
78 # NOTE: If you modify this job, make sure you copy the changes to clippy.yml
81 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
83 github_token: "${{ secrets.github_token }}"
85 - name: Install dependencies (Linux-i686)
87 sudo dpkg --add-architecture i386
89 sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
90 if: matrix.host == 'i686-unknown-linux-gnu'
93 uses: actions/checkout@v3.0.2
95 - name: Install toolchain
96 run: rustup show active-toolchain
99 - name: Set LD_LIBRARY_PATH (Linux)
100 if: runner.os == 'Linux'
102 SYSROOT=$(rustc --print sysroot)
103 echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
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 echo "$SYSROOT/bin" >> $GITHUB_PATH
117 run: cargo build --features deny-warnings,internal
120 if: runner.os == 'Linux'
121 run: cargo test --features deny-warnings,internal
124 if: runner.os != 'Linux'
125 run: cargo test --features deny-warnings,internal -- --skip dogfood
127 - name: Test clippy_lints
128 run: cargo test --features deny-warnings,internal
129 working-directory: clippy_lints
131 - name: Test clippy_utils
132 run: cargo test --features deny-warnings,internal
133 working-directory: clippy_utils
135 - name: Test rustc_tools_util
136 run: cargo test --features deny-warnings
137 working-directory: rustc_tools_util
139 - name: Test clippy_dev
140 run: cargo test --features deny-warnings
141 working-directory: clippy_dev
143 - name: Test clippy-driver
144 run: bash .github/driver.sh
150 runs-on: ubuntu-20.04
154 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
156 github_token: "${{ secrets.github_token }}"
159 uses: actions/checkout@v3.0.2
161 - name: Install toolchain
162 run: rustup show active-toolchain
164 - name: Test metadata collection
165 run: cargo collect-metadata
169 runs-on: ubuntu-20.04
173 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
175 github_token: "${{ secrets.github_token }}"
178 uses: actions/checkout@v3.0.2
180 - name: Install toolchain
181 run: rustup show active-toolchain
184 - name: Build Integration Test
185 run: cargo test --test integration --features integration --no-run
188 - name: Extract Binaries
190 DIR=$CARGO_TARGET_DIR/debug
191 rm $DIR/deps/integration-*.d
192 mv $DIR/deps/integration-* $DIR/integration
193 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
194 rm -rf $CARGO_TARGET_DIR/release
196 - name: Upload Binaries
197 uses: actions/upload-artifact@v1
203 needs: integration_build
210 # FIXME: re-enable once fmt_macros is renamed in RLS
213 - 'rust-lang/rustfmt'
216 - 'rust-lang/stdarch'
218 # FIXME: chrono currently cannot be compiled with `--all-targets`
219 # - 'chronotope/chrono'
222 - 'rust-lang/futures-rs'
223 - 'rust-itertools/itertools'
224 - 'rust-lang-nursery/failure'
227 runs-on: ubuntu-20.04
231 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
233 github_token: "${{ secrets.github_token }}"
236 uses: actions/checkout@v3.0.2
238 - name: Install toolchain
239 run: rustup show active-toolchain
242 - name: Download target dir
243 uses: actions/download-artifact@v1
248 - name: Make Binaries Executable
249 run: chmod +x $CARGO_TARGET_DIR/debug/*
252 - name: Test ${{ matrix.integration }}
254 RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | grep -o -E "nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}")" \
255 $CARGO_TARGET_DIR/debug/integration
257 INTEGRATION: ${{ matrix.integration }}
259 # These jobs doesn't actually test anything, but they're only used to tell
260 # bors the build completed, as there is no practical way to detect when a
261 # workflow is successful listening to webhooks only.
263 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
266 name: bors test finished
267 if: github.event.pusher.name == 'bors' && success()
268 runs-on: ubuntu-20.04
269 needs: [changelog, base, metadata_collection, integration_build, integration]
272 - name: Mark the job as successful
276 name: bors test finished
277 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
278 runs-on: ubuntu-20.04
279 needs: [changelog, base, metadata_collection, integration_build, integration]
282 - name: Mark the job as a failure