diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index bbbc0746..2a839ea8 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -84,3 +84,30 @@ jobs: - uses: crate-ci/typos@v1.24.1 with: files: . + + coverage: + if: ${{ !startsWith(github.head_ref, 'dependabot/') }} + runs-on: ubuntu-latest + env: + BEERUS_TEST_RUN: 1 + BEERUS_TEST_STARKNET_URL: https://starknet-mainnet.g.alchemy.com/starknet/version/rpc/v0_7/${{ secrets.ALCHEMY_KEY }} + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: rm -rf /opt/hostedtoolcache + - name: Install Tarpaulin for code coverage + run: cargo install cargo-tarpaulin + # Exclude 'web' directory from coverage + - run: rm -rf ./web + - name: Run tests with coverage + run: cargo tarpaulin --out html + - name: View context attributes + uses: actions/github-script@v7 + with: + script: console.log(context) + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + files: ./tarpaulin-report.html + #token: ${{ secrets.CODECOV_TOKEN }} diff --git a/src/bin/beerus.rs b/src/bin/beerus.rs index 92beea43..8d31ad5b 100644 --- a/src/bin/beerus.rs +++ b/src/bin/beerus.rs @@ -7,6 +7,7 @@ use beerus::{ use tokio::sync::RwLock; use validator::Validate; +#[cfg(not(tarpaulin_include))] // exclude from coverage report #[tokio::main] async fn main() -> eyre::Result<()> { tracing_subscriber::fmt::init(); @@ -56,6 +57,7 @@ async fn main() -> eyre::Result<()> { Ok(()) } +#[cfg(not(tarpaulin_include))] // exclude from coverage report async fn get_config() -> eyre::Result { let path = std::env::args().nth(1); let config = if let Some(path) = path { diff --git a/src/lib.rs b/src/lib.rs index f74ccb81..2125f6ff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,10 @@ pub mod client; pub mod config; pub mod eth; pub mod exe; + +#[cfg(not(tarpaulin_include))] // exclude from coverage report pub mod gen; + pub mod proof; #[cfg(not(target_arch = "wasm32"))]