From d952da46d6ae6853d0712226e0e80d5448c56fee Mon Sep 17 00:00:00 2001 From: max funk Date: Fri, 10 Nov 2023 10:53:58 -0700 Subject: [PATCH] rule --- .github/workflows/dev-rule.yaml | 25 ++++++++++++++++--------- services/rule/src/main.rs | 1 + 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dev-rule.yaml b/.github/workflows/dev-rule.yaml index 3aae1567..be60e344 100644 --- a/.github/workflows/dev-rule.yaml +++ b/.github/workflows/dev-rule.yaml @@ -11,6 +11,11 @@ on: types: - completed +env: + WORK_DIR: services/rule + RUST_PKG: rule + CONF_PATH: .services.rule + jobs: test: name: rule @@ -22,21 +27,23 @@ jobs: toolchain: stable components: clippy, rustfmt - uses: taiki-e/install-action@nextest - - name: linting + - name: ${{ env.WORK_DIR }} lint run: | cargo fmt -- --check cargo clippy -- -Dwarnings - working-directory: services/rule + working-directory: ${{ env.WORK_DIR }} - name: install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - - name: services/rule unit tests + - name: ${{ env.WORK_DIR }} unit tests run: cargo test - working-directory: services/rule - - name: services/rule coverage report - run: make rust-coverage RUST_PKG=rule - - name: fail services/rule coverage under 66% + working-directory: ${{ env.WORK_DIR }} + - name: ${{ env.WORK_DIR }} coverage report + run: | + make rust-coverage RUST_PKG=${{ env.RUST_PKG }} + echo "MIN_CODE_COV=$(yq ${{ env.CONF_PATH }}.min_code_cov project.yaml)" >> $GITHUB_ENV + - name: fail ${{ env.WORK_DIR }} coverage under ${{ env.MIN_CODE_COV }}% run: | - if [[ $(make rust-coverage-percent RUST_PKG=rule) -lt 66 ]]; then - echo 'coverage dropped below 66%' + if [[ $(make rust-coverage-percent RUST_PKG=${{ env.RUST_PKG }}) -lt ${{ env.MIN_CODE_COV }} ]]; then + echo 'coverage dropped below ${{ env.MIN_CODE_COV }}%' exit 1 fi diff --git a/services/rule/src/main.rs b/services/rule/src/main.rs index fea98905..471e4e85 100644 --- a/services/rule/src/main.rs +++ b/services/rule/src/main.rs @@ -729,6 +729,7 @@ mod tests { .unwrap() .0 .len(); + // want length of approvals vec on tax transaction item to be 4 (started with 0) let want_length: usize = 4; assert_eq!(