From ab4cf4e9290419d8bbb793724256a1a9c439e038 Mon Sep 17 00:00:00 2001 From: Anton Baliasnikov Date: Thu, 20 Jun 2024 12:37:24 +0100 Subject: [PATCH] feat: add broader cargo checks - udeps, audit, fmt, clippy --- .github/actions/cargo-check/action.yml | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/actions/cargo-check/action.yml diff --git a/.github/actions/cargo-check/action.yml b/.github/actions/cargo-check/action.yml new file mode 100644 index 0000000..d14339a --- /dev/null +++ b/.github/actions/cargo-check/action.yml @@ -0,0 +1,41 @@ +name: 'Cargo check' +description: 'Checks cargo with check, deny, format, clippy, udeps and audit.' + +inputs: + github_token: + description: 'GitHub token for cargo audit.' + required: true + +runs: + using: composite + steps: + + - name: Install rustc nightly + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} + run: rustup toolchain install nightly + + - name: Cargo deny + uses: EmbarkStudios/cargo-deny-action@v1 + + - name: Cargo check + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} + run: cargo check --verbose + + - name: Cargo format + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} + run: cargo fmt --all -- --check --verbose + + - name: Cargo clippy + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} + run: cargo clippy + + - name: Cargo udeps + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} + run: | + cargo install cargo-udeps + cargo +nightly udeps --all-targets + + - name: Cargo audit + uses: rustsec/audit-check@v1.4.1 + with: + token: ${{ inputs.github_token }}