Skip to content

Commit 39c9338

Browse files
author
Tony Zhang
committed
Adding code coverage report
1 parent 7623bd7 commit 39c9338

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
branches: ['tonyz/add_cov_report']
6+
pull_request:
7+
branches: ['tonyz/add_cov_report']
8+
9+
env:
10+
COVERAGE_MODE: true
11+
12+
jobs:
13+
code_coverage:
14+
name: Code Coverage
15+
runs-on: ubuntu-24.04
16+
strategy:
17+
matrix:
18+
suite:
19+
[
20+
"\\[APM\\]",
21+
"\\[Error handling\\]",
22+
"\\[Key\\]",
23+
"\\[Network\\]",
24+
"\\[Package Management\\]",
25+
"\\[Root\\]",
26+
"\\[Local Subnet non SOV\\]",
27+
"\\[Subnet Compatibility\\]",
28+
"\\[Public Subnet non SOV\\]",
29+
"\\[Etna Subnet SOV\\]",
30+
"\\[Etna AddRemove Validator SOV PoA\\]",
31+
"\\[Etna AddRemove Validator SOV PoS\\]",
32+
"\\[Etna Add Validator SOV Local\\]",
33+
"\\[Subnet\\]",
34+
"\\[Upgrade expect network failure\\]",
35+
"\\[Upgrade public network\\]",
36+
"\\[Upgrade local network\\]",
37+
"\\[Node create\\]",
38+
"\\[Node devnet\\]",
39+
"\\[Docker\\]",
40+
]
41+
exclude:
42+
- os: ubuntu-24.04
43+
suite: "\\[Etna Subnet SOV\\]"
44+
- os: ubuntu-24.04
45+
suite: "\\[Etna AddRemove Validator SOV PoA\\]"
46+
- os: ubuntu-24.04
47+
suite: "\\[Etna AddRemove Validator SOV PoS\\]"
48+
- os: ubuntu-24.04
49+
suite: "\\[Etna Add Validator SOV Local\\]"
50+
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: Set up Go
56+
uses: actions/setup-go@v5
57+
with:
58+
go-version-file: 'go.mod'
59+
60+
- name: Use Node.js
61+
uses: actions/setup-node@v3
62+
with:
63+
node-version: "16.x"
64+
65+
- name: Yarn Install
66+
uses: nick-fields/retry@v2
67+
with:
68+
timeout_minutes: 10
69+
max_attempts: 3
70+
retry_on: error
71+
command: yarn --cwd ./tests/e2e/hardhat
72+
73+
- name: Install Typescript
74+
shell: bash
75+
run: |
76+
npm install -g typescript
77+
npm install -g ts-node
78+
npm install -g tsx
79+
80+
- name: Generate SSH token for E2E tests
81+
run: |
82+
mkdir -p ~/.ssh && ssh-keygen -b 2048 -t rsa -f ~/.ssh/runner-avalanche-cli-keypair -q -N ""
83+
echo "E2E_SSH_PUB_KEY<<EOF" >> $GITHUB_ENV
84+
cat ~/.ssh/runner-avalanche-cli-keypair >> $GITHUB_ENV
85+
echo "EOF" >> $GITHUB_ENV
86+
87+
- name: Set up SSH Agent
88+
uses: webfactory/[email protected]
89+
with:
90+
ssh-private-key: ${{ env.E2E_SSH_PUB_KEY }}
91+
92+
- name: Build with coverage
93+
working-directory: ${{ github.workspace }}
94+
run: |
95+
scripts/build.sh
96+
97+
- name: Run E2E tests with coverage
98+
shell: bash
99+
run: AVALANCHE_CLI_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} LEDGER_SIM=true scripts/run.e2e.sh --filter "${{ matrix.suite }}"
100+
101+
- name: Run Unit tests
102+
working-directory: ${{ github.workspace }}
103+
run: scripts/unit_test.sh
104+
env:
105+
CGO_CFLAGS: "-O -D__BLST_PORTABLE__" # Set the CGO flags to use the portable version of BLST
106+
107+
- name: Generate coverage report
108+
run: scripts/coverage.sh
109+
110+
- name: DEBUGGING - Listing coverage files
111+
run: |
112+
ls -laR ./coverage/
113+

0 commit comments

Comments
 (0)