From b9f432c2589e61d14a4199feada7345f4693910b Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Tue, 26 Sep 2023 12:11:13 +0200 Subject: [PATCH 1/6] Replace tarpaulin with grcov --- .circleci/config.yml | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index acd3756e6f..c76fe19b3f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -967,41 +967,45 @@ jobs: coverage: # https://circleci.com/developer/images?imageType=machine - machine: - image: ubuntu-2004:202201-02 + docker: + - image: rust:1.67.0 steps: - checkout + - run: + name: Install grcov + command: | + rustup component add llvm-tools-preview + cargo install grcov - run: name: Run tests with coverage # See https://github.com/xd009642/tarpaulin/blob/develop/CHANGELOG.md and https://hub.docker.com/r/xd009642/tarpaulin/tags # for tarpaulin versions. command: | - mkdir -p reports/crypto - mkdir -p reports/derive - mkdir -p reports/schema - mkdir -p reports/std - mkdir -p reports/storage - CRYPTO=" cargo tarpaulin --skip-clean --out Xml --output-dir reports/crypto --packages cosmwasm-crypto" - DERIVE=" cargo tarpaulin --skip-clean --out Xml --output-dir reports/derive --packages cosmwasm-derive" - SCHEMA=" cargo tarpaulin --skip-clean --out Xml --output-dir reports/schema --packages cosmwasm-schema" - STD=" cargo tarpaulin --skip-clean --out Xml --output-dir reports/std --packages cosmwasm-std --features abort,iterator,staking,stargate,cosmwasm_1_4" - STORAGE="cargo tarpaulin --skip-clean --out Xml --output-dir reports/storage --packages cosmwasm-storage" - docker run --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin:0.21.0 \ - sh -c "$CRYPTO && $DERIVE && $SCHEMA && $STD && $STORAGE" + mkdir -p reports + cargo test + + grcov . ./packages/**/ -s packages/crypto --binary-path ./target/debug -t lcov -o ./reports/crypto.info + grcov . ./packages/**/ -s packages/derive --binary-path ./target/debug -t lcov -o ./reports/derive.info + grcov . ./packages/**/ -s packages/schema --binary-path ./target/debug -t lcov -o ./reports/schema.info + grcov . ./packages/**/ -s packages/std --binary-path ./target/debug -t lcov -o ./reports/std.info + grcov . ./packages/**/ -s packages/storage --binary-path ./target/debug -t lcov -o ./reports/storage.info + environment: + RUSTFLAGS: "-Cinstrument-coverage" + LLVM_PROFILE_FILE: "cosmwasm-%p-%m.profraw" - codecov/upload: - file: reports/crypto/cobertura.xml + file: reports/crypto.info flags: cosmwasm-crypto - codecov/upload: - file: reports/derive/cobertura.xml + file: reports/derive.info flags: cosmwasm-derive - codecov/upload: - file: reports/schema/cobertura.xml + file: reports/schema.info flags: cosmwasm-schema - codecov/upload: - file: reports/std/cobertura.xml + file: reports/std.info flags: cosmwasm-std - codecov/upload: - file: reports/storage/cobertura.xml + file: reports/storage.info flags: cosmwasm-storage # This job roughly follows the instructions from https://circleci.com/blog/publishing-to-github-releases-via-circleci/ From df702d20b070f0dd03f68b674da0c051896fb8ad Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Tue, 26 Sep 2023 14:57:17 +0200 Subject: [PATCH 2/6] Enable coverage ci job again --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c76fe19b3f..54285851b8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -86,7 +86,7 @@ workflows: # Add your branch here if benchmarking matters to your work - fix-benchmarking - w3 - # - coverage # disabled temporarily because Rust version is too low + - coverage deploy: jobs: - build_and_upload_devcontracts: From 5a7ed6ba797dfbf40466a4767210e86b611c0099 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Tue, 26 Sep 2023 15:22:15 +0200 Subject: [PATCH 3/6] Fix grcov in ci --- .circleci/config.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 54285851b8..9fde1481f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -968,18 +968,16 @@ jobs: coverage: # https://circleci.com/developer/images?imageType=machine docker: - - image: rust:1.67.0 + - image: rust:1.72.0 steps: - checkout - run: name: Install grcov command: | rustup component add llvm-tools-preview - cargo install grcov + cargo install grcov --locked - run: name: Run tests with coverage - # See https://github.com/xd009642/tarpaulin/blob/develop/CHANGELOG.md and https://hub.docker.com/r/xd009642/tarpaulin/tags - # for tarpaulin versions. command: | mkdir -p reports cargo test From 157d0510bf53f26d159edf662abdba5dbf77a38e Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Tue, 26 Sep 2023 15:58:26 +0200 Subject: [PATCH 4/6] Add cosmwasm-vm to coverage --- .circleci/config.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9fde1481f6..c5d451835d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -982,11 +982,12 @@ jobs: mkdir -p reports cargo test - grcov . ./packages/**/ -s packages/crypto --binary-path ./target/debug -t lcov -o ./reports/crypto.info - grcov . ./packages/**/ -s packages/derive --binary-path ./target/debug -t lcov -o ./reports/derive.info - grcov . ./packages/**/ -s packages/schema --binary-path ./target/debug -t lcov -o ./reports/schema.info - grcov . ./packages/**/ -s packages/std --binary-path ./target/debug -t lcov -o ./reports/std.info - grcov . ./packages/**/ -s packages/storage --binary-path ./target/debug -t lcov -o ./reports/storage.info + grcov . -s packages/crypto --binary-path ./target/debug -t lcov -o ./reports/crypto.info + grcov . -s packages/derive --binary-path ./target/debug -t lcov -o ./reports/derive.info + grcov . -s packages/schema --binary-path ./target/debug -t lcov -o ./reports/schema.info + grcov . -s packages/std --binary-path ./target/debug -t lcov -o ./reports/std.info + grcov . -s packages/storage --binary-path ./target/debug -t lcov -o ./reports/storage.info + grcov . -s packages/vm --binary-path ./target/debug -t lcov -o ./reports/vm.info environment: RUSTFLAGS: "-Cinstrument-coverage" LLVM_PROFILE_FILE: "cosmwasm-%p-%m.profraw" @@ -1005,6 +1006,9 @@ jobs: - codecov/upload: file: reports/storage.info flags: cosmwasm-storage + - codecov/upload: + file: reports/vm.info + flags: cosmwasm-vm # This job roughly follows the instructions from https://circleci.com/blog/publishing-to-github-releases-via-circleci/ build_and_upload_devcontracts: From 376801cdef50bd521a7ab3308c269eeacbfca8b3 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Tue, 26 Sep 2023 16:27:07 +0200 Subject: [PATCH 5/6] Update codecov orb --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c5d451835d..791b747594 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: - codecov: codecov/codecov@3.2.0 + codecov: codecov/codecov@3.2.5 win: circleci/windows@5.0 commands: From 59c89eba4631bf8c939a9a10d891da004efbb52c Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Wed, 27 Sep 2023 09:19:56 +0200 Subject: [PATCH 6/6] Remove comment --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 791b747594..0e38951381 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -966,7 +966,6 @@ jobs: key: cargocache-v2-benchmarking-rust:1.67.0-{{ checksum "Cargo.lock" }} coverage: - # https://circleci.com/developer/images?imageType=machine docker: - image: rust:1.72.0 steps: