Repository navigation
146 lines (124 loc) · 5.85 KB
/
Copy pathci.yml
File metadata and controls
146 lines (124 loc) · 5.85 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
name: CI
# The project had no CI at all until 2026-08-20, and the cost of that was concrete: a
# PowerShell 7 only operator in install-service.ps1 shipped in the FIRST public release and
# survived four more, making the documented install command fail before its first step on the
# default shell of every Windows host. Nothing ever checked. These two jobs are the cheapest
# things that would have caught it.
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build-test:
name: Build + test
runs-on: windows-latest # net9.0-windows10.0.19041.0 / win-x64, and the tests use Windows APIs
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.0.x'
- name: Restore
run: dotnet restore src/MultiSeat.slnx
- name: Build
run: dotnet build src/MultiSeat.slnx -c Release --no-restore
- name: Test
run: >
dotnet test src/MultiSeat.slnx -c Release --no-build
--logger "trx;LogFileName=test-results.trx"
--results-directory ${{ github.workspace }}/test-results
- name: Upload test results
if: always() # the results are most interesting exactly when the step failed
uses: actions/upload-artifact@v6
with:
name: test-results
path: test-results/
if-no-files-found: warn
dashboard:
name: Dashboard build + audit
runs-on: ubuntu-latest # pure Node work; nothing here needs Windows
# Nothing in CI touched the dashboard until now, and the cost of that was concrete too:
# 11 advisories (8 high) accumulated in package-lock.json unnoticed, and it took an
# outside scanner opening issues #34 and #35 for anyone to look. The dashboard also had
# no build check at all, so a TypeScript error would only surface during an install on a
# user's machine.
defaults:
run:
working-directory: src/MultiSeat.Dashboard
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
cache-dependency-path: src/MultiSeat.Dashboard/package-lock.json
# npm ci, not npm install: it installs exactly what the lockfile pins and fails if the
# lockfile and package.json disagree. install-service.ps1 runs npm install on the user's
# machine, so a lockfile that cannot resolve breaks the install, not the build.
- name: Install
run: npm ci
- name: Build
run: npm run build
# The dashboard has a vitest + jsdom suite (update notices today). It runs here because
# nothing else does: `npm run build` type-checks the tests but never executes them.
- name: Test
run: npm test
# This FAILS the job on a high advisory, deliberately. A warning that does not fail is
# what we already had -- nothing was watching, and 8 highs is what nothing-watching
# produces. The tradeoff is real: an advisory published upstream can break CI on an
# unrelated PR. That is the intended behaviour, not a bug. When it happens, fix it with
# `npm audit fix` (which cleared all 11 here without touching package.json), and if a
# finding genuinely does not apply, record why with `npm audit --json` in the PR rather
# than lowering this threshold.
#
# ⛔ But "found vulnerabilities" and "could not check" are NOT the same thing, and npm
# exits 1 for both. On 2026-09-11 master went red on:
#
# npm warn audit 400 Bad Request - POST .../security/audits/quick
# message: 'Invalid package tree, run npm install to rebuild your package-lock.json'
# npm error audit endpoint returned an error
#
# The same commit had passed this job on its PR 45 minutes earlier and passed locally
# afterwards, so that was the registry, not the lockfile. Failing the build on it makes
# CI hostage to npmjs.org availability and turns this into exactly the intermittently
# red check that teaches people to ignore CI -- the thing build.yml was deleted for in
# MoonlightVibe.
#
# So: retry a transport error, and warn rather than fail if it persists. A real finding
# still fails on the first attempt.
- name: Audit
shell: bash
run: |
for attempt in 1 2 3; do
if out=$(npm audit --audit-level=high 2>&1); then
echo "$out"
exit 0
fi
echo "$out"
if echo "$out" | grep -qiE "audit endpoint returned an error|Bad Request|ENOTFOUND|ETIMEDOUT|EAI_AGAIN|socket hang up"; then
echo "::notice::npm audit could not reach the registry (attempt ${attempt}/3) — retrying"
sleep $((attempt * 10))
continue
fi
# Not a transport problem: npm found something at or above the threshold.
echo "::error::npm audit reported vulnerabilities at high severity or above"
exit 1
done
echo "::warning::npm audit could not reach the registry after 3 attempts. Dependencies were NOT audited in this run — check manually before relying on it."
lint-scripts:
name: Script lint (PowerShell 5.1 + 7)
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
# Both engines, deliberately. They disagree, and 5.1 is the one a user gets by typing
# "powershell" - a script can parse perfectly under 7 and be dead on arrival under 5.1,
# which is exactly what shipped in April. Proven against controls: a file using
# (Get-Command x)?.Source fails here under 5.1 and passes under 7.
- name: Windows PowerShell 5.1
shell: powershell
run: .\scripts\lint-scripts.ps1
- name: PowerShell 7
shell: pwsh
run: .\scripts\lint-scripts.ps1