-
Notifications
You must be signed in to change notification settings - Fork 4
120 lines (98 loc) · 3.32 KB
/
coverage.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Coverage
on: [pull_request]
jobs:
changes:
name: Check for changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
packages: ${{ steps.filter.outputs.changes }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
aform: aform/**
atable: atable/**
beam: beam/**
coverage:
name: ${{ matrix.package }} (${{ matrix.branch }})
needs: changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }}
branch:
- ${{ github.event.pull_request.base.ref }}
- ${{ github.event.pull_request.head.ref }}
include:
- branch: ${{ github.event.pull_request.base.ref }}
artifact: development
- branch: ${{ github.event.pull_request.head.ref }}
artifact: pull-request
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 20
cache-dependency-path: '**/config/rush/pnpm-lock.yaml'
registry-url: https://registry.npmjs.org/
- name: Rush Install
run: node common/scripts/install-run-rush.js install
- name: Rush Build
run: node common/scripts/install-run-rush.js rebuild --verbose
- name: Run Tests
working-directory: ./${{ matrix.package }}
run: node ../common/scripts/install-run-rushx.js test:coverage
- name: Upload Coverage
if: always() # upload the coverage report even if tests are failing
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.package }}-${{ matrix.artifact }}
path: ./${{ matrix.package }}/coverage
report:
name: ${{ matrix.package }} report
needs: [changes, coverage]
runs-on: ubuntu-latest
if: always() # run the coverage report even if tests are failing
strategy:
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 20
cache-dependency-path: '**/config/rush/pnpm-lock.yaml'
registry-url: https://registry.npmjs.org/
- name: Rush Install
run: node common/scripts/install-run-rush.js install
- name: Download PR Branch Coverage
uses: actions/download-artifact@v4
with:
name: coverage-${{ matrix.package }}-pull-request
path: ${{ matrix.package }}/coverage
- name: Download Base Branch Coverage
uses: actions/download-artifact@v4
with:
name: coverage-${{ matrix.package }}-development
path: ${{ matrix.package }}/coverage-base
- name: Report Coverage
uses: davelosert/vitest-coverage-report-action@v2
with:
working-directory: ${{ matrix.package }}
file-coverage-mode: 'all'
vite-config-path: 'vite.config.ts'
json-summary-compare-path: coverage-base/coverage-summary.json