Skip to content

Commit

Permalink
Adding code coverage for unit tests (#1399)
Browse files Browse the repository at this point in the history
* adding code coverage

* running in k8 linux runners

* fixing the version of the toolchain to be used

* adding coverage for the sbor directory

* uploading the coverage files

* removing the coverage step

* debugging

* fixing the path to the artifacts

* pointing to the reusable workflow

* Trigger Build

* pointing to the public version of the reusable workflows

* pointing to the right branch

* pointing to the reusable action

* fixing syntax

* last syntax fix

* running more than one dir

* pointing to the setup action

* running integration tests

* running more tests

* running all tests

* restoring removed step

* fixing syntax

* reverting xtasks changes

* restoring the ci triggers

* pointing to the main branch in the reusable workflows repo
  • Loading branch information
balda-rdx authored Aug 29, 2023
1 parent f9a4ef3 commit 4ab3473
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 60 deletions.
123 changes: 64 additions & 59 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- betanet
- release\/*
pull_request:
# Run on PR against any branch

env:
CARGO_TERM_COLOR: always
Expand All @@ -33,46 +32,47 @@ jobs:
toolchain: 1.70.0
- name: Check format
run: bash ./check.sh

sbor-unit-tests:
name: Run SBOR unit tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [k8s-linux-runner]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.70.0
- name: Run tests
run: cargo test
working-directory: sbor
- name: Run tests (no_std)
run: cargo test --no-default-features --features alloc
working-directory: sbor
- name: Run derive tests
run: cargo test
working-directory: sbor-derive-common
- uses: actions/checkout@v3
- uses: radixdlt/public-iac-resuable-artifacts/rust-setup@main
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
tests-dir: sbor
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
tests-dir: sbor
flags: --no-default-features --features alloc
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
tests-dir: sbor-derive-common

sbor-integration-tests:
name: Run SBOR integration tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [k8s-linux-runner]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.70.0
- name: Run tests
run: cargo test
working-directory: sbor-tests
- name: Run tests (no_std)
run: cargo test --no-default-features --features alloc
working-directory: sbor-tests
- name: Run bench
run: cargo bench
working-directory: sbor-tests
- uses: actions/checkout@v3
- uses: radixdlt/public-iac-resuable-artifacts/rust-setup@main
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
tests-dir: sbor-tests
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
tests-dir: sbor-tests
flags: --no-default-features --features alloc
- name: Run bench
run: cargo bench
working-directory: sbor-tests

scrypto-unit-tests:
name: Run Scrypto unit tests
runs-on: ${{ matrix.os }}
Expand All @@ -81,21 +81,21 @@ jobs:
os: [k8s-linux-runner]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: radixdlt/public-iac-resuable-artifacts/rust-setup@main
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
toolchain: 1.70.0
- name: Run tests
run: cargo test
working-directory: scrypto
- name: Run tests (no_std)
run: cargo test --no-default-features --features alloc
working-directory: scrypto
- name: Run abi tests
run: cargo test
working-directory: scrypto-schema
- name: Run derive tests
run: cargo test
working-directory: scrypto-derive
tests-dir: scrypto
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
tests-dir: scrypto
flags: --no-default-features --features alloc
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
tests-dir: scrypto-schema
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
tests-dir: scrypto-derive

scrypto-integration-tests:
name: Run Scrypto integration tests
runs-on: ${{ matrix.os }}
Expand All @@ -104,15 +104,15 @@ jobs:
os: [k8s-linux-runner]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: radixdlt/public-iac-resuable-artifacts/rust-setup@main
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
toolchain: 1.70.0
- name: Run tests
run: cargo test
working-directory: scrypto-tests
- name: Run tests with no_std
run: cargo test --no-default-features --features alloc
working-directory: scrypto-tests
tests-dir: scrypto-tests
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
tests-dir: scrypto-tests
flags: --no-default-features --features alloc

scrypto-examples:
name: Run Scrypto examples
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -143,6 +143,7 @@ jobs:
- name: Build and test everything
run: cargo build --target wasm32-unknown-unknown --release && cargo test --release
working-directory: examples/everything

radix-engine:
name: Run Radix Engine tests
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -196,6 +197,7 @@ jobs:
--no-default-features --features alloc \
-p radix-engine \
-p radix-engine-tests
radix-engine-wasmer:
name: Run Radix Engine tests (wasmer)
runs-on: ${{ matrix.os }}
Expand All @@ -217,6 +219,7 @@ jobs:
--features wasmer \
-p radix-engine \
-p radix-engine-tests
radix-engine-bench:
name: Run Radix Engine benchmarks
runs-on: ${{ matrix.os }}
Expand All @@ -233,6 +236,7 @@ jobs:
- name: Run bench
run: cargo bench
working-directory: radix-engine-tests

radix-engine-common-bench:
name: Run Radix Engine common benchmarks
runs-on: ${{ matrix.os }}
Expand All @@ -249,6 +253,7 @@ jobs:
- name: Run bench
run: cargo bench
working-directory: radix-engine-common

transaction:
name: Run transaction tests
runs-on: ${{ matrix.os }}
Expand All @@ -257,12 +262,11 @@ jobs:
os: [k8s-linux-runner]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: radixdlt/public-iac-resuable-artifacts/rust-setup@main
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
toolchain: 1.70.0
- name: Run tests
run: cargo test
working-directory: transaction
tests-dir: transaction

transaction-scenarios:
name: Run transaction scenarios
runs-on: ${{ matrix.os }}
Expand All @@ -271,12 +275,11 @@ jobs:
os: [k8s-linux-runner]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: radixdlt/public-iac-resuable-artifacts/rust-setup@main
- uses: radixdlt/public-iac-resuable-artifacts/rust-coverage@main
with:
toolchain: 1.69.0
- name: Run tests
run: cargo test
working-directory: transaction-scenarios
tests-dir: transaction-scenarios

cli-resim-rtmc-rtmd:
name: Run CLI tests (resim & rtmc & rtmd)
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -311,6 +314,7 @@ jobs:
- name: Run tests
run: bash ./tests/manifest.sh
working-directory: simulator

cli-scrypto:
name: Run CLI tests (scrypto)
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -339,6 +343,7 @@ jobs:
- name: Run tests
run: bash ./tests/scrypto.sh
working-directory: simulator

fuzzer-check:
name: Build fuzzer
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ perf.data

#Rusty-tags
*.vi

# Coverage
*.profraw
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ members = [
"utils",
"radix-engine-profiling",
"radix-engine-profiling/resources-tracker-macro",
]
]

0 comments on commit 4ab3473

Please sign in to comment.