Skip to content

Commit

Permalink
test cov report change
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamle2 committed Mar 14, 2024
1 parent c44feeb commit 2eb7dad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@ jobs:
uses: actions/download-artifact@v3
with:
name: ref-lcov.info
path: ./coverage/lcov.info

- name: Generate code coverage
run: |
cargo tarpaulin --skip-clean --ignore-tests --exclude-files src/bin/schema.rs --frozen --engine llvm --out Lcov
cargo tarpaulin --skip-clean --ignore-tests --exclude-files src/bin/schema.rs --frozen --engine llvm --out Lcov --output-dir coverage
- name: Generate code coverage report
id: code-coverage
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./lcov.info"
base-lcov-file: "./coverage/lcov.info"
lcov-file: "./coverage/lcov.info"
base-lcov-file: "./lcov.info"
minimum-ratio: 0 # Fails Github action once code coverage is decreasing
send-summary-comment: true
show-annotations: "warning" # Possible options warning|error
Expand Down
7 changes: 6 additions & 1 deletion src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::msg::{
CollectFeeRequirement, ConfigResponse, DistributeTargetsResponse, ExecuteMsg, InstantiateMsg,
MigrateMsg, QueryMsg,
};
use crate::state::{Config, DistributeTarget, CONFIG, DISTRIBUTION_TARGETS};
use crate::state::{Config, DistributeTarget, CONFIG, CONFIG_TEST, DISTRIBUTION_TARGETS};
use crate::ContractError;
use cosmos_sdk_proto::cosmos::authz::v1beta1::MsgExec;
use cosmos_sdk_proto::cosmos::bank::v1beta1::MsgSend;
Expand Down Expand Up @@ -119,6 +119,11 @@ fn execute_update_config(
router: config.router,
};

let config_test_result = CONFIG_TEST.may_load(deps.storage)?;
if config_test_result.is_none() {
CONFIG_TEST.save(deps.storage, &new_config)?;
}

CONFIG.save(deps.storage, &new_config)?;

Ok(Response::new()
Expand Down
2 changes: 2 additions & 0 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use cosmwasm_std::{Addr, Binary};
use cw_storage_plus::Item;

const CONFIG_KEY: &str = "config";
const CONFIG_KEY_TEST: &str = "config_test";
const DISTRIBUTION_TARGET: &str = "distribution_target";

#[cw_serde]
Expand All @@ -21,4 +22,5 @@ pub struct DistributeTarget {
}

pub const CONFIG: Item<Config> = Item::new(CONFIG_KEY);
pub const CONFIG_TEST: Item<Config> = Item::new(CONFIG_KEY_TEST);
pub const DISTRIBUTION_TARGETS: Item<Vec<DistributeTarget>> = Item::new(DISTRIBUTION_TARGET);

0 comments on commit 2eb7dad

Please sign in to comment.