-
Notifications
You must be signed in to change notification settings - Fork 41
739 lines (671 loc) · 32.8 KB
/
Copy pathpull_request.yml
File metadata and controls
739 lines (671 loc) · 32.8 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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
name: PullRequest
on:
pull_request:
branches:
- '**'
paths-ignore:
- '**.md'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
PIPELINE_WORKSPACE: true
checkoutFetchDepth: 2
buildConfiguration: 'Debug'
skipTests: false
deterministicTests: true
autoCommitGreenTests: true
uploadTestResults: true
jobs:
Preconditions:
runs-on: ubuntu-latest
outputs:
lastCommitIsAutoCommit: ${{ steps.GetHeadCommitInfo.outputs.lastCommitIsAutoCommit }}
lastCommitCreatedBeforeSeconds: ${{ steps.GetHeadCommitInfo.outputs.lastCommitCreatedBeforeSeconds }}
steps:
- name: 'General Information'
shell: pwsh
run: |
echo 'EventName: ${{ github.event_name }}'
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: ${{ env.checkoutFetchDepth }}
- name: 'Get Head Commit Info'
id: GetHeadCommitInfo
shell: pwsh
run: |
git log -${{ env.checkoutFetchDepth }} --pretty=%B
$headCommitMessage = git log -1 --skip "$(${{ env.checkoutFetchDepth }} - 1)" --pretty=%B
echo "headCommitMessage: = $headCommitMessage"
$headCommitAuthorName = git log -1 --skip "$(${{ env.checkoutFetchDepth }} - 1)" --pretty=%an
echo "headCommitAuthorName: = $headCommitAuthorName"
$headCommitAuthorEmail = git log -1 --skip "$(${{ env.checkoutFetchDepth }} - 1)" --pretty=%ae
echo "headCommitAuthorEmail: = $headCommitAuthorEmail"
$headCommitDateTime = Get-Date (git log -1 --skip "$(${{ env.checkoutFetchDepth }} - 1)" --pretty=%ci)
echo "headCommitDateTime: = $headCommitDateTime"
$lastCommitIsAutoCommit = $headCommitAuthorEmail -eq 'github-actions@github.com' -and $headCommitMessage -eq '[GitHub Actions] Update green tests.'
echo "lastCommitIsAutoCommit=$lastCommitIsAutoCommit" >> $env:GITHUB_OUTPUT
echo "lastCommitIsAutoCommit: = $lastCommitIsAutoCommit"
$lastCommitCreatedBeforeSeconds = [int]((Get-Date) - $headCommitDateTime).TotalSeconds
echo "lastCommitCreatedBeforeSeconds=$lastCommitCreatedBeforeSeconds" >> $env:GITHUB_OUTPUT
echo "lastCommitCreatedBeforeSeconds: = $lastCommitCreatedBeforeSeconds"
Changes:
runs-on: ubuntu-latest
outputs:
jet: ${{ steps.Decide.outputs.jet }}
libred: ${{ steps.Decide.outputs.libred }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: 'Filter Changed Paths'
id: Filter
uses: dorny/paths-filter@v4
with:
filters: |
# Anything here rebuilds the world, so it belongs to both sides.
shared: &shared
- '.github/workflows/**'
- 'Directory.Build.props'
- 'Version.props'
- 'global.json'
- 'nuget.config'
- 'NuGet.config'
- 'Key.snk'
- 'EFCore.Jet.sln'
- 'src/Directory.Build.props'
- 'test/Directory.Build.props'
- 'test/Shared/**'
jet:
- *shared
- 'src/Shared/**'
- 'src/EFCore.Jet/**'
- 'src/EFCore.Jet.Data/**'
- 'src/EFCore.Jet.Odbc/**'
- 'src/EFCore.Jet.OleDb/**'
- 'test/EFCore.Jet.Data.Tests/**'
- 'test/EFCore.Jet.FunctionalTests/**'
- 'test/EFCore.Jet.IntegrationTests/**'
- 'test/EFCore.Jet.Tests/**'
- 'test/JetProviderExceptionTests/**'
libred:
- *shared
- 'src/LibRed/**'
- 'test/LibRed.Ado.Tests/**'
- 'test/LibRed.Core.Tests/**'
- 'test/LibRed.EFCore.Tests/**'
- 'test/LibRed.Engine.Tests/**'
- 'test/EFCore.LibRed.FunctionalTests/**'
# LibRed.Ado references EFCore.Jet.Data and LibRed.EFCore references EFCore.Jet, so a
# change on the Jet side has to re-run LibRed. The reverse is not true: nothing under
# src/LibRed is referenced by the Jet provider.
- 'src/EFCore.Jet/**'
- 'src/EFCore.Jet.Data/**'
# Northwind.accdb lives here and every LibRed suite links to it as its fixture.
- 'test/JetProviderExceptionTests/**'
- name: 'Decide What To Run'
id: Decide
shell: pwsh
run: |
# A published release (or any event that isn't a push/PR) has no meaningful diff to filter
# against, so it runs everything.
$runEverything = '${{ github.event_name }}' -notin @('push', 'pull_request')
$jet = $runEverything -or ('${{ steps.Filter.outputs.jet }}' -eq 'true')
$libred = $runEverything -or ('${{ steps.Filter.outputs.libred }}' -eq 'true')
echo "jet=$($jet.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT
echo "libred=$($libred.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT
echo "runEverything: $runEverything"
echo "jet: $jet"
echo "libred: $libred"
BuildAndTest:
needs:
- Preconditions
- Changes
if: (needs.Preconditions.outputs.lastCommitIsAutoCommit != 'true' || needs.Preconditions.outputs.lastCommitCreatedBeforeSeconds > 300) && needs.Changes.outputs.jet == 'true'
strategy:
fail-fast: false
matrix:
aceVersion:
- 2010
- 2016
aceArchitecture:
- x64
- x86
dataAccessProviderType:
- ODBC
- OLE DB
os:
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v5
# Defender scans every .accdb these suites write; see the action for the measurement.
- name: Exclude test files from Defender
uses: ./.github/actions/exclude-defender
- name: Set additional variables
shell: pwsh
run: |
$os = '${{ matrix.os }}'.Split('-')[0]
echo "os=$os" >> $env:GITHUB_ENV
$dotnetInstallDirectory = '.\.dotnet_${{ matrix.aceArchitecture }}'
echo "dotnetInstallDirectory=$dotnetInstallDirectory" >> $env:GITHUB_ENV
$dotnetExecutable = Join-Path $dotnetInstallDirectory 'dotnet.exe'
echo "dotnetExecutable=$dotnetExecutable" >> $env:GITHUB_ENV
$aceUrls = @{
'2010' = @{
'x64' = 'https://cirrusredorg.github.io/EntityFrameworkCore.Jet/AccessDatabaseEngine_2010_x64.exe'
'x86' = 'https://cirrusredorg.github.io/EntityFrameworkCore.Jet/AccessDatabaseEngine_2010_x86.exe'
'silent' = '/passive /quiet /norestart REBOOT=ReallySuppress'
}
'2016' = @{
'x64' = 'https://cirrusredorg.github.io/EntityFrameworkCore.Jet/AccessDatabaseEngine_2016_x64.exe'
'x86' = 'https://cirrusredorg.github.io/EntityFrameworkCore.Jet/AccessDatabaseEngine_2016_x86.exe'
'silent' = '/passive /quiet /norestart REBOOT=ReallySuppress'
}
}
$aceUrl = $aceUrls['${{ matrix.aceVersion }}']['${{ matrix.aceArchitecture }}']
echo "aceUrl=$aceUrl" >> $env:GITHUB_ENV
$aceSilentInstallArgument = $aceUrls['${{ matrix.aceVersion }}']['silent']
echo "aceSilentInstallArgument=$aceSilentInstallArgument" >> $env:GITHUB_ENV
$defaultConnection = '${{ matrix.dataAccessProviderType }}' -eq 'ODBC' ? 'DBQ=Jet.accdb' : 'Data Source=Jet.accdb;Persist Security Info=False;'
echo "defaultConnection=$defaultConnection" >> $env:GITHUB_ENV
$matrixId = '${{ matrix.aceVersion }}-${{ matrix.aceArchitecture }}-' + '${{ matrix.dataAccessProviderType }}'.Replace(' ', '') + '-${{ matrix.os }}'
echo "matrixId=$matrixId" >> $env:GITHUB_ENV
- name: Output Variables
shell: pwsh
run: |
echo "os: ${{ env.os }}"
echo "buildConfiguration: ${{ env.buildConfiguration }}"
echo "aceVersion: ${{ matrix.aceVersion }}"
echo "aceArchitecture: ${{ matrix.aceArchitecture }}"
echo "aceUrl: ${{ env.aceUrl }}"
echo "aceSilentInstallArgument: ${{ env.aceSilentInstallArgument }}"
echo "dataAccessProviderType: ${{ matrix.dataAccessProviderType }}"
echo "defaultConnection: ${{ env.defaultConnection }}"
echo "matrixId: ${{ env.matrixId }}"
echo "skipTests: ${{ env.skipTests }}"
echo "dotnetInstallDirectory: ${{ env.dotnetInstallDirectory }}"
echo "dotnetExecutable: ${{ env.dotnetExecutable }}"
echo "github.event_name: ${{ github.event_name }}"
echo "github.repository: ${{ github.repository }}"
- name: .NET Information Before SDK Install
shell: pwsh
run: try { & '${{ env.dotnetExecutable }}' --info } catch { echo 'No ${{ matrix.aceArchitecture }} .NET SDK installed.' }
- name: Install .NET SDK
shell: pwsh
run: |
function Retry-Command {
[CmdletBinding()]
Param(
[Parameter(Position=0, Mandatory=$true)]
[ScriptBlock]$ScriptBlock,
[Parameter(Position=1, Mandatory=$false)]
[int]$Maximum = 5,
[Parameter(Mandatory=$false)]
[switch]$ExponentialBackoff
)
$attempt = 0
do {
if ($attempt -gt 0 -and $ExponentialBackoff) {
Start-Sleep -Seconds ([Math]::Pow(2, $attempt) - 1)
}
$attempt++
try {
$ScriptBlock.Invoke()
return
} catch {
Write-Error $_.Exception.InnerException.Message -ErrorAction Continue
}
} while ($attempt -lt $Maximum)
throw 'Max retries exceeded.'
}
Retry-Command {
&([ScriptBlock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -JSonFile global.json -Architecture '${{ matrix.aceArchitecture }}' -InstallDir '${{ env.dotnetInstallDirectory }}' -Verbose
} -Maximum 10 -ExponentialBackoff
- name: .NET Information After SDK Install
shell: pwsh
run: try { & '${{ env.dotnetExecutable }}' --info } catch { echo 'No ${{ matrix.aceArchitecture }} .NET SDK installed.' }
- name: ACE Information Before ACE Install
shell: pwsh
run: |
'DAO:'
Get-ChildItem 'HKLM:\SOFTWARE\Classes\DAO.DBEngine*' | Select-Object
'OLE DB:'
foreach ($provider in [System.Data.OleDb.OleDbEnumerator]::GetRootEnumerator())
{
$v = New-Object PSObject
for ($i = 0; $i -lt $provider.FieldCount; $i++)
{
Add-Member -in $v NoteProperty $provider.GetName($i) $provider.GetValue($i)
}
$v
}
- name: Install Access Database Engine
shell: pwsh
run: |
$setupFileName = 'AccessDatabaseEngine_${{ matrix.aceVersion }}_${{ matrix.aceArchitecture }}.exe'
Invoke-WebRequest '${{ env.aceUrl }}' -OutFile $setupFileName
& ".\$setupFileName" ${{ env.aceSilentInstallArgument }} | Out-Default
- name: ACE Information After ACE Install
shell: pwsh
run: |
'DAO:'
Get-ChildItem 'HKLM:\SOFTWARE\Classes\DAO.DBEngine*' | Select-Object
'OLE DB:'
foreach ($provider in [System.Data.OleDb.OleDbEnumerator]::GetRootEnumerator())
{
$v = New-Object PSObject
for ($i = 0; $i -lt $provider.FieldCount; $i++)
{
Add-Member -in $v NoteProperty $provider.GetName($i) $provider.GetValue($i)
}
$v
}
- name: Build Solution
shell: pwsh
run: |
& '${{ env.dotnetExecutable }}' build --configuration '${{ env.buildConfiguration }}'
- name: 'Run Tests: EFCore.Jet.Data.Tests'
if: always() && env.skipTests != 'true'
shell: pwsh
run: |
$env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}'
# No --verbosity detailed: it dumps every test's captured output (EF logs the compiled shaper
# expression tree per query under the Query category), which ran to ~62,000 lines in 43s per shard
# and got truncated by GitHub anyway. Nothing consumes it - the green-tests extraction parses the
# trx, and crash detection looks for Sequence_* blame dumps - so it cost console I/O for a log too
# big to read. On these sequential suites those writes sit directly on the critical path.
& '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Data.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --blame-hang-timeout 3m
- name: 'Run Tests: EFCore.Jet.Tests'
if: always() && env.skipTests != 'true'
shell: pwsh
run: |
$env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}'
& '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --blame-hang-timeout 3m
- name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 1 - Query Core)'
if: always() && env.skipTests != 'true'
shell: pwsh
run: |
$shardDir = '.\test\EFCore.Jet.FunctionalTests\TestResults\shard1'
for ($i = 0; $i -lt 3; $i++) {
if (Test-Path $shardDir -PathType Container) {
Get-ChildItem $shardDir | Remove-Item -Recurse -Force
}
$env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}'
& '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --blame-hang-timeout 3m --results-directory $shardDir --filter "FullyQualifiedName~.FunctionalTests.Query.&FullyQualifiedName!~.FunctionalTests.Query.Associations.&FullyQualifiedName!~.FunctionalTests.Query.Translations."
#
# Check for test runner crashes:
#
$currentTestRunTrx = Get-ChildItem $shardDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1
if ($null -eq $currentTestRunTrx) {
echo 'Test runner log file is missing.'
exit 3
}
$currentTestRunDir = Join-Path $shardDir $currentTestRunTrx.BaseName
if (Test-Path $currentTestRunDir) {
if ($null -ne (Get-ChildItem $currentTestRunDir -Filter 'Sequence_*' -Recurse)) {
# Split string because searching the log for that phrase should only show actual crashes and not this line.
echo ('Test runner cras' + 'hed.')
continue
}
}
echo 'Test runner ran until the end.'
break
}
$establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt"
$failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath
if ($i -ge 3 -and $failIfKeepsCrashing) {
echo 'Test runner keeps crashing.'
exit 2
}
exit 0
- name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 2 - Query Associations and Translations)'
if: always() && env.skipTests != 'true'
shell: pwsh
run: |
$shardDir = '.\test\EFCore.Jet.FunctionalTests\TestResults\shard2'
for ($i = 0; $i -lt 3; $i++) {
if (Test-Path $shardDir -PathType Container) {
Get-ChildItem $shardDir | Remove-Item -Recurse -Force
}
$env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}'
& '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --blame-hang-timeout 3m --results-directory $shardDir --filter "FullyQualifiedName~.FunctionalTests.Query.Associations.|FullyQualifiedName~.FunctionalTests.Query.Translations."
#
# Check for test runner crashes:
#
$currentTestRunTrx = Get-ChildItem $shardDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1
if ($null -eq $currentTestRunTrx) {
echo 'Test runner log file is missing.'
exit 3
}
$currentTestRunDir = Join-Path $shardDir $currentTestRunTrx.BaseName
if (Test-Path $currentTestRunDir) {
if ($null -ne (Get-ChildItem $currentTestRunDir -Filter 'Sequence_*' -Recurse)) {
# Split string because searching the log for that phrase should only show actual crashes and not this line.
echo ('Test runner cras' + 'hed.')
continue
}
}
echo 'Test runner ran until the end.'
break
}
$establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt"
$failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath
if ($i -ge 3 -and $failIfKeepsCrashing) {
echo 'Test runner keeps crashing.'
exit 2
}
exit 0
- name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 3 - Non-Query)'
if: always() && env.skipTests != 'true'
shell: pwsh
run: |
$shardDir = '.\test\EFCore.Jet.FunctionalTests\TestResults\shard3'
for ($i = 0; $i -lt 3; $i++) {
if (Test-Path $shardDir -PathType Container) {
Get-ChildItem $shardDir | Remove-Item -Recurse -Force
}
$env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}'
& '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --blame-hang-timeout 3m --results-directory $shardDir --filter "FullyQualifiedName!~.FunctionalTests.Query."
#
# Check for test runner crashes:
#
$currentTestRunTrx = Get-ChildItem $shardDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1
if ($null -eq $currentTestRunTrx) {
echo 'Test runner log file is missing.'
exit 3
}
$currentTestRunDir = Join-Path $shardDir $currentTestRunTrx.BaseName
if (Test-Path $currentTestRunDir) {
if ($null -ne (Get-ChildItem $currentTestRunDir -Filter 'Sequence_*' -Recurse)) {
# Split string because searching the log for that phrase should only show actual crashes and not this line.
echo ('Test runner cras' + 'hed.')
continue
}
}
echo 'Test runner ran until the end.'
break
}
$establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt"
$failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath
if ($i -ge 3 -and $failIfKeepsCrashing) {
echo 'Test runner keeps crashing.'
exit 2
}
exit 0
- name: 'Rename Test Results'
if: always() && env.skipTests != 'true'
shell: pwsh
run: |
Get-ChildItem -Filter '*.trx' -Recurse | Sort-Object LastWriteTime | ForEach { Rename-Item $_.FullName "ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}_$($_.Name)" -Verbose }
- name: 'Upload Test Results'
if: always() && env.skipTests != 'true' && env.uploadTestResults == 'true'
uses: actions/upload-artifact@v6
with:
name: test-results_${{ env.matrixId }}
path: |
test\EFCore.Jet.Data.Tests\TestResults\*.trx
test\EFCore.Jet.FunctionalTests\TestResults\**\*.trx
test\EFCore.Jet.Tests\TestResults\*.trx
- name: 'Check Tests: EFCore.Jet.FunctionalTests'
if: env.skipTests != 'true'
shell: pwsh
run: |
# Collect and merge test results from all shards.
$testResultsDir = '.\test\EFCore.Jet.FunctionalTests\TestResults'
$allTrxFiles = @(Get-ChildItem $testResultsDir -Filter '*.trx' -Recurse)
if ($allTrxFiles.Count -eq 0) {
echo 'No test result files found.'
exit 3
}
$allNodes = @()
foreach ($trxFile in $allTrxFiles) {
$allNodes += (Select-Xml -Path $trxFile.FullName -XPath "//ns:UnitTestResult" -Namespace @{"ns"="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"}).Node
}
$allTestsFilePath = Join-Path $testResultsDir 'combined_All.txt'
$allNodes | Sort-Object -Property testName -CaseSensitive | ForEach-Object { "$($_.outcome -eq 'Passed' ? 'P' : $_.outcome -eq 'NotExecuted' ? 'N' : $_.outcome -eq 'Failed' ? 'F' : 'U') $($_.testName)" } | Set-Content $allTestsFilePath
$greenTestsFilePath = Join-Path $testResultsDir 'combined_Passed.txt'
Get-Content $allTestsFilePath | Where-Object { $_.StartsWith('P ') } | ForEach-Object { $_.Substring(2) } | Set-Content $greenTestsFilePath
# Compare test file against previously committed file.
$establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt"
if (Test-Path $establishedGreenTestsFilePath) {
$diffResult = Compare-Object (Get-Content $establishedGreenTestsFilePath) (Get-Content $greenTestsFilePath)
$notGreenAnymore = $diffResult | Where-Object { $_.SideIndicator -eq '<=' } | Select-Object -ExpandProperty InputObject
if ($null -ne $notGreenAnymore) {
echo "`nThe following $(@($notGreenAnymore).Length) tests passed in previous runs, but didn't pass in this run:`n"
$notGreenAnymore
exit 1
}
echo 'All tests that passed in previous runs still passed in this run.'
$newlyGreenTests = $diffResult | Where-Object { $_.SideIndicator -eq '=>' } | Select-Object -ExpandProperty InputObject
if ($newlyGreenTests.Length -gt 0) {
Copy-Item $greenTestsFilePath $establishedGreenTestsFilePath -Force -Verbose
echo "`nThe following new tests passed that did not pass before:`n"
$newlyGreenTests
$commitGreenTestsFile = $establishedGreenTestsFilePath
echo "commitGreenTestsFile=$commitGreenTestsFile" >> $env:GITHUB_ENV
}
}
echo 'Check succeeded.'
- name: 'Upload Green Tests'
if: env.commitGreenTestsFile != '' && env.autoCommitGreenTests == 'true'
uses: actions/upload-artifact@v6
with:
name: green-tests_${{ env.matrixId }}
path: ${{ env.commitGreenTestsFile }}
LibRed:
needs:
- Preconditions
- Changes
if: (needs.Preconditions.outputs.lastCommitIsAutoCommit != 'true' || needs.Preconditions.outputs.lastCommitCreatedBeforeSeconds > 300) && needs.Changes.outputs.libred == 'true'
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v5
# Defender scans every .accdb these suites write; see the action for the measurement.
- name: Exclude test files from Defender
uses: ./.github/actions/exclude-defender
- name: Install .NET SDK
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: .NET Information
run: dotnet --info
- name: 'Run Tests: LibRed.Engine.Tests'
if: env.skipTests != 'true'
run: dotnet test ./test/LibRed.Engine.Tests --configuration ${{ env.buildConfiguration }} -p:FixedTestOrder=${{ env.deterministicTests }} --blame-hang-timeout 3m
# The rest of the LibRed suites cross-check LibRed's output against the real engine over OLE DB,
# so unlike the job above they do need Windows with ACE installed.
LibRedAccess:
needs:
- Preconditions
- Changes
if: (needs.Preconditions.outputs.lastCommitIsAutoCommit != 'true' || needs.Preconditions.outputs.lastCommitCreatedBeforeSeconds > 300) && needs.Changes.outputs.libred == 'true'
strategy:
fail-fast: false
matrix:
aceVersion:
- 2016
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v5
# Defender scans every .accdb these suites write; see the action for the measurement.
- name: Exclude test files from Defender
uses: ./.github/actions/exclude-defender
- name: Install .NET SDK
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Install Access Database Engine
shell: pwsh
run: |
$setupFileName = 'AccessDatabaseEngine_${{ matrix.aceVersion }}_x64.exe'
Invoke-WebRequest "https://cirrusredorg.github.io/EntityFrameworkCore.Jet/$setupFileName" -OutFile $setupFileName
& ".\$setupFileName" /passive /quiet /norestart REBOOT=ReallySuppress | Out-Default
- name: 'ACE Information'
shell: pwsh
run: |
foreach ($provider in [System.Data.OleDb.OleDbEnumerator]::GetRootEnumerator())
{
$v = New-Object PSObject
for ($i = 0; $i -lt $provider.FieldCount; $i++)
{
Add-Member -in $v NoteProperty $provider.GetName($i) $provider.GetValue($i)
}
$v
}
- name: 'Run Tests: LibRed.Core.Tests'
if: env.skipTests != 'true'
shell: pwsh
run: dotnet test .\test\LibRed.Core.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --blame-hang-timeout 5m
- name: 'Run Tests: LibRed.Ado.Tests'
if: always() && env.skipTests != 'true'
shell: pwsh
run: dotnet test .\test\LibRed.Ado.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --blame-hang-timeout 5m
- name: 'Run Tests: LibRed.EFCore.Tests'
if: always() && env.skipTests != 'true'
shell: pwsh
run: dotnet test .\test\LibRed.EFCore.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --blame-hang-timeout 5m
LibRedFunctional:
needs:
- Preconditions
- Changes
# Non-blocking for now: the suite sits at ~278 failures out of ~36,000 run, so it would be red on
# every push and quickly learn to be ignored. It still runs on every push and the log is there to
# read. Drop this line once the remaining failures are fixed or skipped.
continue-on-error: true
if: (needs.Preconditions.outputs.lastCommitIsAutoCommit != 'true' || needs.Preconditions.outputs.lastCommitCreatedBeforeSeconds > 300) && needs.Changes.outputs.libred == 'true'
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v5
# Defender scans every .accdb these suites write; see the action for the measurement.
- name: Exclude test files from Defender
uses: ./.github/actions/exclude-defender
- name: Install .NET SDK
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
# No Access engine on ANY leg now. Windows used to install ACE as a control, on the reasoning that a
# test failing only off Windows would be a real cross-platform gap - but all three legs have since
# agreed exactly (35,578 passed / 179 failed / 2,016 skipped), so nothing here needs ACE and the
# control has served its purpose. LibRedAccess still installs it, which is where the cross-checks
# against the real engine belong.
- name: 'Run Tests: EFCore.LibRed.FunctionalTests'
if: env.skipTests != 'true'
run: dotnet test test/EFCore.LibRed.FunctionalTests --configuration ${{ env.buildConfiguration }} -p:FixedTestOrder=${{ env.deterministicTests }} --blame-hang-timeout 10m
MergeArtifacts:
needs: BuildAndTest
if: always()
outputs:
testResultsAvailable: ${{ steps.MergeTestResults.conclusion == 'success' }}
greenTestsAvailable: ${{ steps.MergeGreenTests.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: 'Check Test Results Artifacts'
id: CheckTestResultsArtifacts
uses: actions/github-script@v8
with:
script: |
var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: '${{ github.run_id }}',
});
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("test-results_");
});
if (artifacts.length > 0) {
core.setOutput('artifactsAvailable', 'true');
console.log('Test results artifacts found.');
}
- name: 'Merge Test Results'
id: MergeTestResults
if: steps.CheckTestResultsArtifacts.outputs.artifactsAvailable == 'true'
uses: actions/upload-artifact/merge@v6
with:
name: test-results
pattern: test-results_*
delete-merged: true
- name: 'Check Green Tests Artifacts'
id: CheckGreenTestsArtifacts
uses: actions/github-script@v8
with:
script: |
var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: '${{ github.run_id }}',
});
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("green-tests_");
});
if (artifacts.length > 0) {
core.setOutput('artifactsAvailable', 'true');
console.log('Green Tests Artifacts found.');
}
- name: 'Merge Green Tests'
id: MergeGreenTests
if: steps.CheckGreenTestsArtifacts.outputs.artifactsAvailable == 'true'
uses: actions/upload-artifact/merge@v6
with:
name: green-tests
pattern: green-tests_*
delete-merged: true
CheckArtifacts:
needs:
- BuildAndTest
- MergeArtifacts
if: always()
runs-on: ubuntu-latest
outputs:
hasGreenTestsArtifacts: ${{ steps.CheckGreenTestsArtifacts.outputs.hasGreenTestsArtifacts == 'true' }}
steps:
# - name: 'Debug'
# shell: pwsh
# env:
# NEEDS_CONTEXT: ${{ toJson(needs) }}
# run: |
# echo $env:NEEDS_CONTEXT
- name: 'Download Green Tests'
if: needs.MergeArtifacts.outputs.greenTestsAvailable == 'true'
uses: actions/download-artifact@v7
with:
name: green-tests
path: green-tests
- name: 'Check Green Tests Artifacts'
id: CheckGreenTestsArtifacts
shell: pwsh
run: |
dir -Recurse | Select-Object -ExpandProperty FullName
$hasGreenTestsArtifacts = (Test-Path 'green-tests') -and (Get-ChildItem 'green-tests').Length -gt 0
echo "hasGreenTestsArtifacts=$hasGreenTestsArtifacts" >> $env:GITHUB_OUTPUT
echo "hasGreenTestsArtifacts: $hasGreenTestsArtifacts"
Status:
needs: CheckArtifacts
if: always() && needs.CheckArtifacts.result == 'success' && needs.CheckArtifacts.outputs.hasGreenTestsArtifacts != 'true'
runs-on: ubuntu-latest
steps:
- name: 'Final Status'
shell: pwsh
run: |
echo 'All workflows succeeded.'
exit 0