From 7b965e250c1eea41305cefc7550ae607c6059001 Mon Sep 17 00:00:00 2001 From: ksew1 Date: Thu, 6 Mar 2025 15:51:45 +0100 Subject: [PATCH 1/2] Support 2.11.0 commit-id:87452475 --- .github/workflows/ci.yml | 14 ++++++++------ crates/cairo-coverage/Cargo.toml | 1 + crates/cairo-coverage/src/commands/run.rs | 10 +++++++++- crates/cairo-coverage/tests/e2e/general.rs | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03dc7e1..0b50578 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,11 +8,8 @@ on: jobs: test-disabling-macros: - name: Tests (2.8.5) - support for disabling macros - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-latest, windows-latest ] + name: Tests 2.8.5 - windows + runs-on: windows-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -27,7 +24,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - version: [2.9.1, 2.10.1] + version: [2.8.5, 2.9.1, 2.10.1, 2.11.0] steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -37,7 +34,12 @@ jobs: with: scarb-version: ${{ matrix.version }} - uses: foundry-rs/setup-snfoundry@ee00ea3f026379008ca40a54448d4059233d06cc # v4.0.0 + - run: cargo test --features allows-excluding-macros allows-including-test-functions + if: matrix.version == '2.8.5' - run: cargo test --release + if: matrix.version == '2.9.1' || matrix.version == '2.10.1' + - run: cargo test --features allows-excluding-macros + if: matrix.version == '2.11.0' rustfmt: name: Check rust formatting diff --git a/crates/cairo-coverage/Cargo.toml b/crates/cairo-coverage/Cargo.toml index 9552271..7335609 100644 --- a/crates/cairo-coverage/Cargo.toml +++ b/crates/cairo-coverage/Cargo.toml @@ -22,3 +22,4 @@ which.workspace = true [features] allows-excluding-macros = [] +allows-including-test-functions = [] diff --git a/crates/cairo-coverage/src/commands/run.rs b/crates/cairo-coverage/src/commands/run.rs index 6de0ebc..e21737e 100644 --- a/crates/cairo-coverage/src/commands/run.rs +++ b/crates/cairo-coverage/src/commands/run.rs @@ -21,9 +21,17 @@ pub fn run( let metadata = scarb_metadata()?; if !include.contains(&IncludedComponent::Macros) { + ensure!( + metadata.app_version_info.version <= Version::new(2, 8, 5) + || metadata.app_version_info.version >= Version::new(2, 11, 0), + "excluding macros is only supported for Scarb versions <= 2.8.5 and >= 2.11.0" + ); + } + + if include.contains(&IncludedComponent::TestFunctions) { ensure!( metadata.app_version_info.version <= Version::new(2, 8, 5), - "excluding macros is only supported for Scarb versions <= 2.8.5" + "including test functions is only supported for Scarb versions <= 2.8.5" ); } diff --git a/crates/cairo-coverage/tests/e2e/general.rs b/crates/cairo-coverage/tests/e2e/general.rs index 9c162e3..d47db39 100644 --- a/crates/cairo-coverage/tests/e2e/general.rs +++ b/crates/cairo-coverage/tests/e2e/general.rs @@ -9,7 +9,7 @@ fn simple() { } #[test] -#[cfg(feature = "allows-excluding-macros")] +#[cfg(feature = "allows-including-test-functions")] fn simple_with_tests() { TestProject::new("simple") .coverage_args(&["--unstable", "--include", "test-functions"]) From 0141601bf0344947dd72e1c1a62fe12072b1c07a Mon Sep 17 00:00:00 2001 From: ksew1 Date: Thu, 6 Mar 2025 15:53:02 +0100 Subject: [PATCH 2/2] Release 0.5.0 commit-id:63603749 --- CHANGELOG.md | 2 ++ Cargo.lock | 6 +++--- Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ab6920..83d449a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.5.0] - 2025-03-06 + #### Added - warning if the current scarb version doesn't support not including macros in the coverage report diff --git a/Cargo.lock b/Cargo.lock index 74a24bf..46f31bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -217,7 +217,7 @@ dependencies = [ [[package]] name = "cairo-coverage" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "assert_fs", @@ -235,7 +235,7 @@ dependencies = [ [[package]] name = "cairo-coverage-core" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "assert_fs", @@ -257,7 +257,7 @@ dependencies = [ [[package]] name = "cairo-coverage-test-utils" -version = "0.4.0" +version = "0.5.0" dependencies = [ "assert_fs", "camino", diff --git a/Cargo.toml b/Cargo.toml index 7c1d914..fb5ba0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ members = [ ] [workspace.package] -version = "0.4.0" +version = "0.5.0" edition = "2024" [workspace.dependencies]