-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (122 loc) · 4.29 KB
/
Copy pathci.yml
File metadata and controls
156 lines (122 loc) · 4.29 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y python3 make g++
- name: Install npm dependencies
run: npm ci
- name: Rebuild native modules for CI Node version
run: npm rebuild better-sqlite3-multiple-ciphers
- name: Security audit (production dependencies)
run: npm audit --omit=dev --audit-level=moderate
- name: Lint
run: npm run lint
- name: Type check
run: npx tsc -p jsconfig.json --noEmit
- name: Run core tests
run: npm test
- name: Rebuild native modules for Node.js
run: npm rebuild better-sqlite3-multiple-ciphers
- name: Run service tests
run: npm run test:services
- name: Run IPC tests
run: npm run test:ipc
- name: Run load tests
run: npm run test:load
- name: Run component tests with coverage
run: npx vitest run --coverage
- name: Check coverage threshold
run: |
node -e "
const fs = require('fs');
const summary = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8'));
const total = summary.total;
const hardMin = 8;
const target = 60;
const lines = total.lines.pct;
const branches = total.branches.pct;
console.log('Coverage - Lines: ' + lines + '%, Branches: ' + branches + '%');
console.log('Hard minimum: ' + hardMin + '%, Target: ' + target + '%');
if (lines < hardMin || branches < hardMin) {
console.error('Coverage below hard minimum of ' + hardMin + '%');
process.exit(1);
}
if (lines < target || branches < target) {
console.log('::warning::Coverage below target of ' + target + '% — increase test coverage');
} else {
console.log('Coverage target met (' + target + '%)');
}
"
- name: Rebuild for Electron
run: npx @electron/rebuild -f
- name: Build
run: npm run build
- name: Generate SBOM
run: npx cyclonedx-npm --ignore-npm-errors --output-file sbom.json --output-format JSON
- name: Upload SBOM artifact
uses: actions/upload-artifact@v7
with:
name: sbom
path: sbom.json
retention-days: 90
e2e:
name: Playwright E2E Tests
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y python3 make g++ xvfb
- name: Install npm dependencies
run: npm ci
- name: Rebuild native modules for Electron
run: npx @electron/rebuild -f
- name: Build renderer
run: npm run build
- name: Install Playwright Electron dependencies
run: npx playwright install --with-deps chromium
- name: Run E2E tests
env:
# The seed step in electron/database/init.cjs reads this env var to
# provision the first-launch admin password deterministically; the
# E2E spec reads the same var so the login step doesn't depend on
# the random setup token written to userData.
TRANSTRACK_INITIAL_ADMIN_PASSWORD: 'E2E_ONLY_DoNotUseInProd!'
run: xvfb-run --auto-servernum npm run test:e2e
- name: Upload E2E report
if: always()
uses: actions/upload-artifact@v7
with:
name: e2e-report
path: playwright-report
retention-days: 30
build-windows:
name: Windows Build Verification
runs-on: windows-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install npm dependencies
run: npm ci
- name: Build renderer
run: npm run build
- name: Run core tests
run: npm test