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