From 0baca5e9a54d3253e032b10827c03c9f3eac8e40 Mon Sep 17 00:00:00 2001 From: Mogyuchi Date: Thu, 15 Feb 2024 19:42:32 +0900 Subject: [PATCH] ci: add Clippy check workflow --- .github/actions/rust-info/action.yml | 17 +++++++++++++++++ .github/workflows/clippy-check.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/actions/rust-info/action.yml create mode 100644 .github/workflows/clippy-check.yml diff --git a/.github/actions/rust-info/action.yml b/.github/actions/rust-info/action.yml new file mode 100644 index 0000000..9aa840b --- /dev/null +++ b/.github/actions/rust-info/action.yml @@ -0,0 +1,17 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-action.json + +name: rust info +description: get rust info + +outputs: + host: + description: host "x86_64-unknown-linux-gnu" + value: ${{steps.rustc.outputs.host}} + +runs: + using: composite + steps: + - id: rustc + run: | + echo "host=$(rustc -vV | awk '/host/ { print $2 }')" >> $GITHUB_OUTPUT + shell: bash diff --git a/.github/workflows/clippy-check.yml b/.github/workflows/clippy-check.yml new file mode 100644 index 0000000..ace0988 --- /dev/null +++ b/.github/workflows/clippy-check.yml @@ -0,0 +1,27 @@ +name: Clippy check + +on: + push: + branches: ["**"] + +env: + RUSTFLAGS: "-Dwarnings" + +permissions: {} + +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # master + with: + toolchain: stable + components: clippy + - id: rustc + uses: ./.github/actions/rust-info + - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + with: + key: ${{ steps.rustc.outputs.host }} + - name: Run Clippy + run: cargo clippy --all-targets --all-features