From 9a68196f504518057a0268d1923607796c05058f Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 6 Sep 2024 11:23:23 -0300 Subject: [PATCH 01/10] rename coverage target --- .github/workflows/integration.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index b19a567a..d19ff0be 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -89,7 +89,7 @@ jobs: uses: docker-practice/actions-setup-docker@master - name: Run tests and generate code coverage - run: make coverage + run: make run-coverage - name: Upload coverage report uses: actions/upload-artifact@v4 diff --git a/Makefile b/Makefile index 4dd267f8..ed72c048 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ pr: cargo test --workspace docker stop anvil -coverage: +run-coverage: $(MAKE) start-anvil > /dev/null & sleep 4 # needed to wait for anvil setup to finish cargo llvm-cov --lcov --output-path lcov.info --ignore-filename-regex='fireblocks/' --workspace From 87582d36a95d7a3ec8c47021130efc4911769241 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 6 Sep 2024 11:36:26 -0300 Subject: [PATCH 02/10] update readme --- README.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 564d0178..1420342d 100644 --- a/README.md +++ b/README.md @@ -68,20 +68,12 @@ Here's how to generate test coverage reports: Install llvm tools: ``` -rustup component add llvm-tools-preview +make deps ``` Run the tests with coverage instrumentations: ``` -cargo clean && mkdir -p coverage/ && rm -r coverage/* -CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='coverage/cargo-test-%p-%m.profraw' cargo test --no-fail-fast -``` - -Install coverage report tool and run it: -``` -cargo install grcov -grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/ - +make run-coverage ``` ## Supported Rust Version From 31208fba9dac392b5854e6e0171b06048b3145c7 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 6 Sep 2024 11:41:40 -0300 Subject: [PATCH 03/10] makefile coverage output as html --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ed72c048..2954ab40 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,9 @@ pr: run-coverage: $(MAKE) start-anvil > /dev/null & sleep 4 # needed to wait for anvil setup to finish - cargo llvm-cov --lcov --output-path lcov.info --ignore-filename-regex='fireblocks/' --workspace + cargo llvm-cov --html --ignore-filename-regex='fireblocks/' --workspace docker stop anvil + open target/llvm-cov/index.html deps: @if ! command -v cargo-llvm-cov &> /dev/null; then \ From 135a06d5f3ab01b32cd1110a5fa9808961e0276e Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 6 Sep 2024 11:56:34 -0300 Subject: [PATCH 04/10] add info.cov coverage output --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 2954ab40..b1d4cb52 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ run-coverage: sleep 4 # needed to wait for anvil setup to finish cargo llvm-cov --html --ignore-filename-regex='fireblocks/' --workspace docker stop anvil + cargo llvm-cov report --lcov > info.cov open target/llvm-cov/index.html deps: From 4ce569e7b8b1de266c0f4f460e3b47a4ec60b7c3 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 6 Sep 2024 12:05:23 -0300 Subject: [PATCH 05/10] revert changes --- .github/workflows/integration.yml | 2 +- Makefile | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index d19ff0be..b19a567a 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -89,7 +89,7 @@ jobs: uses: docker-practice/actions-setup-docker@master - name: Run tests and generate code coverage - run: make run-coverage + run: make coverage - name: Upload coverage report uses: actions/upload-artifact@v4 diff --git a/Makefile b/Makefile index b1d4cb52..4dd267f8 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,11 @@ pr: cargo test --workspace docker stop anvil -run-coverage: +coverage: $(MAKE) start-anvil > /dev/null & sleep 4 # needed to wait for anvil setup to finish - cargo llvm-cov --html --ignore-filename-regex='fireblocks/' --workspace + cargo llvm-cov --lcov --output-path lcov.info --ignore-filename-regex='fireblocks/' --workspace docker stop anvil - cargo llvm-cov report --lcov > info.cov - open target/llvm-cov/index.html deps: @if ! command -v cargo-llvm-cov &> /dev/null; then \ From 1711e88a64a484454cd68a30255d359a25fa3bfd Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 6 Sep 2024 12:09:26 -0300 Subject: [PATCH 06/10] add readme coverage report --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 1420342d..2c06945b 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,11 @@ Run the tests with coverage instrumentations: make run-coverage ``` +Open the coverage html report in a web browser: +``` +open target/llvm-cov/html/index.html +``` + ## Supported Rust Version Rolling `MSRV` policy of 6 months. The current `MSRV` is 1.79 From 4f7f287fd10d15ae5387a79bd78d3189d15aa4a0 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 6 Sep 2024 12:15:43 -0300 Subject: [PATCH 07/10] fix coverage target --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c06945b..cddd54ec 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ make deps Run the tests with coverage instrumentations: ``` -make run-coverage +make coverage ``` Open the coverage html report in a web browser: From d9a15e73aa2aa7f74f58fe02feeded3ff47d055f Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 6 Sep 2024 13:11:46 -0300 Subject: [PATCH 08/10] add coverage html report to makefile --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 4dd267f8..59617204 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ coverage: $(MAKE) start-anvil > /dev/null & sleep 4 # needed to wait for anvil setup to finish cargo llvm-cov --lcov --output-path lcov.info --ignore-filename-regex='fireblocks/' --workspace + cargo llvm-cov report --html --ignore-filename-regex='fireblocks/' docker stop anvil deps: From d6a42d9229a755000b4042eaf69775d83955247a Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Wed, 11 Sep 2024 11:49:41 -0300 Subject: [PATCH 09/10] add foundry installation and remove testing environments --- .github/workflows/integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index b19a567a..f508564e 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -10,7 +10,6 @@ jobs: build: name: Build runs-on: ubuntu-latest - environment: testing steps: - name: Install Rust uses: dtolnay/rust-toolchain@1.80.1 @@ -27,7 +26,6 @@ jobs: lint: name: Run Lints runs-on: ubuntu-latest - environment: testing steps: - name: Install Rust uses: dtolnay/rust-toolchain@1.80.1 @@ -49,7 +47,6 @@ jobs: test: name: Run Tests runs-on: ubuntu-latest - environment: testing env: HOLESKY_WS_URL: ${{ secrets.HOLESKY_WS_URL }} @@ -85,6 +82,9 @@ jobs: with: cache-on-failure: true + - name: Install Foundry + run: cargo install --git https://github.com/foundry-rs/foundry --profile release --locked foundry-cast + - name: docker uses: docker-practice/actions-setup-docker@master From 360bf890bce34db3f95992acf723debe8d5021d2 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Wed, 11 Sep 2024 12:02:27 -0300 Subject: [PATCH 10/10] add anvil installation --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f508564e..f22adc2d 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -83,7 +83,7 @@ jobs: cache-on-failure: true - name: Install Foundry - run: cargo install --git https://github.com/foundry-rs/foundry --profile release --locked foundry-cast + run: cargo install --git https://github.com/foundry-rs/foundry --profile release --locked foundry-cast anvil - name: docker uses: docker-practice/actions-setup-docker@master