From fb9d6773b6be848715d0894237b94f7b48a33939 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 22 Dec 2025 10:06:42 +0100 Subject: [PATCH] ci: Deduplicate checks and tests --- .github/workflows/build.yml | 116 ----------------------- .github/workflows/pr_security-checks.yml | 59 ++++++++++++ .pre-commit-config.yaml | 24 +++++ 3 files changed, 83 insertions(+), 116 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/pr_security-checks.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 06626cbb8..000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,116 +0,0 @@ ---- -name: Stackable Build Pipeline - -on: - push: - branches: - - main - - staging - - trying - - "renovate/**" - tags: - - "*" - pull_request: - merge_group: - -env: - CARGO_TERM_COLOR: always - CARGO_INCREMENTAL: "0" - CARGO_PROFILE_DEV_DEBUG: "0" - RUST_TOOLCHAIN_VERSION: "1.89.0" - RUSTFLAGS: "-D warnings" - RUSTDOCFLAGS: "-D warnings" - RUST_LOG: "info" - -permissions: {} - -jobs: - # Identify unused dependencies - run_udeps: - name: Run Cargo Udeps - runs-on: ubuntu-latest - env: - RUSTC_BOOTSTRAP: 1 - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} - - uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 - with: - key: udeps - - run: cargo install --locked cargo-udeps@0.1.59 - - run: cargo udeps --all-targets --all-features - - run_cargodeny: - name: Run Cargo Deny - runs-on: ubuntu-latest - strategy: - matrix: - checks: - - advisories - - bans licenses sources - - # Prevent sudden announcement of a new advisory from failing ci: - continue-on-error: ${{ matrix.checks == 'advisories' }} - - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} - - uses: EmbarkStudios/cargo-deny-action@76cd80eb775d7bbbd2d80292136d74d39e1b4918 # v2.0.14 - with: - command: check ${{ matrix.checks }} - - run_rustdoc: - name: Run RustDoc - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} - components: rustfmt - - uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 - with: - key: doc - - run: cargo doc --document-private-items - - run_tests: - name: Run Cargo Tests - needs: - - run_rustdoc - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} - # rust-src is required for trybuild stderr output comparison to work - # for our cases. - # See: https://github.com/dtolnay/trybuild/issues/236#issuecomment-1620950759 - components: rust-src - - uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 - with: - key: test - - run: cargo test --no-default-features --workspace - - run: cargo test --all-features --workspace - - tests_passed: - name: All tests passed - needs: - - run_udeps - - run_tests - runs-on: ubuntu-latest - steps: - - name: log - run: echo All tests have passed! diff --git a/.github/workflows/pr_security-checks.yml b/.github/workflows/pr_security-checks.yml new file mode 100644 index 000000000..0110a3a47 --- /dev/null +++ b/.github/workflows/pr_security-checks.yml @@ -0,0 +1,59 @@ +--- +name: Security Checks + +on: + pull_request: + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: "0" + CARGO_PROFILE_DEV_DEBUG: "0" + RUST_TOOLCHAIN_VERSION: "1.89.0" + RUSTFLAGS: "-D warnings" + RUSTDOCFLAGS: "-D warnings" + RUST_LOG: "info" + +permissions: {} + +jobs: + # Identify unused dependencies + cargo-udeps: + name: Run Cargo Udeps + runs-on: ubuntu-latest + env: + RUSTC_BOOTSTRAP: 1 + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} + - uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 + with: + key: udeps + - run: cargo install --locked cargo-udeps@0.1.59 + - run: cargo udeps --all-targets --all-features + + cargo-deny: + name: Run Cargo Deny + runs-on: ubuntu-latest + strategy: + matrix: + checks: + - advisories + - bans licenses sources + + # Prevent sudden announcement of a new advisory from failing ci: + continue-on-error: ${{ matrix.checks == 'advisories' }} + + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} + - uses: EmbarkStudios/cargo-deny-action@76cd80eb775d7bbbd2d80292136d74d39e1b4918 # v2.0.14 + with: + command: check ${{ matrix.checks }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b652872c7..2704540a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,6 +47,30 @@ repos: stages: [pre-commit, pre-merge-commit, manual] pass_filenames: false + - id: cargo-doc + name: cargo-doc + language: system + entry: cargo doc --document-private-items + stages: [pre-commit, pre-merge-commit] + pass_filenames: false + files: \.rs$|Cargo\.(toml|lock) + + - id: cargo-test-no-default-features + name: cargo-test-no-default-features + language: system + entry: cargo test --no-default-features --workspace + stages: [pre-commit, pre-merge-commit] + pass_filenames: false + files: \.rs$|Cargo\.(toml|lock) + + - id: cargo-test-all-features + name: cargo-test-all-features + language: system + entry: cargo test --all-features --workspace + stages: [pre-commit, pre-merge-commit] + pass_filenames: false + files: \.rs$|Cargo\.(toml|lock) + - id: cargo-rustfmt name: cargo-rustfmt language: system