-
-
Notifications
You must be signed in to change notification settings - Fork 4
179 lines (170 loc) · 6.42 KB
/
Copy pathci.yml
File metadata and controls
179 lines (170 loc) · 6.42 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
name: Test (${{ matrix.os }}, Node ${{ matrix.node-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Windows is intentionally excluded from the unit-test matrix:
# node-pty's `conpty_console_list_agent.js` helper crashes
# repeatedly with "AttachConsole failed" on the GitHub Actions
# Windows runner, leaving zombie file handles that hang per-file
# workers past the 180s test-timeout. Every code path tested
# here is also exercised on Linux + macOS, so we lose no
# coverage. Windows-specific behavior (PTY shell launch + UI)
# is still covered end-to-end by the `e2e (windows-latest)`
# job below, which is the only Windows test path that actually
# catches Windows-specific bugs.
os: [ubuntu-latest, macos-latest]
# Node 20 dropped after EOL (2026-04-30). See package.json engines.
node-version: [22, 24]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Build frontend
run: cd src/frontend && npm ci && npm run build
- run: npm test
coverage:
name: Coverage
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
cache: npm
- run: npm ci
- name: Build frontend
run: cd src/frontend && npm ci && npm run build
- run: npm run test:coverage
- name: Coverage Report
if: github.event_name == 'pull_request'
uses: davelosert/vitest-coverage-report-action@3c054a2d2e2ca45446417ad5d6d5eb33092af8f1 # v2
with:
json-summary-path: coverage/coverage-summary.json
json-final-path: coverage/coverage-final.json
file-coverage-mode: all
- name: Update coverage badge
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
COVERAGE=$(node -e "const c = require('./coverage/coverage-summary.json'); console.log(c.total.lines.pct)")
if (( $(echo "$COVERAGE >= 90" | bc -l) )); then COLOR="brightgreen"
elif (( $(echo "$COVERAGE >= 75" | bc -l) )); then COLOR="green"
elif (( $(echo "$COVERAGE >= 60" | bc -l) )); then COLOR="yellowgreen"
elif (( $(echo "$COVERAGE >= 45" | bc -l) )); then COLOR="yellow"
else COLOR="red"; fi
echo "{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"${COVERAGE}%\",\"color\":\"${COLOR}\"}" > /tmp/endpoint.json
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if git fetch origin coverage-data 2>/dev/null; then
git checkout coverage-data
else
git checkout --orphan coverage-data
git rm -rf . 2>/dev/null || true
fi
cp /tmp/endpoint.json endpoint.json
git add endpoint.json
git commit -m "Update coverage badge to ${COVERAGE}%" || true
git push origin coverage-data
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
cache: npm
- run: npm ci
- run: node --check src/server/*.js src/cli/*.js src/tunnel/*.js src/utils/*.js bin/*.js
frontend:
name: Frontend Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
cache: npm
- run: npm ci
- name: Install frontend dependencies
run: cd src/frontend && npm ci
- name: Type-check frontend
run: cd src/frontend && npx tsc --noEmit
- name: Build frontend
run: cd src/frontend && npm run build
- name: Verify build output
run: test -f public/index.html
e2e:
name: E2E (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
cache: npm
- run: npm ci
- name: Build frontend
run: cd src/frontend && npm ci && npm run build
- name: Install Playwright (Linux)
if: runner.os == 'Linux'
run: npx playwright install --with-deps chromium
- name: Install Playwright
if: runner.os != 'Linux'
run: npx playwright install chromium
- name: Run E2E tests
run: npx playwright test
env:
CI: true
- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: playwright-report-${{ matrix.os }}
path: playwright-report/
retention-days: 7
- name: Upload test traces
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: playwright-traces-${{ matrix.os }}
path: test-results/
retention-days: 7
devtunnel-install:
name: DevTunnel Install (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
cache: npm
- run: npm ci
- run: node --test test/tunnel/devtunnel-install.test.js