Skip to content

Commit 62ee7b5

Browse files
committed
Update Clippy
1 parent bfaf48b commit 62ee7b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1278
-372
lines changed

.github/deploy.sh

100755100644
Lines changed: 13 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,39 @@
11
#!/bin/bash
22

3-
# Automatically deploy on gh-pages
4-
53
set -ex
64

7-
SOURCE_BRANCH="master"
8-
TARGET_BRANCH="gh-pages"
9-
10-
# Save some useful information
11-
REPO=$(git config remote.origin.url)
12-
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
13-
SHA=$(git rev-parse --verify HEAD)
14-
15-
# Clone the existing gh-pages for this repo into out/
16-
git clone --quiet --single-branch --branch "$TARGET_BRANCH" "$REPO" out
17-
185
echo "Removing the current docs for master"
196
rm -rf out/master/ || exit 0
207

218
echo "Making the docs for master"
229
mkdir out/master/
2310
cp util/gh-pages/index.html out/master
24-
python ./util/export.py out/master/lints.json
11+
python3 ./util/export.py out/master/lints.json
2512

26-
if [[ -n "$TRAVIS_TAG" ]]; then
27-
echo "Save the doc for the current tag ($TRAVIS_TAG) and point current/ to it"
28-
cp -r out/master "out/$TRAVIS_TAG"
29-
rm -f out/current
30-
ln -s "$TRAVIS_TAG" out/current
13+
if [[ -n $TAG_NAME ]]; then
14+
echo "Save the doc for the current tag ($TAG_NAME) and point stable/ to it"
15+
cp -r out/master "out/$TAG_NAME"
16+
rm -f out/stable
17+
ln -s "$TAG_NAME" out/stable
3118
fi
3219

3320
# Generate version index that is shown as root index page
3421
cp util/gh-pages/versions.html out/index.html
35-
pushd out
36-
37-
cat <<-EOF | python - > versions.json
38-
import os, json
39-
print json.dumps([
40-
dir for dir in os.listdir(".") if not dir.startswith(".") and os.path.isdir(dir)
41-
])
42-
EOF
43-
popd
4422

45-
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
46-
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]] || [[ "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]]; then
47-
# Tags should deploy
48-
if [[ -z "$TRAVIS_TAG" ]]; then
49-
echo "Generated, won't push"
50-
exit 0
51-
fi
52-
fi
23+
echo "Making the versions.json file"
24+
python3 ./util/versions.py out
5325

54-
# Now let's go have some fun with the cloned repo
5526
cd out
56-
git config user.name "Travis CI"
57-
git config user.email "travis@ci.invalid"
27+
# Now let's go have some fun with the cloned repo
28+
git config user.name "GHA CI"
29+
git config user.email "gha@ci.invalid"
5830

5931
if git diff --exit-code --quiet; then
60-
echo "No changes to the output on this push; exiting."
61-
exit 0
32+
echo "No changes to the output on this push; exiting."
33+
exit 0
6234
fi
63-
cd -
6435

65-
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
66-
ENCRYPTION_LABEL=e3a2d77100be
67-
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
68-
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
69-
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
70-
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
71-
openssl aes-256-cbc -K "$ENCRYPTED_KEY" -iv "$ENCRYPTED_IV" -in .github/deploy_key.enc -out .github/deploy_key -d
72-
chmod 600 .github/deploy_key
73-
eval "$(ssh-agent -s)"
74-
ssh-add .github/deploy_key
75-
76-
cd out
7736
git add .
7837
git commit -m "Automatic deploy to GitHub Pages: ${SHA}"
7938

80-
# Now that we're all set up, we can push.
8139
git push "$SSH_REPO" "$TARGET_BRANCH"

.github/driver.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# Check sysroot handling
6+
sysroot=$(./target/debug/clippy-driver --print sysroot)
7+
test "$sysroot" = "$(rustc --print sysroot)"
8+
9+
if [[ ${OS} == "Windows" ]]; then
10+
desired_sysroot=C:/tmp
11+
else
12+
desired_sysroot=/tmp
13+
fi
14+
sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot)
15+
test "$sysroot" = $desired_sysroot
16+
17+
sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot)
18+
test "$sysroot" = $desired_sysroot
19+
20+
# Make sure this isn't set - clippy-driver should cope without it
21+
unset CARGO_MANIFEST_DIR
22+
23+
# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
24+
# FIXME: How to match the clippy invocation in compile-test.rs?
25+
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1
26+
sed -e "s,tests/ui,\$DIR," -e "/= help/d" cstring.stderr > normalized.stderr
27+
diff normalized.stderr tests/ui/cstring.stderr
28+
29+
# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR

.github/workflows/clippy.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Clippy Test
2+
3+
on:
4+
push:
5+
# Ignore bors branches, since they are covered by `clippy_bors.yml`
6+
branches-ignore:
7+
- auto
8+
- try
9+
# Don't run Clippy tests, when only textfiles were modified
10+
paths-ignore:
11+
- 'COPYRIGHT'
12+
- 'LICENSE-*'
13+
- '**.md'
14+
- '**.txt'
15+
pull_request:
16+
# Don't run Clippy tests, when only textfiles were modified
17+
paths-ignore:
18+
- 'COPYRIGHT'
19+
- 'LICENSE-*'
20+
- '**.md'
21+
- '**.txt'
22+
23+
env:
24+
RUST_BACKTRACE: 1
25+
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
26+
NO_FMT_TEST: 1
27+
28+
jobs:
29+
base:
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
# Setup
34+
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
35+
with:
36+
github_token: "${{ secrets.github_token }}"
37+
38+
- name: rust-toolchain
39+
uses: actions-rs/toolchain@v1.0.3
40+
with:
41+
toolchain: nightly
42+
target: x86_64-unknown-linux-gnu
43+
profile: minimal
44+
45+
- name: Checkout
46+
uses: actions/checkout@v2.0.0
47+
48+
- name: Run cargo update
49+
run: cargo update
50+
51+
- name: Cache cargo dir
52+
uses: actions/cache@v1
53+
with:
54+
path: ~/.cargo
55+
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
56+
restore-keys: |
57+
${{ runner.os }}-x86_64-unknown-linux-gnu
58+
59+
- name: Master Toolchain Setup
60+
run: bash setup-toolchain.sh
61+
62+
# Run
63+
- name: Set LD_LIBRARY_PATH (Linux)
64+
run: |
65+
SYSROOT=$(rustc --print sysroot)
66+
echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
67+
68+
- name: Build
69+
run: cargo build --features deny-warnings
70+
71+
- name: Test
72+
run: cargo test --features deny-warnings
73+
74+
- name: Test clippy_lints
75+
run: cargo test --features deny-warnings
76+
working-directory: clippy_lints
77+
78+
- name: Test rustc_tools_util
79+
run: cargo test --features deny-warnings
80+
working-directory: rustc_tools_util
81+
82+
- name: Test clippy_dev
83+
run: cargo test --features deny-warnings
84+
working-directory: clippy_dev
85+
86+
- name: Test cargo-clippy
87+
run: ../target/debug/cargo-clippy
88+
working-directory: clippy_workspace_tests
89+
90+
- name: Test clippy-driver
91+
run: bash .github/driver.sh
92+
env:
93+
OS: ${{ runner.os }}
94+
95+
# Cleanup
96+
- name: Run cargo-cache --autoclean
97+
run: |
98+
cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
99+
cargo cache

0 commit comments

Comments
 (0)