From 05865ae9b4664e2f0817ff7ab89b6f6441f7c948 Mon Sep 17 00:00:00 2001 From: RJ Rybarczyk Date: Mon, 29 Nov 2021 20:35:20 +0000 Subject: [PATCH] Cargo tarpaulin GH Actions code coverage --- .github/workflows/coverage.yaml | 30 +++++++++++++++++++ .../mining-proxy/src/lib/upstream_mining.rs | 8 +++++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/coverage.yaml diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 0000000000..c647f238c7 --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,30 @@ +on: + push: + branches: + - main + pull_request: + branches: + - main + +name: Code Coverage + +jobs: + test: + name: Coverage + runs-on: ubuntu-latest + container: + image: xd009642/tarpaulin:develop-nightly + options: --security-opt seccomp=unconfined + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Generate code coverage + run: | + # cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml + cargo +nightly tarpaulin --root roles/v2/mining-proxy --timeout 120 + + - name: Upload to codecov.io + uses: codecov/codecov-action@v2 + with: + fail_ci_if_error: true diff --git a/roles/v2/mining-proxy/src/lib/upstream_mining.rs b/roles/v2/mining-proxy/src/lib/upstream_mining.rs index a3aff0f5bd..9668afcd3d 100644 --- a/roles/v2/mining-proxy/src/lib/upstream_mining.rs +++ b/roles/v2/mining-proxy/src/lib/upstream_mining.rs @@ -318,3 +318,11 @@ impl UpstreamMiningNodes { Err(()) } } + +#[cfg(test)] +mod tests { + #[test] + fn test_one() { + assert_eq!(1, 1); + } +}