Repository navigation
224 lines (200 loc) · 8.66 KB
/
Copy pathCI.yml
File metadata and controls
224 lines (200 loc) · 8.66 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: Flex CI
on:
push:
branches: ["release/**", "main", "feature/PubSub"]
pull_request:
branches: ["release/**", "main", "feature/PubSub"]
workflow_dispatch:
permissions:
contents: read
checks: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
debug_build_and_test:
name: Build Debug and run tests
runs-on: windows-2022
steps:
- name: Checkout Files
uses: actions/checkout@v7
id: checkout
# Real-runtime check: this repo is authored on PowerShell 7 but
# build.ps1/test.ps1 run under Windows PowerShell 5.1 below. A script
# can parse identically on both and still resolve differently at
# runtime (see comment-hygiene's ASCII-replacement map, which used to
# do exactly that). windows-2022 ships both engines, so run the
# comment-hygiene fixture suite under each rather than assuming one
# implies the other.
- name: Comment hygiene fixture tests (PowerShell 7)
id: comment-hygiene-tests-pwsh
shell: pwsh
run: |
Build/Agent/CommentHygiene.Tests.ps1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Build/Agent/Test-BuildCommentHygieneComment.ps1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Comment hygiene fixture tests (Windows PowerShell 5.1)
id: comment-hygiene-tests-winps
shell: powershell
run: |
Build\Agent\CommentHygiene.Tests.ps1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Build\Agent\Test-BuildCommentHygieneComment.ps1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
# Same dual-engine rationale as the comment-hygiene suite above: the
# token-hygiene check runs under whichever engine invoked build.ps1.
- name: Token hygiene fixture tests (PowerShell 7)
id: token-hygiene-tests-pwsh
shell: pwsh
run: |
Build/Agent/TokenHygiene.Tests.ps1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Token hygiene fixture tests (Windows PowerShell 5.1)
id: token-hygiene-tests-winps
shell: powershell
run: |
Build\Agent\TokenHygiene.Tests.ps1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
# -TokenHygiene fails CI on any hardcoded color/spacing literal in the Avalonia
# surface (full-tree, no grandfathering -- unlike -CommentHygiene, which stays
# advisory-only for humans here and only blocks agents locally).
- name: Build with tests
id: build
shell: powershell
run: |
.\build.ps1 -Configuration Debug -BuildTests -TokenHygiene
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
# Native tests run under OpenCppCoverage inside the test step below; without the tool they
# would fall back to a bare run and the native Codecov upload would fail on missing files.
- name: Install OpenCppCoverage
shell: powershell
run: |
choco install opencppcoverage --version=0.9.9.0 -y --no-progress
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Run tests
id: test
shell: powershell
run: |
.\test.ps1 -Configuration Debug -NoBuild -Coverage -TestFilter 'TestCategory!=DesktopRequired'
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: ./.github/actions/codecov-upload
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: Output/Debug/TestResults/CoverageReport/Cobertura.xml
flags: managed
name: FieldWorks
- name: Upload native coverage to Codecov
if: ${{ !cancelled() }}
uses: ./.github/actions/codecov-upload
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: Output/Debug/TestResults/native.testGenericLib.cobertura.xml,Output/Debug/TestResults/native.TestViews.cobertura.xml
flags: native
name: FieldWorks-native
- name: Summarize native test results
if: ${{ always() }}
shell: powershell
run: |
.\Build\Agent\Summarize-NativeTestResults.ps1 -Configuration Debug
- name: Collect render comparison artifacts
id: render_artifacts
if: ${{ !cancelled() && failure() }}
shell: pwsh
run: .\Build\Agent\Collect-RenderArtifacts.ps1 -SearchRoot . -OutputDirectory .\Output\RenderArtifacts
- name: Upload render comparison artifacts
id: upload_render_artifacts
if: ${{ !cancelled() && steps.render_artifacts.outputs.has_artifacts == 'true' }}
uses: actions/upload-artifact@v7
with:
name: render-comparison-artifacts-${{ github.run_id }}-${{ github.run_attempt }}
path: Output/RenderArtifacts
retention-days: 30
if-no-files-found: error
- name: Summarize render comparison artifacts
if: ${{ github.event_name == 'pull_request' && !cancelled() && (success() || steps.render_artifacts.outputs.has_artifacts == 'true') }}
shell: pwsh
continue-on-error: true
env:
ARTIFACT_URL: ${{ steps.upload_render_artifacts.outputs.artifact-url }}
FAILURE_COUNT: ${{ steps.render_artifacts.outputs.failure_count }}
HAS_ARTIFACTS: ${{ steps.render_artifacts.outputs.has_artifacts }}
run: .\Build\Agent\Report-RenderArtifacts.ps1 -SkipComment
- name: Build render comparison failure comment
id: render_failure_comment
if: ${{ github.event_name == 'pull_request' && !cancelled() && steps.render_artifacts.outputs.has_artifacts == 'true' }}
shell: pwsh
env:
ARTIFACT_URL: ${{ steps.upload_render_artifacts.outputs.artifact-url }}
FAILURE_COUNT: ${{ steps.render_artifacts.outputs.failure_count }}
HAS_ARTIFACTS: ${{ steps.render_artifacts.outputs.has_artifacts }}
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
run: .\Build\Agent\Build-RenderArtifactComment.ps1
- name: Update render comparison PR comment for failures
if: ${{ github.event_name == 'pull_request' && !cancelled() && steps.render_artifacts.outputs.has_artifacts == 'true' }}
uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 # v3.0.4
with:
header: fieldworks-render-comparison-artifacts
path: ${{ steps.render_failure_comment.outputs.comment_path }}
skip_unchanged: true
- name: Build render comparison resolved comment
id: render_clean_comment
if: ${{ github.event_name == 'pull_request' && !cancelled() && success() }}
shell: pwsh
env:
GITHUB_TOKEN: ${{ github.token }}
HAS_ARTIFACTS: false
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
run: .\Build\Agent\Build-RenderArtifactComment.ps1
- name: Update render comparison PR comment for clean run
if: ${{ github.event_name == 'pull_request' && !cancelled() && success() }}
uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 # v3.0.4
with:
header: fieldworks-render-comparison-artifacts
only_update: true
path: ${{ steps.render_clean_comment.outputs.comment_path }}
skip_unchanged: true
- name: Upload TRX test results (managed)
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: trx-results
path: |
**/*.trx
**/TestResults/crash-retries.json
if-no-files-found: warn
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() && failure() }}
with:
name: build-logs
path: |
./*.log
./Output/**/*.log
./Output/**/*.log.stderr
publish_test_results:
name: Publish Test Results
if: ${{ !cancelled() }}
needs: debug_build_and_test
runs-on: ubuntu-latest
permissions:
contents: read
issues: read
checks: write
pull-requests: write
steps:
- name: Download TRX artifacts
uses: actions/download-artifact@v8
with:
name: trx-results
path: test-results
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3
with:
files: 'test-results/**/*.trx'
check_name: NUnit Tests
comment_mode: ${{ github.event_name == 'pull_request' && 'always' || 'off' }}
job_summary: true
fail_on: test failures