-
Notifications
You must be signed in to change notification settings - Fork 3.4k
358 lines (303 loc) · 11.2 KB
/
Copy pathBuild.yml
File metadata and controls
358 lines (303 loc) · 11.2 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
name: Build
on:
push:
branches: [ main ]
pull_request:
permissions: {}
defaults:
run:
shell: bash
env:
# Test projects requiring SQL Server (run in the sqlserver job, excluded from the main test job)
SQLSERVER_TEST_PROJECTS: >-
test/EFCore.SqlServer.FunctionalTests
test/EFCore.SqlServer.HierarchyId.Tests
test/EFCore.CrossStore.FunctionalTests
test/EFCore.OData.FunctionalTests
test/EFCore.AspNet.SqlServer.FunctionalTests
test/EFCore.VisualBasic.FunctionalTests
test/EFCore.FSharp.FunctionalTests
jobs:
Main:
env:
# Additional projects to exclude (covered by other dedicated jobs, or not directly runnable)
ADDITIONAL_EXCLUDED_PROJECTS: >-
Cosmos.FunctionalTests
Specification.Tests
Microsoft.Data.Sqlite
EFCore.Sqlite
EFCore.AspNet.Sqlite
TrimmingTests
NativeAotTests
ApiBaseline
strategy:
fail-fast: false
matrix:
include:
- os: windows-2025
- os: ubuntu-24.04
- os: macos-15
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Restore
if: runner.os != 'Windows'
run: ./restore.sh
- name: Restore
if: runner.os == 'Windows'
shell: cmd
run: restore.cmd
- name: Test
run: |
mkdir -p artifacts/coverage
pattern=$(echo "$SQLSERVER_TEST_PROJECTS $ADDITIONAL_EXCLUDED_PROJECTS" | xargs -n1 | tr '\n' '|' | sed 's/|$//')
failed=0
for proj in $(find test -maxdepth 2 \( -name '*.csproj' -o -name '*.fsproj' -o -name '*.vbproj' \) \
| grep -v -E "$pattern"); do
dotnet test "$proj" \
-- --coverage --coverage-output-format cobertura \
--coverage-output "$PWD/artifacts/coverage/$(basename "$proj").cobertura.xml" \
--coverage-settings eng/efcore.coverage.xml || failed=1
done
exit $failed
- name: Upload coverage artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-main-${{ matrix.os }}
path: artifacts/coverage/*.cobertura.xml
if-no-files-found: ignore
- name: Publish Test Results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: test-results-main-${{ matrix.os }}
path: artifacts/log/Debug/*
Cosmos:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2025
- os: ubuntu-24.04
runs-on: ${{ matrix.os }}
steps:
- name: Start Cosmos Emulator
if: runner.os == 'Windows'
shell: powershell
run: |
Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
Start-CosmosDbEmulator -Timeout 540 -NoUI -NoTelemetry -NoFirewall -EnablePreview
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Restore
if: runner.os != 'Windows'
run: ./restore.sh
- name: Restore
if: runner.os == 'Windows'
shell: cmd
run: restore.cmd
- name: Test on Cosmos
run: |
mkdir -p artifacts/coverage
dotnet test test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj \
-- --coverage --coverage-output-format cobertura \
--coverage-output "$PWD/artifacts/coverage/EFCore.Cosmos.FunctionalTests.cobertura.xml" \
--coverage-settings eng/efcore.coverage.xml
env:
Test__Cosmos__DefaultConnection: ${{ runner.os == 'Windows' && 'https://localhost:8081' || '' }}
Test__Cosmos__SkipConnectionCheck: ${{ runner.os == 'Windows' && 'true' || '' }}
- name: Upload coverage artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-cosmos-${{ matrix.os }}
path: artifacts/coverage/*.cobertura.xml
if-no-files-found: ignore
- name: Publish Test Results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: test-results-cosmos-${{ matrix.os }}
path: artifacts/log/Debug/*
SqlServer:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
sqlserver_version: [2025, 2022, 2019]
env:
MSSQL_SA_PASSWORD: 'PLACEHOLDERPass$$w0rd'
services:
mssql:
image: mcr.microsoft.com/mssql/server:${{ matrix.sqlserver_version }}-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: ${{ env.MSSQL_SA_PASSWORD }}
ports:
- 1433:1433
options: >-
--health-cmd="/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P $SA_PASSWORD -Q 'SELECT 1' -C"
--health-start-period=20s
--health-interval=2s
--health-retries=30
--health-timeout=5s
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Restore
run: ./restore.sh
- name: Test on SQL Server
env:
Test__SqlServer__DefaultConnection: 'Server=localhost;Database=master;User=SA;Password=${{ env.MSSQL_SA_PASSWORD }};Connect Timeout=60;ConnectRetryCount=0;Trust Server Certificate=true'
run: |
mkdir -p artifacts/coverage
failed=0
for proj in $SQLSERVER_TEST_PROJECTS; do
dotnet test "$proj" \
-- --coverage --coverage-output-format cobertura \
--coverage-output "$PWD/artifacts/coverage/$(basename "$proj").cobertura.xml" \
--coverage-settings eng/efcore.coverage.xml || failed=1
done
exit $failed
- name: Upload coverage artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-sqlserver-${{ matrix.sqlserver_version }}
path: artifacts/coverage/*.cobertura.xml
if-no-files-found: ignore
- name: Publish Test Results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: test-results-sqlserver-${{ matrix.sqlserver_version }}
path: artifacts/log/Debug/*
Sqlite:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2025
- os: ubuntu-24.04
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Restore
if: runner.os != 'Windows'
run: ./restore.sh
- name: Restore
if: runner.os == 'Windows'
shell: cmd
run: restore.cmd
- name: Test EF Core Sqlite
run: |
mkdir -p artifacts/coverage
failed=0
for proj in test/EFCore.Sqlite.FunctionalTests test/EFCore.Sqlite.Tests test/EFCore.AspNet.Sqlite.FunctionalTests; do
dotnet test "$proj" \
-- --coverage --coverage-output-format cobertura \
--coverage-output "$PWD/artifacts/coverage/$(basename "$proj").cobertura.xml" \
--coverage-settings eng/efcore.coverage.xml || failed=1
done
exit $failed
- name: Upload coverage artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-sqlite-${{ matrix.os }}
path: artifacts/coverage/*.cobertura.xml
if-no-files-found: ignore
- name: Publish Test Results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: test-results-sqlite-${{ matrix.os }}
path: artifacts/log/Debug/*
microsoft-data-sqlite:
name: Microsoft.Data.Sqlite
strategy:
fail-fast: false
matrix:
include:
- os: windows-2025
- os: ubuntu-24.04
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Restore
if: runner.os != 'Windows'
run: ./restore.sh
- name: Restore
if: runner.os == 'Windows'
shell: cmd
run: restore.cmd
- name: Test Microsoft.Data.Sqlite
run: |
mkdir -p artifacts/coverage
failed=0
for proj in $(find test/Microsoft.Data.Sqlite.Tests -name '*.csproj' \
| if [ "$RUNNER_OS" != "Windows" ]; then grep -v winsqlite3; else cat; fi); do
dotnet test "$proj" \
-- --coverage --coverage-output-format cobertura \
--coverage-output "$PWD/artifacts/coverage/$(basename "$proj").cobertura.xml" \
--coverage-settings eng/efcore.coverage.xml || failed=1
done
exit $failed
- name: Upload coverage artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-microsoft-data-sqlite-${{ matrix.os }}
path: artifacts/coverage/*.cobertura.xml
if-no-files-found: ignore
- name: Publish Test Results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: test-results-microsoft-data-sqlite-${{ matrix.os }}
path: artifacts/log/Debug/*
ApiBaselines:
name: API Baselines
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Restore
run: ./restore.sh
- name: Test API Baselines
run: dotnet test test/EFCore.ApiBaseline.Tests
coverage:
name: Upload coverage
needs: [Main, Cosmos, SqlServer, Sqlite, microsoft-data-sqlite]
runs-on: ubuntu-24.04
if: always()
permissions:
contents: read
code-quality: write
steps:
- name: Download coverage artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
pattern: coverage-*
path: artifacts/coverage
- name: Merge coverage reports
continue-on-error: true
run: |
mapfile -d '' files < <(find artifacts/coverage -name '*.cobertura.xml' -print0 2>/dev/null)
if [ ${#files[@]} -gt 0 ]; then
export PATH="$PATH:$HOME/.dotnet/tools"
dotnet tool update --global dotnet-coverage || dotnet tool install --global dotnet-coverage
dotnet-coverage merge -o artifacts/coverage/coverage.cobertura.xml -f cobertura "${files[@]}"
fi
- name: Upload coverage report
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && hashFiles('artifacts/coverage/coverage.cobertura.xml') != ''
uses: actions/upload-code-coverage@abb5995db9e0199b0e2bb9dbd136fce4cb1ec4d3
with:
file: artifacts/coverage/coverage.cobertura.xml
language: C#
label: code-coverage
fail-on-error: false