-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (77 loc) · 2.35 KB
/
unit-tests.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: Unit Testing
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
run-coverage-shards:
name: Run Coverage for Shards
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [shard1, shard2, shard3]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use Node v20
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Compile contracts
run: yarn compile
- name: Set Shard Environment Variable
run: echo "SHARD=${{ matrix.shard }}" >> $GITHUB_ENV
- name: Run Coverage for ${{ matrix.shard }}
run: yarn test:coverage:solidity
- name: Upload Coverage for ${{ matrix.shard }}
uses: actions/upload-artifact@v3
with:
name: coverage-${{ matrix.shard }}
path: coverage/coverage-final.json
combine-coverage:
name: Combine Coverage Reports
runs-on: ubuntu-latest
needs: run-coverage-shards
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Download All Coverage Artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for shard in shard1 shard2 shard3; do
echo "Downloading artifact coverage-$shard"
mkdir -p coverage-shards/$shard
gh run download --name "coverage-$shard" --dir coverage-shards/$shard
done
- name: Merge Coverage Reports
run: |
npx ts-node scripts/helpers/merge-coverage.ts
- name: Create .nyc_output Directory
run: mkdir -p .nyc_output
- name: Generate Final Coverage Report
run: |
yarn coverage:report
- name: Upload Unified Coverage Report to Codecov
uses: codecov/codecov-action@v4
with:
directory: coverage/
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
report-unit-testing:
name: Unit Testing
runs-on: ubuntu-latest
needs: [run-coverage-shards, combine-coverage]
steps:
- name: Success Message
run: echo "All Unit Testing Jobs Completed!"