From e72f40b16935e49ce1bbe5c46b057e900434306f Mon Sep 17 00:00:00 2001 From: Mick Grove Date: Thu, 12 Feb 2026 16:51:55 -0800 Subject: [PATCH] Fixed CI runner failure when executing tests --- .github/workflows/ci.yml | 6 +----- .github/workflows/release.yml | 4 ++-- Makefile | 33 ++++++++++++++++++++++++++++++++- src/direct_validate.rs | 8 +------- src/scanner/runner.rs | 2 +- src/validation_rate_limit.rs | 10 ++-------- 6 files changed, 39 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f009ef4..fabf410 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,12 +47,8 @@ jobs: shared-key: kingfisher-${{ runner.os }}-${{ runner.arch }} save-if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} - - name: Build (Makefile linux-arm64) + - name: Build and Run Tests (Makefile linux-arm64) run: make linux-arm64 - - name: Run tests - env: - CARGO_BUILD_JOBS: "2" - run: cargo test --workspace --all-targets -- --test-threads=1 macos-arm64: name: macOS arm64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc58fc6..fa78b8d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,7 +57,7 @@ jobs: - name: Install packaging tools run: cargo install cargo-deb cargo-generate-rpm - - name: Build (Makefile linux-x64) + - name: Build and Run Tests (Makefile linux-x64) run: make linux-x64 - name: Fix permissions @@ -130,7 +130,7 @@ jobs: - name: Install packaging tools run: cargo install cargo-deb cargo-generate-rpm - - name: Build (Makefile linux-arm64) + - name: Build and Run Tests (Makefile linux-arm64) run: make linux-arm64 - name: Fix permissions diff --git a/Makefile b/Makefile index ae146fe..3ff34bf 100644 --- a/Makefile +++ b/Makefile @@ -276,7 +276,38 @@ linux-x64: check-docker create-dockerignore ' $(MAKE) list-archives -linux-arm64: ubuntu-arm64 +linux-arm64: check-docker create-dockerignore + @mkdir -p target/release + docker run --platform linux/arm64 --rm \ + -e CARGO_HOME=/src/.cargo-home \ + -v "$$(pwd):/src" -w /src rust:1.92-alpine sh -eu -c '\ + mkdir -p /src/.cargo-home && \ + apk add --no-cache \ + musl-dev \ + gcc g++ make cmake pkgconfig \ + zlib-dev zlib-static \ + bzip2-dev bzip2-static \ + xz-dev xz-static \ + boost-dev linux-headers \ + patch perl ragel \ + git curl && \ + \ + rustup target add aarch64-unknown-linux-musl && \ + \ + cargo test --workspace --all-targets ; \ + \ + export PKG_CONFIG_ALLOW_CROSS=1 ; \ + export RUSTFLAGS="-C target-feature=+crt-static" ; \ + \ + cargo build --release --target aarch64-unknown-linux-musl && \ + \ + cd target/aarch64-unknown-linux-musl/release && \ + sha256sum kingfisher > CHECKSUM.txt && \ + tar -czf /src/target/release/kingfisher-linux-arm64.tgz \ + kingfisher CHECKSUM.txt \ + ' + $(MAKE) list-archives + # ============= AGGREGATE TARGETS ============= diff --git a/src/direct_validate.rs b/src/direct_validate.rs index a3d4a07..a7da825 100644 --- a/src/direct_validate.rs +++ b/src/direct_validate.rs @@ -573,13 +573,7 @@ pub async fn run_direct_validation( .await? } Validation::Grpc(grpc_validation_cfg) => { - execute_grpc_validation( - grpc_validation_cfg, - &globals, - &parser, - timeout, - ) - .await? + execute_grpc_validation(grpc_validation_cfg, &globals, &parser, timeout).await? } Validation::AWS => { diff --git a/src/scanner/runner.rs b/src/scanner/runner.rs index 8f2d679..a7ffc87 100644 --- a/src/scanner/runner.rs +++ b/src/scanner/runner.rs @@ -41,8 +41,8 @@ use crate::{ summary::{compute_scan_totals, print_scan_summary}, AccessMapCollector, }, - validation_rate_limit::ValidationRateLimiter, util::set_redaction_enabled, + validation_rate_limit::ValidationRateLimiter, }; pub async fn run_scan( diff --git a/src/validation_rate_limit.rs b/src/validation_rate_limit.rs index 9912f1e..8b1ac1c 100644 --- a/src/validation_rate_limit.rs +++ b/src/validation_rate_limit.rs @@ -31,11 +31,7 @@ impl ValidationRateLimiter { return Ok(None); } - Ok(Some(Self { - default_rps, - per_rule: normalized, - next_allowed: Arc::new(DashMap::new()), - })) + Ok(Some(Self { default_rps, per_rule: normalized, next_allowed: Arc::new(DashMap::new()) })) } pub fn effective_rps(&self, rule_id: &str) -> Option { @@ -118,9 +114,7 @@ fn validate_rps(value: f64) -> Result { fn selector_matches(rule_id: &str, selector: &str) -> bool { rule_id == selector - || rule_id - .strip_prefix(selector) - .is_some_and(|suffix| suffix.starts_with('.')) + || rule_id.strip_prefix(selector).is_some_and(|suffix| suffix.starts_with('.')) } pub fn should_rate_limit_validation(validation: &Validation) -> bool {