-
-
Notifications
You must be signed in to change notification settings - Fork 496
369 lines (327 loc) · 11.5 KB
/
Copy pathdotnetcore.yml
File metadata and controls
369 lines (327 loc) · 11.5 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
###################################################
# Magicodes.IE CI
#
# Architecture:
# changed -> skip detection (docs-only PRs skip tests)
# test -> legacy core test matrix
# io-test -> IO test matrix (all platforms, net8.0+net10.0)
# io-test-macos-debug -> macOS arm64 Debug CRC32 self-check
# check -> alls-green gate (single required status check)
#
# Matrix coverage:
# test: 7 OS × [net8.0, net10.0] + net9.0 × 3 + net471/net6.0 (Win)
# io: 3 OS × [net8.0, net10.0] + net6.0 × 3 + net471 (Win) + macOS Debug CRC trap
# Total: ~30 parallel jobs (fail-fast: false)
#
# Test runner conventions:
# --filter Category!=Flaky exclude flaky tests (MassTransit pattern)
# --logger GitHubActions native PR annotations (MassTransit pattern)
# --blame-hang/crash-dump post-mortem diagnostics (Orleans pattern)
# -bl binary log (Orleans pattern)
#
# Notes:
# - macOS: Qt cocoa plugin may crash on process exit in headless CI.
# We parse "Test Run Successful"/"Test Run Failed" to distinguish.
# - net471 / net6.0: Windows only.
# - Runner versions pinned where possible (Polly/efcore pattern).
###################################################
name: CI
on:
push:
branches: [ "develop", "release/*", "master" ]
pull_request:
branches: [ "develop", "release/*", "master" ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1
TERM: xterm
TEST_PROJECT: src/Magicodes.ExporterAndImporter.Tests/Magicodes.IE.Tests.csproj
jobs:
# ── SKIP DETECTION ──────────────────────────────
changed:
name: Detect changes
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip.outputs.should_skip }}
steps:
- uses: actions/checkout@v4
- name: Check changed files
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
code:
- 'src/**'
- 'tests/**'
- '*.sln'
- '*.props'
- 'Directory.Build.*'
- '.github/workflows/dotnetcore.yml'
list-files: json
- name: Set skip flag
id: skip
run: |
if [ "${{ steps.filter.outputs.code }}" == "false" ]; then
echo "should_skip=true" >> "$GITHUB_OUTPUT"
else
echo "should_skip=false" >> "$GITHUB_OUTPUT"
fi
# ── LEGACY CORE TEST MATRIX ─────────────────────
test:
name: ${{ matrix.os }} / ${{ matrix.framework }}
needs: changed
if: needs.changed.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- ubuntu-24.04
- ubuntu-latest
- windows-2022
- windows-latest
- macos-15
- macos-latest
framework:
- net8.0
- net10.0
include:
# net9.0 STS: one per OS family
- { os: ubuntu-latest, framework: net9.0 }
- { os: windows-latest, framework: net9.0 }
- { os: macos-latest, framework: net9.0 }
# Windows-only legacy frameworks
- { os: windows-latest, framework: net471 }
- { os: windows-latest, framework: net6.0 }
steps:
- uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
10.0.x
cache: true
cache-dependency-path: |
Magicodes.IE.sln
src/**/*.csproj
# ── OS-specific pre-flight ──
- name: Install native dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libgdiplus libc6-dev libjpeg62 libxrender1 \
fontconfig xfonts-75dpi
- name: Install wkhtmltopdf (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install -y wkhtmltopdf || true
- name: Set TEMP to D-drive (Windows speedup)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -Path "D:\Temp" -ItemType Directory -Force | Out-Null
"TEMP=D:\Temp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# ── Build & Test ──
- name: Restore
run: dotnet restore ${{ env.TEST_PROJECT }}
- name: Build
run: dotnet build ${{ env.TEST_PROJECT }} -c Release --no-restore -bl
- name: Test
shell: bash
run: |
# macOS: Qt cocoa plugin may crash on process exit in headless CI.
# We tee the output and check for "Test Run Successful"/"Test Run Failed"
# to distinguish real test failures from Qt cleanup crashes.
dotnet test ${{ env.TEST_PROJECT }} \
-c Release --no-build \
-f ${{ matrix.framework }} \
--filter Category!=Flaky \
--blame-hang-timeout 10m \
--blame-crash-dump-type full \
--blame-hang-dump-type full \
--logger "trx;LogFileName=results-${{ matrix.framework }}.trx" \
--logger GitHubActions \
--results-directory TestResults \
2>&1 | tee /tmp/test-output.log
EXIT=${PIPESTATUS[0]}
if [ $EXIT -ne 0 ]; then
if [ "$RUNNER_OS" = "macOS" ] && grep -q "Test Run Successful\." /tmp/test-output.log; then
echo "::warning::Test process exit $EXIT (Qt cocoa plugin cleanup); all tests passed"
else
echo "::error::Test run failed (exit $EXIT)"
exit 1
fi
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ runner.os }}-${{ matrix.framework }}
path: TestResults
if-no-files-found: ignore
retention-days: 7
- name: Upload build log
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-log-${{ runner.os }}-${{ matrix.framework }}
path: msbuild.binlog
if-no-files-found: ignore
retention-days: 7
# ── IO TEST MATRIX ──────────────────────────────
io-test:
name: IO ${{ matrix.os }} / ${{ matrix.framework }}
needs: changed
if: needs.changed.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
framework: [net8.0, net10.0]
include:
- { os: ubuntu-latest, framework: net6.0 }
- { os: windows-latest, framework: net6.0 }
- { os: macos-latest, framework: net6.0 }
- { os: windows-latest, framework: net471 }
env:
IO_TEST_PROJECT: tests/Magicodes.IE.IO.Tests/Magicodes.IE.IO.Tests.csproj
steps:
- uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
10.0.x
cache: true
cache-dependency-path: |
Magicodes.IE.sln
src/**/*.csproj
- name: Restore
run: dotnet restore ${{ env.IO_TEST_PROJECT }}
- name: Build
run: dotnet build ${{ env.IO_TEST_PROJECT }} -c Release --no-restore -bl
- name: Test
run: >
dotnet test ${{ env.IO_TEST_PROJECT }}
-c Release --no-build
-f ${{ matrix.framework }}
--filter Category!=Flaky
--blame-hang-timeout 10m
--blame-crash-dump-type full
--blame-hang-dump-type full
--logger "trx;LogFileName=results-io-${{ matrix.framework }}.trx"
--logger GitHubActions
--results-directory TestResults
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: io-test-results-${{ matrix.os }}-${{ matrix.framework }}
path: TestResults
if-no-files-found: ignore
retention-days: 7
- name: Upload build log
if: failure()
uses: actions/upload-artifact@v4
with:
name: io-build-log-${{ matrix.os }}-${{ matrix.framework }}
path: msbuild.binlog
if-no-files-found: ignore
retention-days: 7
# ── IO CRC32 SELF-CHECK (macOS arm64 / Debug) ──
#
# ForwardOnlyZipWriter has an #if DEBUG CRC32 self-check
# ("123456789" => 0xCBF43926). A wrong arm64 CRC throws at
# assembly load. Release CRC is still exercised by ZipArchive
# reopen assertions in the io-test matrix above.
io-test-macos-debug:
name: IO Debug (macOS arm64 CRC check)
needs: changed
if: needs.changed.outputs.should_skip != 'true'
runs-on: macos-latest
timeout-minutes: 15
env:
IO_TEST_PROJECT: tests/Magicodes.IE.IO.Tests/Magicodes.IE.IO.Tests.csproj
steps:
- uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
cache: true
cache-dependency-path: |
Magicodes.IE.sln
src/**/*.csproj
- name: Restore
run: dotnet restore ${{ env.IO_TEST_PROJECT }}
- name: Build
run: dotnet build ${{ env.IO_TEST_PROJECT }} -c Debug --no-restore -bl
- name: Test
shell: bash
run: |
set +e
dotnet test ${{ env.IO_TEST_PROJECT }} \
-c Debug --no-build \
-f net8.0 \
--filter Category!=Flaky \
--blame-hang-timeout 10m \
--blame-crash-dump-type full \
--blame-hang-dump-type full \
--logger "trx;LogFileName=results-io-macos-debug.trx" \
--logger GitHubActions \
--results-directory TestResults
EXIT=$?
set -e
if [ $EXIT -ne 0 ]; then
echo "::error::IO tests failed on macOS arm64 (Debug CRC self-check active)"
exit 1
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: io-test-results-macos-debug
path: TestResults
if-no-files-found: ignore
retention-days: 7
- name: Upload build log
if: failure()
uses: actions/upload-artifact@v4
with:
name: io-build-log-macos-debug
path: msbuild.binlog
if-no-files-found: ignore
retention-days: 7
# ── ALLS-GREEN GATE ─────────────────────────────
check:
name: CI Passed
if: always()
needs: [changed, test, io-test, io-test-macos-debug]
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
allowed-skips: >-
${{
needs.changed.outputs.should_skip == 'true'
&& 'test,io-test,io-test-macos-debug'
|| ''
}}
jobs: ${{ toJSON(needs) }}