forked from matter-labs/era-test-node
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (76 loc) · 2.57 KB
/
coverage.yml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Code Coverage
on:
pull_request:
push:
branches:
- master
jobs:
build-and-test-with-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install llvm tools
run: rustup component add llvm-tools-preview
- 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: Prepare for coverage
run: |
cargo llvm-cov clean --workspace
- name: Run tests with Coverage
run: |
# Run Unit Tests
cargo llvm-cov nextest --no-report --all
# Room for other test suites types to run here...
## Launch Node /w coverage - uncomment when E2E tests ready
# cargo llvm-cov run --no-report -- run > era_test_node_output.log 2>&1 &
# cd e2e-tests
# yarn install
# yarn build
# yarn test
- name: Generate Coverage Report
run: |
echo "TOTAL_COV=${cargo llvm-cov report --summary-only | grep 'TOTAL' | awk '{print $4}' }" >> $GITHUB_ENV
cargo llvm-cov report --html
- name: Upload coverage to GitHub Actions
uses: actions/[email protected]
with:
name: coverage
path: coverage
- name: Post coverage to PR
if: github.event_name == 'pull_request'
run: |
echo "Code coverage for this PR is: $TOTAL_COV"
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: Coverage generated
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Code coverage for this PR is: ${{ env.TOTAL_COV }}
edit-mode: replace
reactions: "eyes"
- name: Zip and Upload Coverage Report
uses: actions/[email protected]
with:
name: coverage-report
path: target/llvm-cov/html
- name: Stop the era_test_node
id: stop_node
if: always()
run: |
yarn dev:kill