1 name: Clippy Test (bors)
6 # Don't run tests, when only textfiles were modified
15 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 }}"
27 uses: actions/checkout@v2.0.0
29 ref: ${{ github.ref }}
30 - name: Check Changelog
32 MESSAGE=$(git log --format=%B -n 1)
33 PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
34 output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
35 python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
36 grep "^changelog: " | \
37 sed "s/changelog: //g")
38 if [[ -z "$output" ]]; then
39 echo "ERROR: PR body must contain 'changelog: ...'"
41 elif [[ "$output" = "none" ]]; then
42 echo "WARNING: changelog is 'none'"
45 PYTHONIOENCODING: 'utf-8'
50 os: [ubuntu-latest, windows-latest, macos-latest]
51 host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
54 host: x86_64-apple-darwin
56 host: x86_64-pc-windows-msvc
58 host: x86_64-unknown-linux-gnu
60 host: i686-unknown-linux-gnu
62 host: x86_64-pc-windows-msvc
64 host: x86_64-unknown-linux-gnu
66 host: i686-unknown-linux-gnu
68 host: x86_64-apple-darwin
70 runs-on: ${{ matrix.os }}
73 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
75 github_token: "${{ secrets.github_token }}"
76 - name: Install dependencies (Linux-i686)
78 sudo dpkg --add-architecture i386
80 sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
81 if: matrix.host == 'i686-unknown-linux-gnu'
82 - name: rust-toolchain
83 uses: actions-rs/toolchain@v1.0.3
86 target: ${{ matrix.host }}
88 - name: Cache cargo dir
89 uses: actions/cache@v1
92 key: ${{ runner.os }}-${{ matrix.host }}
94 uses: actions/checkout@v2.0.0
95 - name: Master Toolchain Setup
96 run: bash setup-toolchain.sh
98 HOST_TOOLCHAIN: ${{ matrix.host }}
101 - name: Set LD_LIBRARY_PATH (Linux)
102 if: runner.os == 'Linux'
104 SYSROOT=$(rustc --print sysroot)
105 echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
106 - name: Link rustc dylib (MacOS)
107 if: runner.os == 'macOS'
109 SYSROOT=$(rustc --print sysroot)
110 sudo mkdir -p /usr/local/lib
111 sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
112 - name: Set PATH (Windows)
113 if: runner.os == 'Windows'
115 $sysroot = rustc --print sysroot
116 $env:PATH += ';' + $sysroot + '\bin'
117 echo "::set-env name=PATH::$env:PATH"
119 run: cargo build --features deny-warnings
122 run: cargo test --features deny-warnings
124 - name: Test clippy_lints
125 run: cargo test --features deny-warnings
127 working-directory: clippy_lints
128 - name: Test rustc_tools_util
129 run: cargo test --features deny-warnings
131 working-directory: rustc_tools_util
132 - name: Test clippy_dev
133 run: cargo test --features deny-warnings
135 working-directory: clippy_dev
136 - name: Test cargo-clippy
137 run: ../target/debug/cargo-clippy
139 working-directory: clippy_workspace_tests
140 - name: Test clippy-driver
141 run: bash .github/driver.sh
146 - name: Run cargo-cache --autoclean
148 cargo install cargo-cache --debug
149 /usr/bin/find ~/.cargo/bin ! -type d -exec strip {} \;
150 cargo cache --autoclean
154 runs-on: ubuntu-latest
157 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
159 github_token: "${{ secrets.github_token }}"
160 - name: rust-toolchain
161 uses: actions-rs/toolchain@v1.0.3
164 target: x86_64-unknown-linux-gnu
166 - name: Cache cargo dir
167 uses: actions/cache@v1
170 key: ${{ runner.os }}-x86_64-unknown-linux-gnu
172 uses: actions/checkout@v2.0.0
173 - name: Master Toolchain Setup
174 run: bash setup-toolchain.sh
176 - name: Build Integration Test
177 run: cargo test --test integration --features integration --no-run
178 - name: Extract Binaries
180 DIR=$CARGO_TARGET_DIR/debug
181 find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
182 mv $DIR/integration-* $DIR/integration
183 - name: Upload Binaries
184 uses: actions/upload-artifact@v1
189 - name: Run cargo-cache --autoclean
191 cargo install cargo-cache --debug
192 find ~/.cargo/bin ! -type d -exec strip {} \;
193 cargo cache --autoclean
195 needs: integration_build
204 - 'rust-lang/rustfmt'
207 - 'rust-lang/stdarch'
209 - 'chronotope/chrono'
212 - 'rust-lang/futures-rs'
213 - 'rust-itertools/itertools'
214 - 'rust-lang-nursery/failure'
217 runs-on: ubuntu-latest
220 - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
222 github_token: "${{ secrets.github_token }}"
223 - name: rust-toolchain
224 uses: actions-rs/toolchain@v1.0.3
227 target: x86_64-unknown-linux-gnu
229 - name: Cache cargo dir
230 uses: actions/cache@v1
233 key: ${{ runner.os }}-x86_64-unknown-linux-gnu
235 uses: actions/checkout@v2.0.0
236 - name: Master Toolchain Setup
237 run: bash setup-toolchain.sh
239 - name: Download target dir
240 uses: actions/download-artifact@v1
244 - name: Make Binaries Executable
245 run: chmod +x $CARGO_TARGET_DIR/debug/*
246 - name: Test ${{ matrix.integration }}
247 run: $CARGO_TARGET_DIR/debug/integration
249 INTEGRATION: ${{ matrix.integration }}
250 RUSTUP_TOOLCHAIN: master
252 - name: Run cargo-cache --autoclean
254 cargo install cargo-cache --debug
255 find ~/.cargo/bin ! -type d -exec strip {} \;
256 cargo cache --autoclean