forked from mirrors/kingfisher
Fixed CI runner failure when executing tests
This commit is contained in:
parent
dfe6554b1c
commit
e72f40b169
6 changed files with 39 additions and 24 deletions
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
33
Makefile
33
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 =============
|
||||
|
|
|
|||
|
|
@ -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 => {
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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<f64> {
|
||||
|
|
@ -118,9 +114,7 @@ fn validate_rps(value: f64) -> Result<f64> {
|
|||
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue