From 543ce152263fb783a71b67a6d6ed58165a11d645 Mon Sep 17 00:00:00 2001 From: muraca Date: Wed, 5 Jul 2023 16:58:26 +0200 Subject: [PATCH 1/4] added code coverage to action Signed-off-by: muraca --- .github/workflows/ci.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f558e4c05..f7bce5f96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: pull_request: branches: [main] -env: +env: CARGO_TERM_COLOR: always RUSTFLAGS: "-Dwarnings" @@ -21,7 +21,7 @@ jobs: - nightly steps: - uses: actions/checkout@v3 - + - name: Init nigthly install for fmt run: rustup update nightly && rustup default nightly && rustup component add rustfmt @@ -30,7 +30,7 @@ jobs: - name: Init install run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} && rustup component add clippy - + - name: Clippy run: cargo clippy --all-targets --all-features @@ -38,4 +38,20 @@ jobs: run: cargo build - name: Tests - run: cargo test \ No newline at end of file + run: cargo test + + - name: Install latest nextest release + uses: taiki-e/install-action@nextest + + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + + - name: Collect coverage data + run: cargo llvm-cov nextest --lcov --output-path lcov.info + + - name: Report code coverage + uses: Nef10/lcov-reporter-action@v0.4.0 + with: + lcov-file: lcov.info + pr-number: ${{ env.pr_number }} + if: github.event_name == 'pull_request' From 2580959ead03c963946027f960d650e7539d587c Mon Sep 17 00:00:00 2001 From: muraca Date: Wed, 5 Jul 2023 21:57:42 +0200 Subject: [PATCH 2/4] fixes to make clippy happy Signed-off-by: muraca --- crates/configuration/src/network.rs | 4 ++-- crates/configuration/src/parachain.rs | 2 +- crates/configuration/src/relaychain.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/configuration/src/network.rs b/crates/configuration/src/network.rs index 5bef574bd..1bb022371 100644 --- a/crates/configuration/src/network.rs +++ b/crates/configuration/src/network.rs @@ -133,7 +133,7 @@ impl NetworkConfigBuilder { match f(ParachainConfigBuilder::new()).build() { Ok(parachain) => Self::transition( NetworkConfig { - parachains: vec![self.config.parachains, vec![parachain]].concat(), + parachains: [self.config.parachains, vec![parachain]].concat(), ..self.config }, self.errors, @@ -152,7 +152,7 @@ impl NetworkConfigBuilder { Self::transition( NetworkConfig { - hrmp_channels: vec![self.config.hrmp_channels, vec![new_hrmp_channel]].concat(), + hrmp_channels: [self.config.hrmp_channels, vec![new_hrmp_channel]].concat(), ..self.config }, self.errors, diff --git a/crates/configuration/src/parachain.rs b/crates/configuration/src/parachain.rs index a0254c909..84dc81f2c 100644 --- a/crates/configuration/src/parachain.rs +++ b/crates/configuration/src/parachain.rs @@ -480,7 +480,7 @@ impl ParachainConfigBuilder { match f(NodeConfigBuilder::new(ChainDefaultContext::default())).build() { Ok(collator) => Self::transition( ParachainConfig { - collators: vec![self.config.collators, vec![collator]].concat(), + collators: [self.config.collators, vec![collator]].concat(), ..self.config }, self.errors, diff --git a/crates/configuration/src/relaychain.rs b/crates/configuration/src/relaychain.rs index 8bffcff9f..ad437f296 100644 --- a/crates/configuration/src/relaychain.rs +++ b/crates/configuration/src/relaychain.rs @@ -317,7 +317,7 @@ impl RelaychainConfigBuilder { match f(NodeConfigBuilder::new(self.default_context())).build() { Ok(node) => Self::transition( RelaychainConfig { - nodes: vec![self.config.nodes, vec![node]].concat(), + nodes: [self.config.nodes, vec![node]].concat(), ..self.config }, self.errors, From af14f9afc29734c823cbd182f43150ccfde61437 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Wed, 5 Jul 2023 18:58:19 -0300 Subject: [PATCH 3/4] Update .github/workflows/ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7bce5f96..fc01836bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,5 +53,5 @@ jobs: uses: Nef10/lcov-reporter-action@v0.4.0 with: lcov-file: lcov.info - pr-number: ${{ env.pr_number }} + pr-number: ${{ github.event.pull_request.number }} if: github.event_name == 'pull_request' From 3f5027ed5b3d1009a42f6c503bfb7be901dec6d8 Mon Sep 17 00:00:00 2001 From: muraca Date: Thu, 6 Jul 2023 10:42:38 +0200 Subject: [PATCH 4/4] split jobs, added permissions Signed-off-by: muraca --- .github/workflows/ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc01836bc..8feb59fdf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,19 @@ jobs: - name: Tests run: cargo test + coverage: + name: Zombienet SDK - coverage + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/checkout@v3 + - name: Install latest nextest release uses: taiki-e/install-action@nextest @@ -54,4 +67,3 @@ jobs: with: lcov-file: lcov.info pr-number: ${{ github.event.pull_request.number }} - if: github.event_name == 'pull_request'