diff options
Diffstat (limited to 'src/tools/clippy/.github')
-rw-r--r-- | src/tools/clippy/.github/ISSUE_TEMPLATE/blank_issue.yml | 44 | ||||
-rw-r--r-- | src/tools/clippy/.github/ISSUE_TEMPLATE/bug_report.yml | 57 | ||||
-rw-r--r-- | src/tools/clippy/.github/ISSUE_TEMPLATE/config.yml | 5 | ||||
-rw-r--r-- | src/tools/clippy/.github/ISSUE_TEMPLATE/false_negative.yml | 50 | ||||
-rw-r--r-- | src/tools/clippy/.github/ISSUE_TEMPLATE/false_positive.yml | 68 | ||||
-rw-r--r-- | src/tools/clippy/.github/ISSUE_TEMPLATE/ice.yml | 48 | ||||
-rw-r--r-- | src/tools/clippy/.github/ISSUE_TEMPLATE/new_lint.yml | 71 | ||||
-rw-r--r-- | src/tools/clippy/.github/PULL_REQUEST_TEMPLATE.md | 39 | ||||
-rw-r--r-- | src/tools/clippy/.github/deploy.sh | 67 | ||||
-rw-r--r-- | src/tools/clippy/.github/driver.sh | 39 | ||||
-rw-r--r-- | src/tools/clippy/.github/workflows/clippy.yml | 76 | ||||
-rw-r--r-- | src/tools/clippy/.github/workflows/clippy_bors.yml | 281 | ||||
-rw-r--r-- | src/tools/clippy/.github/workflows/clippy_dev.yml | 70 | ||||
-rw-r--r-- | src/tools/clippy/.github/workflows/deploy.yml | 64 | ||||
-rw-r--r-- | src/tools/clippy/.github/workflows/remark.yml | 66 |
15 files changed, 1045 insertions, 0 deletions
diff --git a/src/tools/clippy/.github/ISSUE_TEMPLATE/blank_issue.yml b/src/tools/clippy/.github/ISSUE_TEMPLATE/blank_issue.yml new file mode 100644 index 000000000..89884bfc8 --- /dev/null +++ b/src/tools/clippy/.github/ISSUE_TEMPLATE/blank_issue.yml @@ -0,0 +1,44 @@ +name: Blank Issue +description: Create a blank issue. +body: + - type: markdown + attributes: + value: Thank you for filing an issue! + - type: textarea + id: problem + attributes: + label: Description + description: > + Please provide a description of the issue, along with any information + you feel relevant to replicate it. + validations: + required: true + - type: textarea + id: version + attributes: + label: Version + description: "Rust version (`rustc -Vv`)" + placeholder: | + rustc 1.46.0-nightly (f455e46ea 2020-06-20) + binary: rustc + commit-hash: f455e46eae1a227d735091091144601b467e1565 + commit-date: 2020-06-20 + host: x86_64-unknown-linux-gnu + release: 1.46.0-nightly + LLVM version: 10.0 + render: text + - type: textarea + id: labels + attributes: + label: Additional Labels + description: > + Additional labels can be added to this issue by including the following + command + placeholder: | + @rustbot label +<label> + + Common labels for this issue type are: + * C-an-interesting-project + * C-enhancement + * C-question + * C-tracking-issue diff --git a/src/tools/clippy/.github/ISSUE_TEMPLATE/bug_report.yml b/src/tools/clippy/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..b6f70a7f1 --- /dev/null +++ b/src/tools/clippy/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,57 @@ +name: Bug Report +description: Create a bug report for Clippy +labels: ["C-bug"] +body: + - type: markdown + attributes: + value: Thank you for filing a bug report! 🐛 + - type: textarea + id: problem + attributes: + label: Summary + description: > + Please provide a short summary of the bug, along with any information + you feel relevant to replicate the bug. + validations: + required: true + - type: textarea + id: reproducer + attributes: + label: Reproducer + description: Please provide the code and steps to reproduce the bug + value: | + I tried this code: + + ```rust + <code> + ``` + + I expected to see this happen: + + Instead, this happened: + - type: textarea + id: version + attributes: + label: Version + description: "Rust version (`rustc -Vv`)" + placeholder: | + rustc 1.46.0-nightly (f455e46ea 2020-06-20) + binary: rustc + commit-hash: f455e46eae1a227d735091091144601b467e1565 + commit-date: 2020-06-20 + host: x86_64-unknown-linux-gnu + release: 1.46.0-nightly + LLVM version: 10.0 + render: text + - type: textarea + id: labels + attributes: + label: Additional Labels + description: > + Additional labels can be added to this issue by including the following + command + placeholder: | + @rustbot label +<label> + + Common labels for this issue type are: + * `I-suggestion-causes-error` diff --git a/src/tools/clippy/.github/ISSUE_TEMPLATE/config.yml b/src/tools/clippy/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..bd7dc0ac9 --- /dev/null +++ b/src/tools/clippy/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Rust Programming Language Forum + url: https://users.rust-lang.org + about: Please ask and answer questions about Rust here. diff --git a/src/tools/clippy/.github/ISSUE_TEMPLATE/false_negative.yml b/src/tools/clippy/.github/ISSUE_TEMPLATE/false_negative.yml new file mode 100644 index 000000000..25e436d30 --- /dev/null +++ b/src/tools/clippy/.github/ISSUE_TEMPLATE/false_negative.yml @@ -0,0 +1,50 @@ +name: Bug Report (False Negative) +description: Create a bug report about missing warnings from a lint +labels: ["C-bug", "I-false-negative"] +body: + - type: markdown + attributes: + value: Thank you for filing a bug report! 🐛 + - type: textarea + id: problem + attributes: + label: Summary + description: > + Please provide a short summary of the bug, along with any information + you feel relevant to replicate the bug. + validations: + required: true + - type: input + id: lint-name + attributes: + label: Lint Name + description: Please provide the lint name. + - type: textarea + id: reproducer + attributes: + label: Reproducer + description: Please provide the code and steps to reproduce the bug + value: | + I tried this code: + + ```rust + <code> + ``` + + I expected to see this happen: + + Instead, this happened: + - type: textarea + id: version + attributes: + label: Version + description: "Rust version (`rustc -Vv`)" + placeholder: | + rustc 1.46.0-nightly (f455e46ea 2020-06-20) + binary: rustc + commit-hash: f455e46eae1a227d735091091144601b467e1565 + commit-date: 2020-06-20 + host: x86_64-unknown-linux-gnu + release: 1.46.0-nightly + LLVM version: 10.0 + render: text diff --git a/src/tools/clippy/.github/ISSUE_TEMPLATE/false_positive.yml b/src/tools/clippy/.github/ISSUE_TEMPLATE/false_positive.yml new file mode 100644 index 000000000..561b65c93 --- /dev/null +++ b/src/tools/clippy/.github/ISSUE_TEMPLATE/false_positive.yml @@ -0,0 +1,68 @@ +name: Bug Report (False Positive) +description: Create a bug report about a wrongly emitted lint warning +labels: ["C-bug", "I-false-positive"] +body: + - type: markdown + attributes: + value: Thank you for filing a bug report! 🐛 + - type: textarea + id: problem + attributes: + label: Summary + description: > + Please provide a short summary of the bug, along with any information + you feel relevant to replicate the bug. + validations: + required: true + - type: input + id: lint-name + attributes: + label: Lint Name + description: Please provide the lint name. + - type: textarea + id: reproducer + attributes: + label: Reproducer + description: > + Please provide the code and steps to reproduce the bug together with the + output from Clippy. + value: | + I tried this code: + + ```rust + <code> + ``` + + I saw this happen: + + ``` + <output> + ``` + + I expected to see this happen: + - type: textarea + id: version + attributes: + label: Version + description: "Rust version (`rustc -Vv`)" + placeholder: | + rustc 1.46.0-nightly (f455e46ea 2020-06-20) + binary: rustc + commit-hash: f455e46eae1a227d735091091144601b467e1565 + commit-date: 2020-06-20 + host: x86_64-unknown-linux-gnu + release: 1.46.0-nightly + LLVM version: 10.0 + render: text + - type: textarea + id: labels + attributes: + label: Additional Labels + description: > + Additional labels can be added to this issue by including the following + command + placeholder: | + @rustbot label +<label> + + Common labels for this issue type are: + * `I-suggestion-causes-error` diff --git a/src/tools/clippy/.github/ISSUE_TEMPLATE/ice.yml b/src/tools/clippy/.github/ISSUE_TEMPLATE/ice.yml new file mode 100644 index 000000000..81bd9c5e0 --- /dev/null +++ b/src/tools/clippy/.github/ISSUE_TEMPLATE/ice.yml @@ -0,0 +1,48 @@ +name: Internal Compiler Error +description: Create a report for an internal compiler error (ICE) in Clippy. +labels: ["C-bug", "I-ICE"] +body: + - type: markdown + attributes: + value: Thank you for finding an Internal Compiler Error! 🧊 + - type: textarea + id: problem + attributes: + label: Summary + description: | + If possible, try to provide a minimal verifiable example. You can read ["Rust Bug Minimization Patterns"][mve] for how to create smaller examples. Otherwise, provide the crate where the ICE occurred. + + [mve]: http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/ + validations: + required: true + - type: textarea + id: version + attributes: + label: Version + description: "Rust version (`rustc -Vv`)" + placeholder: | + rustc 1.46.0-nightly (f455e46ea 2020-06-20) + binary: rustc + commit-hash: f455e46eae1a227d735091091144601b467e1565 + commit-date: 2020-06-20 + host: x86_64-unknown-linux-gnu + release: 1.46.0-nightly + LLVM version: 10.0 + render: text + - type: textarea + id: error + attributes: + label: Error output + description: > + Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in + your environment. E.g. `RUST_BACKTRACE=1 cargo clippy`. + value: | + <details><summary>Backtrace</summary> + <p> + + ``` + <backtrace> + ``` + + </p> + </details> diff --git a/src/tools/clippy/.github/ISSUE_TEMPLATE/new_lint.yml b/src/tools/clippy/.github/ISSUE_TEMPLATE/new_lint.yml new file mode 100644 index 000000000..0b43d8d70 --- /dev/null +++ b/src/tools/clippy/.github/ISSUE_TEMPLATE/new_lint.yml @@ -0,0 +1,71 @@ +name: New lint suggestion +description: Suggest a new Clippy lint. +labels: ["A-lint"] +body: + - type: markdown + attributes: + value: Thank you for your lint idea! + - type: textarea + id: what + attributes: + label: What it does + description: What does this lint do? + validations: + required: true + - type: input + id: lint-name + attributes: + label: Lint Name + description: Please provide the lint name. + - type: dropdown + id: category + attributes: + label: Category + description: > + What category should this lint go into? If you're unsure you can select + multiple categories. You can find a category description in the + `README`. + multiple: true + options: + - correctness + - suspicious + - style + - complexity + - perf + - pedantic + - restriction + - cargo + - type: textarea + id: advantage + attributes: + label: Advantage + description: > + What is the advantage of the recommended code over the original code? + placeholder: | + - Remove bounds check inserted by ... + - Remove the need to duplicate/store ... + - Remove typo ... + - type: textarea + id: drawbacks + attributes: + label: Drawbacks + description: What might be possible drawbacks of such a lint? + - type: textarea + id: example + attributes: + label: Example + description: > + Include a short example showing when the lint should trigger together + with the improved code. + value: | + ```rust + <code> + ``` + + Could be written as: + + ```rust + <code> + ``` + validations: + required: true diff --git a/src/tools/clippy/.github/PULL_REQUEST_TEMPLATE.md b/src/tools/clippy/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..9e49f6089 --- /dev/null +++ b/src/tools/clippy/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,39 @@ +Thank you for making Clippy better! + +We're collecting our changelog from pull request descriptions. +If your PR only includes internal changes, you can just write +`changelog: none`. Otherwise, please write a short comment +explaining your change. + +It's also helpful for us that the lint name is put within backticks (`` ` ` ``), +and then encapsulated by square brackets (`[]`), for example: +``` +changelog: [`lint_name`]: your change +``` + +If your PR fixes an issue, you can add `fixes #issue_number` into this +PR description. This way the issue will be automatically closed when +your PR is merged. + +If you added a new lint, here's a checklist for things that will be +checked during review or continuous integration. + +- \[ ] Followed [lint naming conventions][lint_naming] +- \[ ] Added passing UI tests (including committed `.stderr` file) +- \[ ] `cargo test` passes locally +- \[ ] Executed `cargo dev update_lints` +- \[ ] Added lint documentation +- \[ ] Run `cargo dev fmt` + +[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints + +Note that you can skip the above if you are just opening a WIP PR in +order to get feedback. + +Delete this line and everything above before opening your PR. + +--- + +*Please write a short comment explaining your change (or "none" for internal only changes)* + +changelog: diff --git a/src/tools/clippy/.github/deploy.sh b/src/tools/clippy/.github/deploy.sh new file mode 100644 index 000000000..5a59f94ec --- /dev/null +++ b/src/tools/clippy/.github/deploy.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +set -ex + +echo "Removing the current docs for master" +rm -rf out/master/ || exit 0 + +echo "Making the docs for master" +mkdir out/master/ +cp util/gh-pages/index.html out/master +cp util/gh-pages/script.js out/master +cp util/gh-pages/lints.json out/master + +if [[ -n $TAG_NAME ]]; then + echo "Save the doc for the current tag ($TAG_NAME) and point stable/ to it" + cp -Tr out/master "out/$TAG_NAME" + rm -f out/stable + ln -s "$TAG_NAME" out/stable +fi + +if [[ $BETA = "true" ]]; then + echo "Update documentation for the beta release" + cp -r out/master/* out/beta +fi + +# Generate version index that is shown as root index page +cp util/gh-pages/versions.html out/index.html + +echo "Making the versions.json file" +python3 ./util/versions.py out + +# Now let's go have some fun with the cloned repo +cd out +git config user.name "GHA CI" +git config user.email "gha@ci.invalid" + +if [[ -n $TAG_NAME ]]; then + # track files, so that the following check works + git add --intent-to-add "$TAG_NAME" + if git diff --exit-code --quiet -- $TAG_NAME/; then + echo "No changes to the output on this push; exiting." + exit 0 + fi + # Add the new dir + git add "$TAG_NAME" + # Update the symlink + git add stable + # Update versions file + git add versions.json + git commit -m "Add documentation for ${TAG_NAME} release: ${SHA}" +elif [[ $BETA = "true" ]]; then + if git diff --exit-code --quiet -- beta/; then + echo "No changes to the output on this push; exiting." + exit 0 + fi + git add beta + git commit -m "Automatic deploy to GitHub Pages (beta): ${SHA}" +else + if git diff --exit-code --quiet; then + echo "No changes to the output on this push; exiting." + exit 0 + fi + git add . + git commit -m "Automatic deploy to GitHub Pages: ${SHA}" +fi + +git push "$SSH_REPO" "$TARGET_BRANCH" diff --git a/src/tools/clippy/.github/driver.sh b/src/tools/clippy/.github/driver.sh new file mode 100644 index 000000000..6ff189fc8 --- /dev/null +++ b/src/tools/clippy/.github/driver.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -ex + +# Check sysroot handling +sysroot=$(./target/debug/clippy-driver --print sysroot) +test "$sysroot" = "$(rustc --print sysroot)" + +if [[ ${OS} == "Windows" ]]; then + desired_sysroot=C:/tmp +else + desired_sysroot=/tmp +fi +sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot) +test "$sysroot" = $desired_sysroot + +sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot) +test "$sysroot" = $desired_sysroot + +# Make sure this isn't set - clippy-driver should cope without it +unset CARGO_MANIFEST_DIR + +# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1 +# FIXME: How to match the clippy invocation in compile-test.rs? +./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/double_neg.rs 2>double_neg.stderr && exit 1 +sed -e "s,tests/ui,\$DIR," -e "/= help/d" double_neg.stderr >normalized.stderr +diff -u normalized.stderr tests/ui/double_neg.stderr + +# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same +SYSROOT=$(rustc --print sysroot) +diff -u <(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose) + +echo "fn main() {}" >target/driver_test.rs +# we can't run 2 rustcs on the same file at the same time +CLIPPY=$(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc) +RUSTC=$(rustc ./target/driver_test.rs) +diff -u <($CLIPPY) <($RUSTC) + +# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR diff --git a/src/tools/clippy/.github/workflows/clippy.yml b/src/tools/clippy/.github/workflows/clippy.yml new file mode 100644 index 000000000..0e27cc927 --- /dev/null +++ b/src/tools/clippy/.github/workflows/clippy.yml @@ -0,0 +1,76 @@ +name: Clippy Test + +on: + push: + # Ignore bors branches, since they are covered by `clippy_bors.yml` + branches-ignore: + - auto + - try + # Don't run Clippy tests, when only text files were modified + paths-ignore: + - 'COPYRIGHT' + - 'LICENSE-*' + - '**.md' + - '**.txt' + pull_request: + # Don't run Clippy tests, when only text files were modified + paths-ignore: + - 'COPYRIGHT' + - 'LICENSE-*' + - '**.md' + - '**.txt' + +env: + RUST_BACKTRACE: 1 + CARGO_TARGET_DIR: '${{ github.workspace }}/target' + NO_FMT_TEST: 1 + +jobs: + base: + # NOTE: If you modify this job, make sure you copy the changes to clippy_bors.yml + runs-on: ubuntu-latest + + steps: + # Setup + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" + + - name: Checkout + uses: actions/checkout@v3.0.2 + + - name: Install toolchain + run: rustup show active-toolchain + + # Run + - name: Set LD_LIBRARY_PATH (Linux) + run: | + SYSROOT=$(rustc --print sysroot) + echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV + + - name: Build + run: cargo build --features deny-warnings,internal + + - name: Test + run: cargo test --features deny-warnings,internal + + - name: Test clippy_lints + run: cargo test --features deny-warnings,internal + working-directory: clippy_lints + + - name: Test clippy_utils + run: cargo test --features deny-warnings,internal + working-directory: clippy_utils + + - name: Test rustc_tools_util + run: cargo test --features deny-warnings + working-directory: rustc_tools_util + + - name: Test clippy_dev + run: cargo test --features deny-warnings + working-directory: clippy_dev + + - name: Test clippy-driver + run: bash .github/driver.sh + env: + OS: ${{ runner.os }} diff --git a/src/tools/clippy/.github/workflows/clippy_bors.yml b/src/tools/clippy/.github/workflows/clippy_bors.yml new file mode 100644 index 000000000..97453303c --- /dev/null +++ b/src/tools/clippy/.github/workflows/clippy_bors.yml @@ -0,0 +1,281 @@ +name: Clippy Test (bors) + +on: + push: + branches: + - auto + - try + +env: + RUST_BACKTRACE: 1 + CARGO_TARGET_DIR: '${{ github.workspace }}/target' + NO_FMT_TEST: 1 + +defaults: + run: + shell: bash + +jobs: + changelog: + runs-on: ubuntu-latest + + steps: + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" + + - name: Checkout + uses: actions/checkout@v3.0.2 + with: + ref: ${{ github.ref }} + + # Run + - name: Check Changelog + run: | + MESSAGE=$(git log --format=%B -n 1) + PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//') + body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \ + python -c "import sys, json; print(json.load(sys.stdin)['body'])") + output=$(grep "^changelog:\s*\S" <<< "$body" | sed "s/changelog:\s*//g") || { + echo "ERROR: PR body must contain 'changelog: ...'" + exit 1 + } + if [[ "$output" = "none" ]]; then + echo "WARNING: changelog is 'none'" + else + echo "changelog: $output" + fi + env: + PYTHONIOENCODING: 'utf-8' + base: + needs: changelog + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc] + exclude: + - os: ubuntu-latest + host: x86_64-apple-darwin + - os: ubuntu-latest + host: x86_64-pc-windows-msvc + - os: macos-latest + host: x86_64-unknown-linux-gnu + - os: macos-latest + host: i686-unknown-linux-gnu + - os: macos-latest + host: x86_64-pc-windows-msvc + - os: windows-latest + host: x86_64-unknown-linux-gnu + - os: windows-latest + host: i686-unknown-linux-gnu + - os: windows-latest + host: x86_64-apple-darwin + + runs-on: ${{ matrix.os }} + + # NOTE: If you modify this job, make sure you copy the changes to clippy.yml + steps: + # Setup + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" + + - name: Install dependencies (Linux-i686) + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386 + if: matrix.host == 'i686-unknown-linux-gnu' + + - name: Checkout + uses: actions/checkout@v3.0.2 + + - name: Install toolchain + run: rustup show active-toolchain + + # Run + - name: Set LD_LIBRARY_PATH (Linux) + if: runner.os == 'Linux' + run: | + SYSROOT=$(rustc --print sysroot) + echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV + - name: Link rustc dylib (MacOS) + if: runner.os == 'macOS' + run: | + SYSROOT=$(rustc --print sysroot) + sudo mkdir -p /usr/local/lib + sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \; + - name: Set PATH (Windows) + if: runner.os == 'Windows' + run: | + SYSROOT=$(rustc --print sysroot) + echo "$SYSROOT/bin" >> $GITHUB_PATH + + - name: Build + run: cargo build --features deny-warnings,internal + + - name: Test + if: runner.os == 'Linux' + run: cargo test --features deny-warnings,internal + + - name: Test + if: runner.os != 'Linux' + run: cargo test --features deny-warnings,internal -- --skip dogfood + + - name: Test clippy_lints + run: cargo test --features deny-warnings,internal + working-directory: clippy_lints + + - name: Test clippy_utils + run: cargo test --features deny-warnings,internal + working-directory: clippy_utils + + - name: Test rustc_tools_util + run: cargo test --features deny-warnings + working-directory: rustc_tools_util + + - name: Test clippy_dev + run: cargo test --features deny-warnings + working-directory: clippy_dev + + - name: Test clippy-driver + run: bash .github/driver.sh + env: + OS: ${{ runner.os }} + + metadata_collection: + needs: changelog + runs-on: ubuntu-latest + + steps: + # Setup + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" + + - name: Checkout + uses: actions/checkout@v3.0.2 + + - name: Install toolchain + run: rustup show active-toolchain + + - name: Test metadata collection + run: cargo collect-metadata + + integration_build: + needs: changelog + runs-on: ubuntu-latest + + steps: + # Setup + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" + + - name: Checkout + uses: actions/checkout@v3.0.2 + + - name: Install toolchain + run: rustup show active-toolchain + + # Run + - name: Build Integration Test + run: cargo test --test integration --features integration --no-run + + # Upload + - name: Extract Binaries + run: | + DIR=$CARGO_TARGET_DIR/debug + rm $DIR/deps/integration-*.d + mv $DIR/deps/integration-* $DIR/integration + find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf + rm -rf $CARGO_TARGET_DIR/release + + - name: Upload Binaries + uses: actions/upload-artifact@v1 + with: + name: target + path: target + + integration: + needs: integration_build + strategy: + fail-fast: false + max-parallel: 6 + matrix: + integration: + - 'rust-lang/cargo' + # FIXME: re-enable once fmt_macros is renamed in RLS + # - 'rust-lang/rls' + - 'rust-lang/chalk' + - 'rust-lang/rustfmt' + - 'Marwes/combine' + - 'Geal/nom' + - 'rust-lang/stdarch' + - 'serde-rs/serde' + # FIXME: chrono currently cannot be compiled with `--all-targets` + # - 'chronotope/chrono' + - 'hyperium/hyper' + - 'rust-random/rand' + - 'rust-lang/futures-rs' + - 'rust-itertools/itertools' + - 'rust-lang-nursery/failure' + - 'rust-lang/log' + + runs-on: ubuntu-latest + + steps: + # Setup + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" + + - name: Checkout + uses: actions/checkout@v3.0.2 + + - name: Install toolchain + run: rustup show active-toolchain + + # Download + - name: Download target dir + uses: actions/download-artifact@v1 + with: + name: target + path: target + + - name: Make Binaries Executable + run: chmod +x $CARGO_TARGET_DIR/debug/* + + # Run + - name: Test ${{ matrix.integration }} + run: | + RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | grep -o -E "nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}")" \ + $CARGO_TARGET_DIR/debug/integration + env: + INTEGRATION: ${{ matrix.integration }} + + # These jobs doesn't actually test anything, but they're only used to tell + # bors the build completed, as there is no practical way to detect when a + # workflow is successful listening to webhooks only. + # + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! + + end-success: + name: bors test finished + if: github.event.pusher.name == 'bors' && success() + runs-on: ubuntu-latest + needs: [changelog, base, metadata_collection, integration_build, integration] + + steps: + - name: Mark the job as successful + run: exit 0 + + end-failure: + name: bors test finished + if: github.event.pusher.name == 'bors' && (failure() || cancelled()) + runs-on: ubuntu-latest + needs: [changelog, base, metadata_collection, integration_build, integration] + + steps: + - name: Mark the job as a failure + run: exit 1 diff --git a/src/tools/clippy/.github/workflows/clippy_dev.yml b/src/tools/clippy/.github/workflows/clippy_dev.yml new file mode 100644 index 000000000..22051093c --- /dev/null +++ b/src/tools/clippy/.github/workflows/clippy_dev.yml @@ -0,0 +1,70 @@ +name: Clippy Dev Test + +on: + push: + branches: + - auto + - try + pull_request: + # Only run on paths, that get checked by the clippy_dev tool + paths: + - 'CHANGELOG.md' + - 'README.md' + - '**.stderr' + - '**.rs' + +env: + RUST_BACKTRACE: 1 + +jobs: + clippy_dev: + runs-on: ubuntu-latest + + steps: + # Setup + - name: Checkout + uses: actions/checkout@v3.0.2 + + # Run + - name: Build + run: cargo build --features deny-warnings + working-directory: clippy_dev + + - name: Test update_lints + run: cargo dev update_lints --check + + - name: Test fmt + run: cargo dev fmt --check + + - name: Test cargo dev new lint + run: | + cargo dev new_lint --name new_early_pass --pass early + cargo dev new_lint --name new_late_pass --pass late + cargo check + git reset --hard HEAD + + # These jobs doesn't actually test anything, but they're only used to tell + # bors the build completed, as there is no practical way to detect when a + # workflow is successful listening to webhooks only. + # + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! + + end-success: + name: bors dev test finished + if: github.event.pusher.name == 'bors' && success() + runs-on: ubuntu-latest + needs: [clippy_dev] + + steps: + - name: Mark the job as successful + run: exit 0 + + end-failure: + name: bors dev test finished + if: github.event.pusher.name == 'bors' && (failure() || cancelled()) + runs-on: ubuntu-latest + needs: [clippy_dev] + + steps: + - name: Mark the job as a failure + run: exit 1 diff --git a/src/tools/clippy/.github/workflows/deploy.yml b/src/tools/clippy/.github/workflows/deploy.yml new file mode 100644 index 000000000..71d71d103 --- /dev/null +++ b/src/tools/clippy/.github/workflows/deploy.yml @@ -0,0 +1,64 @@ +name: Deploy + +on: + push: + branches: + - master + - beta + tags: + - rust-1.** + +env: + TARGET_BRANCH: 'gh-pages' + SHA: '${{ github.sha }}' + SSH_REPO: 'git@github.com:${{ github.repository }}.git' + +jobs: + deploy: + runs-on: ubuntu-latest + if: github.repository == 'rust-lang/rust-clippy' + + steps: + # Setup + - name: Checkout + uses: actions/checkout@v3.0.2 + + - name: Checkout + uses: actions/checkout@v3.0.2 + with: + ref: ${{ env.TARGET_BRANCH }} + path: 'out' + + # Run + - name: Set tag name + if: startswith(github.ref, 'refs/tags/') + run: | + TAG=$(basename ${{ github.ref }}) + echo "TAG_NAME=$TAG" >> $GITHUB_ENV + - name: Set beta to true + if: github.ref == 'refs/heads/beta' + run: echo "BETA=true" >> $GITHUB_ENV + + # We need to check out all files that (transitively) depend on the + # structure of the gh-pages branch, so that we're able to change that + # structure without breaking the deployment. + - name: Use deploy files from master branch + run: | + git fetch --no-tags --prune --depth=1 origin master + git checkout origin/master -- .github/deploy.sh util/versions.py util/gh-pages/versions.html + + # Generate lockfile for caching to avoid build problems with cached deps + - name: cargo generate-lockfile + run: cargo generate-lockfile + + - name: Cache + uses: Swatinem/rust-cache@v1.3.0 + + - name: cargo collect-metadata + run: cargo collect-metadata + + - name: Deploy + run: | + eval "$(ssh-agent -s)" + ssh-add - <<< "${{ secrets.DEPLOY_KEY }}" + bash .github/deploy.sh diff --git a/src/tools/clippy/.github/workflows/remark.yml b/src/tools/clippy/.github/workflows/remark.yml new file mode 100644 index 000000000..81ef072bb --- /dev/null +++ b/src/tools/clippy/.github/workflows/remark.yml @@ -0,0 +1,66 @@ +name: Remark + +on: + push: + branches: + - auto + - try + pull_request: + paths: + - '**.md' + +jobs: + remark: + runs-on: ubuntu-latest + + steps: + # Setup + - name: Checkout + uses: actions/checkout@v3.0.2 + + - name: Setup Node.js + uses: actions/setup-node@v1.4.4 + with: + node-version: '14.x' + + - name: Install remark + run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended remark-gfm + + - name: Install mdbook + run: | + mkdir mdbook + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.18/mdbook-v0.4.18-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH + + # Run + - name: Check *.md files + run: git ls-files -z '*.md' | xargs -0 -n 1 -I {} ./node_modules/.bin/remark {} -u lint -f > /dev/null + + - name: Build mdbook + run: mdbook build book + + # These jobs doesn't actually test anything, but they're only used to tell + # bors the build completed, as there is no practical way to detect when a + # workflow is successful listening to webhooks only. + # + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! + + end-success: + name: bors remark test finished + if: github.event.pusher.name == 'bors' && success() + runs-on: ubuntu-latest + needs: [remark] + + steps: + - name: Mark the job as successful + run: exit 0 + + end-failure: + name: bors remark test finished + if: github.event.pusher.name == 'bors' && (failure() || cancelled()) + runs-on: ubuntu-latest + needs: [remark] + + steps: + - name: Mark the job as a failure + run: exit 1 |