-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (110 loc) · 4.91 KB
/
Copy pathci.yml
File metadata and controls
131 lines (110 loc) · 4.91 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
name: CI
# Windows only, and not by preference: Quantumwake.Overlay targets
# net10.0-windows for WPF, so the solution cannot restore on a Linux runner.
# Core, Data, Server and the tests are all plain net10.0 and would build
# anywhere - if a Linux-hosted server mode ever lands, split the solution and
# add an ubuntu job for those four.
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: '10.0.x'
- name: Restore
run: dotnet restore Quantumwake.slnx
- name: Build
run: dotnet build Quantumwake.slnx -c Release --no-restore
# The parser is fixture-driven against real log lines, so a green run here
# means the formats still parse - not merely that everything compiles.
- name: Test
run: dotnet test Quantumwake.slnx -c Release --no-build --logger "trx;LogFileName=results.trx" --results-directory artifacts/test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
path: artifacts/test
if-no-files-found: ignore
# The most expensive failure this project has is silent: the parser learns to
# read something, and nobody sees it, because backups are skipped by
# fingerprint and every existing session keeps a summary written before the
# field existed. It shipped that way once with medical beds and once with
# commodity purchases, both caught after the fact.
#
# PayloadVersion is the fix - it retires every cached row - and the release
# workflow already proves that a check is what makes "always bump the version"
# a rule rather than a habit. This is the same idea for the other version
# nobody remembers.
#
# Ubuntu on purpose: this is git and grep, and needs none of the SDK.
payload-version:
name: Cached sessions retired
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: A parser change must retire the cache
shell: bash
env:
BASE: ${{ github.event.pull_request.base.sha }}
run: |
set -euo pipefail
changed=$(git diff --name-only "$BASE"...HEAD)
# What can widen a stored summary: the parser that reads events, the
# events themselves, the builder that folds them up, and the record it
# produces. Anything else may change freely.
shaping=$(echo "$changed" | grep -E \
'^src/Quantumwake\.Core/(Parsing/|Events/|State/Session\.cs|State/SessionBuilder\.cs)' \
|| true)
if [ -z "$shaping" ]; then
echo "No payload-shaping file touched; nothing to retire."
exit 0
fi
echo "Payload-shaping files in this change:"
echo "$shaping" | sed 's/^/ /'
# Touching SessionStore.cs is not enough - the constant has to move.
if git diff "$BASE"...HEAD -- src/Quantumwake.Data/SessionStore.cs \
| grep -qE '^\+.*PayloadVersion = [0-9]+'; then
echo
echo "PayloadVersion moves in this change. Caches will be retired."
exit 0
fi
# A comment fix or a rename genuinely changes nothing stored, and a
# check that cannot be answered is a check people learn to ignore.
#
# A trailer, anchored to the start of a line, rather than a bare word
# anywhere in the message: the commit that first documented this
# waiver waived the check by explaining it, which is a poor way for a
# guard to fail. Prose can now name the trailer without invoking it.
if git log "$BASE"..HEAD --format='%B' | grep -qiE '^No-payload-bump:[[:space:]]*[^[:space:]]'; then
echo
echo "Waived by a commit trailer:"
git log "$BASE"..HEAD --format='%B' | grep -iE '^No-payload-bump:' | sed 's/^/ /'
exit 0
fi
echo
echo "::error::This change touches the parser or the session summary, but"
echo "::error::PayloadVersion in src/Quantumwake.Data/SessionStore.cs does not move."
echo "::error::"
echo "::error::Sessions already on disk are skipped by fingerprint, so whatever"
echo "::error::this now reads will be invisible to every install that has run"
echo "::error::before - the ones with the most history. Bump the constant, or, if"
echo "::error::nothing stored actually changed, add a commit trailer on its own line:"
echo "::error::"
echo "::error:: No-payload-bump: renamed a private field, nothing new is read"
exit 1