-
Notifications
You must be signed in to change notification settings - Fork 2
102 lines (84 loc) · 2.41 KB
/
frontend.yml
File metadata and controls
102 lines (84 loc) · 2.41 KB
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
name: Frontend
on:
push:
branches: [develop, main]
paths:
- 'frontend/**'
- 'api/proto/**'
- '.github/workflows/frontend.yml'
pull_request:
branches: [develop, main]
paths:
- 'frontend/**'
- 'api/proto/**'
- '.github/workflows/frontend.yml'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Frontend Tests & Coverage
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Generate protobuf TypeScript clients
run: npm run generate
- name: Typecheck
run: npm run typecheck
- name: Run tests with coverage
run: npx vitest run --coverage --reporter=verbose
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: frontend/coverage/
retention-days: 7
if-no-files-found: ignore
- name: Check 80% line coverage threshold
run: |
node -e "
const s = require('./coverage/coverage-summary.json');
const pct = s.total.lines.pct;
console.log('Line coverage: ' + pct + '%');
if (pct < 80) {
console.error('Coverage ' + pct + '% is below the 80% minimum threshold');
process.exit(1);
}
console.log('Coverage ' + pct + '% meets the 80% minimum threshold');
"
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Generate protobuf TypeScript clients
run: npm run generate
- name: Lint
run: npm run lint