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