-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (48 loc) · 1.65 KB
/
code-coverage-badge.yaml
File metadata and controls
50 lines (48 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Code Coverage Push
on:
push:
branches:
- main
jobs:
test:
runs-on: blacksmith-16vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- name: Caching Rust Dependencies
uses: useblacksmith/cache@v5
with:
path: |
~/.cargo/bin
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: rustup update 1.87
- run: rustup default 1.87
- run: cargo install cargo-tarpaulin --force
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libclang-dev clang
- name: Run Code Coverage
run: |
cargo tarpaulin --all-targets --exclude-files "target/*" --count --out Json
mv ./tarpaulin-report.json target/tarpaulin/coverage.json
env:
MNEMONIC: ${{ secrets.TEST_MNEMONIC }}
MNEMONIC_TO: ${{ secrets.TEST_MNEMONIC_TO }}
IS_TESTNET: "true"
- name: Show coverage report for debugging
if: always()
run: cat target/tarpaulin/coverage.json
- name: Generate Coverage Badge
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
pip install anybadge
python workflows/update_coverage.py
- name: Deploy badge to gh-pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./badges_output
keep_files: true