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 }}"
28 uses: actions/checkout@v2.3.3
30 ref: ${{ github.ref }}
33 - name: Check Changelog
35 MESSAGE=$(git log --format=%B -n 1)
36 PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
37 output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
38 python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
39 grep "^changelog: " | \
40 sed "s/changelog: //g")
41 if [[ -z "$output" ]]; then
42 echo "ERROR: PR body must contain 'changelog: ...'"
44 elif [[ "$output" = "none" ]]; then
45 echo "WARNING: changelog is 'none'"
48 PYTHONIOENCODING: 'utf-8'
53 os: [ubuntu-latest, windows-latest, macos-latest]
54 host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
57 host: x86_64-apple-darwin
59 host: x86_64-pc-windows-msvc
61 host: x86_64-unknown-linux-gnu
63 host: i686-unknown-linux-gnu
65 host: x86_64-pc-windows-msvc
67 host: x86_64-unknown-linux-gnu
69 host: i686-unknown-linux-gnu
71 host: x86_64-apple-darwin
73 runs-on: ${{ matrix.os }}
77 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
79 github_token: "${{ secrets.github_token }}"
81 - name: Install dependencies (Linux-i686)
83 sudo dpkg --add-architecture i386
85 sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
86 if: matrix.host == 'i686-unknown-linux-gnu'
89 uses: actions/checkout@v2.3.3
91 - name: Install toolchain
92 run: rustup show active-toolchain
95 - name: Set LD_LIBRARY_PATH (Linux)
96 if: runner.os == 'Linux'
98 SYSROOT=$(rustc --print sysroot)
99 echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
100 - name: Link rustc dylib (MacOS)
101 if: runner.os == 'macOS'
103 SYSROOT=$(rustc --print sysroot)
104 sudo mkdir -p /usr/local/lib
105 sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
106 - name: Set PATH (Windows)
107 if: runner.os == 'Windows'
109 SYSROOT=$(rustc --print sysroot)
110 echo "$SYSROOT/bin" >> $GITHUB_PATH
113 run: cargo build --features deny-warnings,internal-lints
116 run: cargo test --features deny-warnings,internal-lints
118 - name: Test clippy_lints
119 run: cargo test --features deny-warnings,internal-lints
120 working-directory: clippy_lints
122 - name: Test rustc_tools_util
123 run: cargo test --features deny-warnings
124 working-directory: rustc_tools_util
126 - name: Test clippy_dev
127 run: cargo test --features deny-warnings
128 working-directory: clippy_dev
130 - name: Test cargo-clippy
131 run: ../target/debug/cargo-clippy
132 working-directory: clippy_workspace_tests
134 - name: Test clippy-driver
135 run: bash .github/driver.sh
141 runs-on: ubuntu-latest
145 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
147 github_token: "${{ secrets.github_token }}"
150 uses: actions/checkout@v2.3.3
152 - name: Install toolchain
153 run: rustup show active-toolchain
156 - name: Build Integration Test
157 run: cargo test --test integration --features integration --no-run
160 - name: Extract Binaries
162 DIR=$CARGO_TARGET_DIR/debug
163 rm $DIR/deps/integration-*.d
164 mv $DIR/deps/integration-* $DIR/integration
165 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
166 rm -rf $CARGO_TARGET_DIR/release
168 - name: Upload Binaries
169 uses: actions/upload-artifact@v1
175 needs: integration_build
182 # FIXME: re-enable once fmt_macros is renamed in RLS
185 - 'rust-lang/rustfmt'
188 - 'rust-lang/stdarch'
190 # FIXME: chrono currently cannot be compiled with `--all-targets`
191 # - 'chronotope/chrono'
194 - 'rust-lang/futures-rs'
195 - 'rust-itertools/itertools'
196 - 'rust-lang-nursery/failure'
199 runs-on: ubuntu-latest
203 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
205 github_token: "${{ secrets.github_token }}"
208 uses: actions/checkout@v2.3.3
210 - name: Install toolchain
211 run: rustup show active-toolchain
214 - name: Download target dir
215 uses: actions/download-artifact@v1
220 - name: Make Binaries Executable
221 run: chmod +x $CARGO_TARGET_DIR/debug/*
224 - name: Test ${{ matrix.integration }}
226 RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | grep -o -E "nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}")" \
227 $CARGO_TARGET_DIR/debug/integration
229 INTEGRATION: ${{ matrix.integration }}
231 # These jobs doesn't actually test anything, but they're only used to tell
232 # bors the build completed, as there is no practical way to detect when a
233 # workflow is successful listening to webhooks only.
235 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
238 name: bors test finished
239 if: github.event.pusher.name == 'bors' && success()
240 runs-on: ubuntu-latest
241 needs: [changelog, base, integration_build, integration]
244 - name: Mark the job as successful
248 name: bors test finished
249 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
250 runs-on: ubuntu-latest
251 needs: [changelog, base, integration_build, integration]
254 - name: Mark the job as a failure