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+ workflow_dispatch :
9+ inputs :
10+ branch :
11+ description : " Define branch name"
12+ required : true
13+ env :
14+ COVERAGE_MODE : true
15+
16+ jobs :
17+ code_coverage :
18+ name : Code Coverage
19+ runs-on : ubuntu-24.04
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v4
23+
24+ - name : Set up Go
25+ uses : actions/setup-go@v5
26+ with :
27+ go-version-file : ' go.mod'
28+
29+ - name : Use Node.js
30+ uses : actions/setup-node@v3
31+ with :
32+ node-version : " 16.x"
33+
34+ - name : Yarn Install
35+ uses : nick-fields/retry@v2
36+ with :
37+ timeout_minutes : 10
38+ max_attempts : 3
39+ retry_on : error
40+ command : yarn --cwd ./tests/e2e/hardhat
41+
42+ - name : Install Typescript
43+ shell : bash
44+ run : |
45+ npm install -g typescript
46+ npm install -g ts-node
47+ npm install -g tsx
48+
49+ - name : Generate SSH token for E2E tests
50+ run : |
51+ mkdir -p ~/.ssh && ssh-keygen -b 2048 -t rsa -f ~/.ssh/runner-avalanche-cli-keypair -q -N ""
52+ echo "E2E_SSH_PUB_KEY<<EOF" >> $GITHUB_ENV
53+ cat ~/.ssh/runner-avalanche-cli-keypair >> $GITHUB_ENV
54+ echo "EOF" >> $GITHUB_ENV
55+
56+ - name : Set up SSH Agent
57+ uses :
webfactory/[email protected] 58+ with :
59+ ssh-private-key : ${{ env.E2E_SSH_PUB_KEY }}
60+
61+ - name : Build with coverage
62+ working-directory : ${{ github.workspace }}
63+ run : |
64+ scripts/build.sh
65+
66+ - name : Run E2E tests with coverage
67+ working-directory : ${{ github.workspace }}
68+ shell : bash
69+ run : AVALANCHE_CLI_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} LEDGER_SIM=true scripts/run.e2e.sh
70+
71+ - name : Run Unit tests
72+ working-directory : ${{ github.workspace }}
73+ run : scripts/unit_test.sh
74+ env :
75+ CGO_CFLAGS : " -O -D__BLST_PORTABLE__" # Set the CGO flags to use the portable version of BLST
76+
77+ - name : Generate coverage report
78+ run : scripts/coverage.sh
79+
80+ - name : Archive code coverage results
81+ uses : actions/upload-artifact@v4
82+ with :
83+ name : code-coverage
84+ path : coverage/merged/merged.txt
85+
86+ - name : Coverage report
87+ 88+ with :
89+ coverage-artifact-name : " code-coverage"
90+ coverage-file-name : " merged.txt"
91+ continue-on-error : true
92+
0 commit comments