Skip to content

Commit

Permalink
add utils yaml, coverage-utils and modify utils tarpaulin.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Shourya742 committed Oct 11, 2024
1 parent 3b6e51f commit 5deebd4
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 1 deletion.
66 changes: 66 additions & 0 deletions .github/workflows/coverage-utils.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Util Test Coverage

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
utils-coverage:

name: tarpaulin Test
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:0.27.1-nightly
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Generate code coverage
run: |
./scripts/coverage-utils.sh
- name: Upload utils coverage to codecov.io
uses: codecov/codecov-action@v4
with:
directory: ./utils/target/tarpaulin-reports
file: ./utils/target/tarpaulin-reports/cobertura.xml
flags: utils
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload bip32_derivation-coverage to codecov.io
uses: codecov/codecov-action@v4
with:
directory: ./utils/target/tarpaulin-reports/bip32-key-derivation-coverage
file: ./utils/target/tarpaulin-reports/bip32-key-derivation-coverage/cobertura.xml
flags: bip32_derivation-coverage
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload buffer_sv2-coverage to codecov.io
uses: codecov/codecov-action@v4
with:
directory: ./utils/target/tarpaulin-reports/buffer-coverage
file: ./utils/target/tarpaulin-reports/buffer-coverage/cobertura.xml
flags: buffer_sv2-coverage

token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload error_handling-coverage to codecov.io
uses: codecov/codecov-action@v4
with:
directory: ./utils/target/tarpaulin-reports/error-handling-coverage
file: ./utils/target/tarpaulin-reports/error-handling-coverage/cobertura.xml
flags: error_handling-coverage
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload key-utils-coverage to codecov.io
uses: codecov/codecov-action@v4
with:
directory: ./utils/target/tarpaulin-reports/key-utils-coverage
file: ./utils/target/tarpaulin-reports/key-utils-coverage/cobertura.xml
flags: key-utils-coverage
token: ${{ secrets.CODECOV_TOKEN }}
26 changes: 26 additions & 0 deletions scripts/coverage-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

tarpaulin() {
crate_name=$1
output_dir="target/tarpaulin-reports/$crate_name"
mkdir -p "$output_dir"
cargo +nightly tarpaulin --verbose --out Xml --output-dir "$output_dir" --all-features
}

cd utils
tarpaulin

crates=(
"buffer"
"error-handling"
"key-utils"
"bip32-key-derivation"
)

for crate in "${crates[@]}"; do
echo "Running Tarpaulin for $crate..."
crate_name=$(basename "$crate")
cd "$crate" || exit 1
tarpaulin "$crate_name-coverage"
cd - || exit 1
done
2 changes: 1 addition & 1 deletion utils/tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[default]
run-types = [ "Lib" ]
timeout = "120s"
fail-under = 7
fail-under = 0

[report]
out = ["Xml"]

0 comments on commit 5deebd4

Please sign in to comment.