-
-
Notifications
You must be signed in to change notification settings - Fork 496
295 lines (269 loc) · 9.09 KB
/
Copy pathdotnetcore.yml
File metadata and controls
295 lines (269 loc) · 9.09 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
###################################################
# Magicodes.IE CI
#
# Platforms: ubuntu-22.04, ubuntu-24.04, ubuntu-latest,
# windows-2022, windows-latest,
# macos-15, macos-latest
# Frameworks: net6.0, net8.0, net9.0, net10.0, net471
#
# Architecture:
# changed -> skip detection (docs-only PRs skip tests)
# test -> build & test matrix
# check -> alls-green gate (single required status check)
#
# Test runner:
# -parallel none -noshadow (Orleans pattern, prevents file locking)
# --filter Category!=Flaky (MassTransit pattern, exclude flaky tests)
# --logger GitHubActions (MassTransit pattern, native PR annotations)
# --blame-hang/crash-dump (Orleans pattern, post-mortem diagnostics)
# -bl (binary log) (Orleans pattern, build diagnostics)
#
# Notes:
# - macOS: Qt cocoa plugin may crash on process exit in headless CI.
# Tests pass before the crash; warnings are emitted, not failures.
# - net471 / net6.0: Windows only (requires .NET Framework targeting pack).
# - Runner versions pinned where possible for reproducibility
# (Polly, efcore pattern). -latest aliases shift without notice.
###################################################
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:
- name: Checkout
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
###################################################
# BUILD & TEST
###################################################
test:
name: ${{ matrix.name }}
needs: changed
if: needs.changed.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
# ---- Linux ----
- name: "ubuntu-22.04 / net8.0"
os: ubuntu-22.04
framework: net8.0
- name: "ubuntu-22.04 / net10.0"
os: ubuntu-22.04
framework: net10.0
- name: "ubuntu-24.04 / net8.0"
os: ubuntu-24.04
framework: net8.0
- name: "ubuntu-24.04 / net9.0"
os: ubuntu-24.04
framework: net9.0
- name: "ubuntu-24.04 / net10.0"
os: ubuntu-24.04
framework: net10.0
- name: "ubuntu-latest / net8.0"
os: ubuntu-latest
framework: net8.0
- name: "ubuntu-latest / net10.0"
os: ubuntu-latest
framework: net10.0
# ---- Windows ----
- name: "windows-2022 / net8.0"
os: windows-2022
framework: net8.0
- name: "windows / net6.0"
os: windows-latest
framework: net6.0
- name: "windows / net8.0"
os: windows-latest
framework: net8.0
- name: "windows / net9.0"
os: windows-latest
framework: net9.0
- name: "windows / net10.0"
os: windows-latest
framework: net10.0
- name: "windows / net471"
os: windows-latest
framework: net471
# ---- macOS (arm64) ----
- name: "macos-15 / net8.0"
os: macos-15
framework: net8.0
- name: "macos-15 / net10.0"
os: macos-15
framework: net10.0
- name: "macos / net8.0"
os: macos-latest
framework: net8.0
- name: "macos / net9.0"
os: macos-latest
framework: net9.0
- name: "macos / net10.0"
os: macos-latest
framework: net10.0
steps:
- name: Checkout
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
- 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
- name: Restore
run: dotnet restore ${{ env.TEST_PROJECT }}
- name: Build
run: dotnet build ${{ env.TEST_PROJECT }} -c Release --no-restore -bl
- name: Test
if: runner.os == 'Windows'
run: >
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
- name: Test (Linux)
if: runner.os == 'Linux'
run: >
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
- name: Test (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
# Qt cocoa plugin may crash on process exit in headless CI.
# All tests pass before the crash; we capture results first.
set +e
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
TEST_EXIT=$?
set -e
if [ $TEST_EXIT -ne 0 ]; then
echo "::warning::Test process exited with $TEST_EXIT (Qt platform plugin cleanup in headless CI)"
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
###################################################
# ALLS-GREEN GATE
# Single required status check for branch protection.
# Add "check" as the only required check in repo settings.
###################################################
check:
name: CI Passed
if: always()
needs: [changed, test]
runs-on: ubuntu-latest
steps:
- name: Evaluate results
uses: re-actors/alls-green@release/v1
with:
allowed-skips: >-
${{
needs.changed.outputs.should_skip == 'true'
&& 'test'
|| ''
}}
jobs: ${{ toJSON(needs) }}