From e647018408464d7c322a855f63c8a82db01bd41b Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Thu, 16 May 2024 13:44:28 -0400 Subject: [PATCH 1/2] Add clippy lint GitHub Actions CI Run `cargo clippy --all-targets --all-features` on Continuous Integration on every Pull Request and push to main. Adapted from https://doc.rust-lang.org/stable/clippy/continuous_integration/github_actions.html --- .github/workflows/lint.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..263d9c0 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +name: Clippy check + +on: + push: + branches: [ "main" ] + pull_request: + types: [ opened, reopened, synchronize ] + branches: [ "main" ] + +# Make sure CI fails on all warnings, including Clippy lints +env: + RUSTFLAGS: "-Dwarnings" + +jobs: + clippy_check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run Clippy + run: cargo clippy --all-targets --all-features From d14e2786a402057edc8113c0eec4499697e0f689 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Thu, 16 May 2024 13:48:49 -0400 Subject: [PATCH 2/2] Set CARGO_TERM_COLOR=always environment variable Colorize the terminal output in the GitHub Actions CI logs. --- .github/workflows/lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 263d9c0..e07c061 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,6 +9,7 @@ on: # Make sure CI fails on all warnings, including Clippy lints env: + CARGO_TERM_COLOR: always RUSTFLAGS: "-Dwarnings" jobs: @@ -18,6 +19,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - + - name: Run Clippy run: cargo clippy --all-targets --all-features