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
115 - name: Test Workspace
116 run: cargo test --all --features deny-warnings,internal-lints
118 - name: Test clippy_dev
119 run: cargo test --features deny-warnings
120 working-directory: clippy_dev
122 - name: Test cargo-clippy
123 run: ../target/debug/cargo-clippy
124 working-directory: clippy_workspace_tests
126 - name: Test clippy-driver
127 run: bash .github/driver.sh
133 runs-on: ubuntu-latest
137 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
139 github_token: "${{ secrets.github_token }}"
142 uses: actions/checkout@v2.3.3
144 - name: Install toolchain
145 run: rustup show active-toolchain
148 - name: Build Integration Test
149 run: cargo test --test integration --features integration --no-run
152 - name: Extract Binaries
154 DIR=$CARGO_TARGET_DIR/debug
155 rm $DIR/deps/integration-*.d
156 mv $DIR/deps/integration-* $DIR/integration
157 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
158 rm -rf $CARGO_TARGET_DIR/release
160 - name: Upload Binaries
161 uses: actions/upload-artifact@v1
167 needs: integration_build
174 # FIXME: re-enable once fmt_macros is renamed in RLS
177 - 'rust-lang/rustfmt'
180 - 'rust-lang/stdarch'
182 # FIXME: chrono currently cannot be compiled with `--all-targets`
183 # - 'chronotope/chrono'
186 - 'rust-lang/futures-rs'
187 - 'rust-itertools/itertools'
188 - 'rust-lang-nursery/failure'
191 runs-on: ubuntu-latest
195 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
197 github_token: "${{ secrets.github_token }}"
200 uses: actions/checkout@v2.3.3
202 - name: Install toolchain
203 run: rustup show active-toolchain
206 - name: Download target dir
207 uses: actions/download-artifact@v1
212 - name: Make Binaries Executable
213 run: chmod +x $CARGO_TARGET_DIR/debug/*
216 - name: Test ${{ matrix.integration }}
218 RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | grep -o -E "nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}")" \
219 $CARGO_TARGET_DIR/debug/integration
221 INTEGRATION: ${{ matrix.integration }}
223 # These jobs doesn't actually test anything, but they're only used to tell
224 # bors the build completed, as there is no practical way to detect when a
225 # workflow is successful listening to webhooks only.
227 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
230 name: bors test finished
231 if: github.event.pusher.name == 'bors' && success()
232 runs-on: ubuntu-latest
233 needs: [changelog, base, integration_build, integration]
236 - name: Mark the job as successful
240 name: bors test finished
241 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
242 runs-on: ubuntu-latest
243 needs: [changelog, base, integration_build, integration]
246 - name: Mark the job as a failure