run clippy on CI

This commit is contained in:
Ralf Jung 2022-06-04 11:48:46 -04:00
parent 92c2e3c0bc
commit bd7f83dc37
2 changed files with 31 additions and 29 deletions

View File

@ -72,20 +72,10 @@ jobs:
shell: bash shell: bash
run: | run: |
if [[ ${{ github.event_name }} == 'schedule' ]]; then if [[ ${{ github.event_name }} == 'schedule' ]]; then
RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}') ./rustup-toolchain HEAD --host ${{ matrix.host_target }}
else else
RUSTC_HASH=$(< rust-version) ./rustup-toolchain "" --host ${{ matrix.host_target }}
fi fi
# We need a nightly cargo for parts of the cargo miri test suite.
rustup-toolchain-install-master \
-f \
-n master "$RUSTC_HASH" \
-c cargo \
-c rust-src \
-c rustc-dev \
-c llvm-tools \
--host ${{ matrix.host_target }}
rustup default master
- name: Show Rust version - name: Show Rust version
run: | run: |
@ -97,26 +87,35 @@ jobs:
run: bash ./ci.sh run: bash ./ci.sh
fmt: fmt:
name: check formatting (ignored by bors) name: formatting (ignored by bors)
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install latest nightly - name: Install latest nightly
uses: actions-rs/toolchain@v1 run: |
with: rustup toolchain install nightly --component rustfmt
toolchain: nightly rustup override set nightly
components: rustfmt - name: Formatting (miri, ui_test)
default: true run: cargo fmt --all --check
- name: Check formatting (miri) - name: Formatting (cargo-miri)
uses: actions-rs/cargo@v1 run: cargo fmt --manifest-path cargo-miri/Cargo.toml --all --check
with:
command: fmt clippy:
args: --all -- --check name: clippy (ignored by bors)
- name: Check formatting (cargo-miri) runs-on: ubuntu-latest
uses: actions-rs/cargo@v1 steps:
with: - uses: actions/checkout@v3
command: fmt - name: Install required toolchain
args: --manifest-path cargo-miri/Cargo.toml --all -- --check # We need a toolchain that can actually build Miri, just a nightly won't do.
run: |
cargo install rustup-toolchain-install-master # TODO: cache this?
./rustup-toolchain "" -c clippy
- name: Clippy (miri)
run: cargo clippy --all-targets -- -D warnings
#- name: Clippy (ui_test)
# run: cargo clippy --manifest-path ui_test/Cargo.toml --all-targets -- -D warnings
- name: Clippy (cargo-miri)
run: cargo clippy --manifest-path cargo-miri/Cargo.toml --all-targets -- -D warnings
# These jobs doesn't actually test anything, but they're only used to tell # 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 # bors the build completed, as there is no practical way to detect when a

View File

@ -12,6 +12,8 @@ set -e
# ./rustup-toolchain HEAD: Update "miri" toolchain and `rust-version` file to latest rustc HEAD. # ./rustup-toolchain HEAD: Update "miri" toolchain and `rust-version` file to latest rustc HEAD.
# #
# ./rustup-toolchain $COMMIT: Update "miri" toolchain and `rust-version` file to match that commit. # ./rustup-toolchain $COMMIT: Update "miri" toolchain and `rust-version` file to match that commit.
#
# Any extra parameters are passed to `rustup-toolchain-install-master`.
# Make sure rustup-toolchain-install-master is installed. # Make sure rustup-toolchain-install-master is installed.
if ! which rustup-toolchain-install-master >/dev/null; then if ! which rustup-toolchain-install-master >/dev/null; then
@ -28,6 +30,7 @@ else
NEW_COMMIT="$1" NEW_COMMIT="$1"
fi fi
echo "$NEW_COMMIT" > rust-version echo "$NEW_COMMIT" > rust-version
shift
# Check if we already are at that commit. # Check if we already are at that commit.
CUR_COMMIT=$(rustc +miri --version -v 2>/dev/null | egrep "^commit-hash: " | cut -d " " -f 2) CUR_COMMIT=$(rustc +miri --version -v 2>/dev/null | egrep "^commit-hash: " | cut -d " " -f 2)
@ -39,7 +42,7 @@ fi
# Install and setup new toolchain. # Install and setup new toolchain.
rustup toolchain uninstall miri rustup toolchain uninstall miri
rustup-toolchain-install-master -n miri -c cargo -c rust-src -c rustc-dev -c llvm-tools -- "$NEW_COMMIT" rustup-toolchain-install-master -n miri -c cargo -c rust-src -c rustc-dev -c llvm-tools "$@" -- "$NEW_COMMIT"
rustup override set miri rustup override set miri
# Cleanup. # Cleanup.