-
Notifications
You must be signed in to change notification settings - Fork 782
69 lines (62 loc) · 2.44 KB
/
Copy pathvalidate-doc-snippets.yml
File metadata and controls
69 lines (62 loc) · 2.44 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
name: Validate Doc Snippets
# Compiles every C# code block in the AI agent docs against the built Terminal.Gui
# assembly (see Scripts/DocSnippetValidator/README.md). Runs when the docs change
# AND when the library changes, so API changes that break documented examples fail
# here instead of silently rotting the docs.
on:
push:
branches: [develop]
paths:
- 'ai-v2-primer.md'
- '.claude/tasks/build-app.md'
- '.claude/cookbook/common-patterns.md'
- 'llms.txt'
- 'Terminal.Gui/**'
- 'Scripts/DocSnippetValidator/**'
- '.github/workflows/validate-doc-snippets.yml'
pull_request:
paths:
- 'ai-v2-primer.md'
- '.claude/tasks/build-app.md'
- '.claude/cookbook/common-patterns.md'
- 'llms.txt'
- 'Terminal.Gui/**'
- 'Scripts/DocSnippetValidator/**'
- '.github/workflows/validate-doc-snippets.yml'
jobs:
validate-doc-snippets:
name: Validate Doc Snippets
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0 # GitVersion.MsBuild needs full history
- name: Setup .NET Core
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
dotnet-quality: 'ga'
- name: Build Terminal.Gui
run: dotnet build Terminal.Gui/Terminal.Gui.csproj --configuration Debug
- name: Validate snippets
run: |
dotnet run --project Scripts/DocSnippetValidator --configuration Debug -- \
Terminal.Gui/bin/Debug/net10.0/Terminal.Gui.dll \
ai-v2-primer.md \
.claude/tasks/build-app.md \
.claude/cookbook/common-patterns.md \
llms.txt
# Negative test: the validator must REJECT a snippet using obsolete v1 APIs
# (CS0618/CS0612), so the v1 rot this workflow prevents cannot slip back in
# as "compiled". Expect a non-zero exit on the fixture.
- name: Validate rejects obsolete APIs (negative test)
run: |
if dotnet run --project Scripts/DocSnippetValidator --configuration Debug -- \
Terminal.Gui/bin/Debug/net10.0/Terminal.Gui.dll \
Scripts/DocSnippetValidator/testdata/obsolete-api.md; then
echo "::error::validator accepted an obsolete-API snippet; CS0618/CS0612 must fail"
exit 1
fi
echo "negative test passed: validator rejected the obsolete-API fixture"