From 1ac1a4f4958159d37f8435facf1821374312a6f7 Mon Sep 17 00:00:00 2001 From: Philipp Eder Date: Mon, 11 Nov 2024 11:05:29 +0100 Subject: [PATCH] Seperates linting/Rust into linting/{Rust, Rust-Typos, Rust-Audit} Given the nature of using NASL to identify vulnerabilities we may cannot get rif of all audit findings. To indicate that the CI fails based on an audit, rather than e.g. a clippy warning, cargo audit is seperated into an own job. Since the same may be true for typos, typos are seperated into an own job as well. With that change we can immediately see if a CI of a PR failed because of audit, typos or Rust linting issues. --- .github/actions/setup-rust/action.yml | 12 +++++++++++ .github/workflows/linting.yml | 30 ++++++++++++++++++--------- 2 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 .github/actions/setup-rust/action.yml diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml new file mode 100644 index 000000000..be188d042 --- /dev/null +++ b/.github/actions/setup-rust/action.yml @@ -0,0 +1,12 @@ +name: "Setup Rust Environment" +description: "Install necessary dependencies and set up Rust stable" +runs: + using: "composite" + steps: + - run: sudo apt update || true + shell: bash + - run: sudo apt-get install -y libpcap-dev + shell: bash + - run: rustup update stable && rustup default stable || rustup default stable + shell: bash + diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 6b4580f66..e882f604a 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -19,15 +19,25 @@ jobs: working-directory: rust steps: - uses: actions/checkout@v4 - - run: sudo apt update || true - - run: sudo apt-get install -y libpcap-dev - - run: rustup update stable && rustup default stable || rustup default stable - - run: cargo install cargo-audit + - uses: ./.github/actions/setup-rust + - run: cargo clippy -- -D warnings + - run: cargo fmt --check + Rust-Typos: + runs-on: ubuntu-latest + defaults: + run: + working-directory: rust + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-rust - run: cargo install typos-cli - - name: Clippy - run: cargo clippy -- -D warnings - - name: Audit - run: cargo audit - run: typos - - name: Formatting - run: cargo fmt --check + Rust-Audit: + runs-on: ubuntu-latest + defaults: + run: + working-directory: rust + steps: + - uses: actions/checkout@v4 + - run: cargo install cargo-audit + - run: cargo audit