Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage check in each pr #88

Merged
merged 4 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
branches: [main]

env:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"

Expand All @@ -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

Expand All @@ -30,12 +30,40 @@ 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

- name: Build
run: cargo build

- name: Tests
run: cargo test
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

- 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: ${{ github.event.pull_request.number }}
4 changes: 2 additions & 2 deletions crates/configuration/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl NetworkConfigBuilder<WithRelaychain> {
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,
Expand All @@ -152,7 +152,7 @@ impl NetworkConfigBuilder<WithRelaychain> {

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,
Expand Down
2 changes: 1 addition & 1 deletion crates/configuration/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
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,
Expand Down
2 changes: 1 addition & 1 deletion crates/configuration/src/relaychain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl RelaychainConfigBuilder<WithAtLeastOneNode> {
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,
Expand Down
Loading