-
Notifications
You must be signed in to change notification settings - Fork 165
executable file
·1232 lines (1227 loc) · 49.8 KB
/
pr.yml
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
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Do not modify!
# This file was generated from a template using https://github.com/apple/pkl
name: PR Build
'on':
pull_request:
paths:
- '**.cs'
- '**.cpp'
- '**.hpp'
- '**.csproj'
- '**CMakeLists.txt'
- '**.ps1'
- '**.sh'
- '**.props'
- wrappers/realm-core
- .github/workflows/*.yml
- '!.github/workflows/main.yml'
- '!.github/workflows/publish-*.yml'
- .github/actions/**
- Tests/Tests.Android/Properties/AndroidManifest.xml
env:
DOTNET_NOLOGO: true
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-wrappers:
name: Wrappers
uses: ./.github/workflows/wrappers.yml
build-packages:
name: Package NuGet
needs:
- build-wrappers
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
outputs:
package_version: ${{ steps.get-version.outputs.package_version }}
timeout-minutes: 30
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Set version suffix
id: set-version-suffix
run: |-
$suffix = ""
if ($env:GITHUB_EVENT_NAME -eq "pull_request")
{
if (-Not "${{ github.head_ref }}".Contains("release"))
{
$suffix = "pr-${{ github.event.number }}.$env:GITHUB_RUN_NUMBER"
}
}
else
{
$suffix = "alpha.$env:GITHUB_RUN_NUMBER"
}
echo "build_suffix=$suffix" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Fetch wrappers for macos
uses: actions/download-artifact@v4
with:
name: wrappers-macos
path: wrappers/build
- name: Fetch wrappers for catalyst
uses: actions/download-artifact@v4
with:
name: wrappers-catalyst
path: wrappers/build
- name: Fetch wrappers for linux-x86_64
uses: actions/download-artifact@v4
with:
name: wrappers-linux-x86_64
path: wrappers/build
- name: Fetch wrappers for linux-armhf
uses: actions/download-artifact@v4
with:
name: wrappers-linux-armhf
path: wrappers/build
- name: Fetch wrappers for linux-aarch64
uses: actions/download-artifact@v4
with:
name: wrappers-linux-aarch64
path: wrappers/build
- name: Fetch wrappers for android-armeabi-v7a
uses: actions/download-artifact@v4
with:
name: wrappers-android-armeabi-v7a
path: wrappers/build
- name: Fetch wrappers for android-arm64-v8a
uses: actions/download-artifact@v4
with:
name: wrappers-android-arm64-v8a
path: wrappers/build
- name: Fetch wrappers for android-x86
uses: actions/download-artifact@v4
with:
name: wrappers-android-x86
path: wrappers/build
- name: Fetch wrappers for android-x86_64
uses: actions/download-artifact@v4
with:
name: wrappers-android-x86_64
path: wrappers/build
- name: Fetch wrappers for windows-Win32
uses: actions/download-artifact@v4
with:
name: wrappers-windows-Win32
path: wrappers/build
- name: Fetch wrappers for windows-x64
uses: actions/download-artifact@v4
with:
name: wrappers-windows-x64
path: wrappers/build
- name: Fetch wrappers for windows-ARM64
uses: actions/download-artifact@v4
with:
name: wrappers-windows-ARM64
path: wrappers/build
- name: Fetch wrappers for windows-uwp-Win32
uses: actions/download-artifact@v4
with:
name: wrappers-windows-uwp-Win32
path: wrappers/build
- name: Fetch wrappers for windows-uwp-x64
uses: actions/download-artifact@v4
with:
name: wrappers-windows-uwp-x64
path: wrappers/build
- name: Fetch wrappers for windows-uwp-ARM
uses: actions/download-artifact@v4
with:
name: wrappers-windows-uwp-ARM
path: wrappers/build
- name: Fetch wrappers for windows-uwp-ARM64
uses: actions/download-artifact@v4
with:
name: wrappers-windows-uwp-ARM64
path: wrappers/build
- name: Fetch wrappers for iOS-Device
uses: actions/download-artifact@v4
with:
name: wrappers-iOS-Device
path: wrappers/build
- name: Fetch wrappers for iOS-Simulator
uses: actions/download-artifact@v4
with:
name: wrappers-iOS-Simulator
path: wrappers/build
- name: Fetch wrappers for tvOS-Device
uses: actions/download-artifact@v4
with:
name: wrappers-tvOS-Device
path: wrappers/build
- name: Fetch wrappers for tvOS-Simulator
uses: actions/download-artifact@v4
with:
name: wrappers-tvOS-Simulator
path: wrappers/build
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Realm/Realm
run: msbuild Realm/Realm -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Build Realm/Realm.UnityUtils
run: msbuild Realm/Realm.UnityUtils -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Build Realm/Realm.UnityWeaver
run: msbuild Realm/Realm.UnityWeaver -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Read version
id: get-version
run: |-
cd Realm/packages
pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p')
echo "package_version=$pkgVersion" >> $GITHUB_OUTPUT
shell: bash
- name: Store artifacts for Realm.${{ steps.get-version.outputs.package_version }}
uses: actions/upload-artifact@v4
with:
name: Realm.${{ steps.get-version.outputs.package_version }}
path: Realm/packages/Realm.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.UnityUtils.${{ steps.get-version.outputs.package_version }}
uses: actions/upload-artifact@v4
with:
name: Realm.UnityUtils.${{ steps.get-version.outputs.package_version }}
path: Realm/packages/Realm.UnityUtils.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.UnityWeaver.${{ steps.get-version.outputs.package_version }}
uses: actions/upload-artifact@v4
with:
name: Realm.UnityWeaver.${{ steps.get-version.outputs.package_version }}
path: Realm/packages/Realm.UnityWeaver.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for ExtractedChangelog
uses: actions/upload-artifact@v4
with:
name: ExtractedChangelog
path: Realm/Realm/ExtractedChangelog.md
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Check Docfx cache
id: check-docfx-cache
if: contains(github.head_ref, 'release')
uses: actions/cache@v4
with:
path: C:\docfx
key: docfx-2.75.2
- name: Download docfx
if: contains(github.head_ref, 'release') && steps.check-docfx-cache.outputs.cache-hit != 'true'
run: |-
Invoke-WebRequest -Uri https://github.com/dotnet/docfx/releases/download/v2.75.2/docfx-win-x64-v2.75.2.zip -OutFile C:\docfx.zip
Expand-Archive -Path C:\docfx.zip -DestinationPath C:\docfx
- name: Build docs
if: contains(github.head_ref, 'release')
env:
DOCFX_SOURCE_BRANCH_NAME: ${{ github.head_ref }}
run: C:\docfx\docfx Docs/docfx.json
- name: Update Improve this doc links
if: contains(github.head_ref, 'release')
run: |-
Get-ChildItem Docs/_site -Filter *.html -Recurse -File |
ForEach-Object {
$content = ($_ | Get-Content -Raw)
$content = $content -replace "/Docs/apispec/new\?filename", "/Docs/apispec?filename"
Set-Content $_.FullName $content
}
shell: pwsh
- name: Archive docs
if: contains(github.head_ref, 'release')
run: Compress-Archive -Path Docs/_site -DestinationPath "Realm/packages/Docs.zip"
- name: Store artifacts for Docs.zip
if: contains(github.head_ref, 'release')
uses: actions/upload-artifact@v4
with:
name: Docs.zip
path: Realm/packages/Docs.zip
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
build-unity:
name: Package Unity
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.UnityUtils
uses: actions/download-artifact@v4
with:
name: Realm.UnityUtils.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.UnityWeaver
uses: actions/download-artifact@v4
with:
name: Realm.UnityWeaver.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Build Unity
run: dotnet run --project Tools/SetupUnityPackage/ -- realm --packages-path Realm/packages --pack
- name: Store artifacts for io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
uses: actions/upload-artifact@v4
with:
name: io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
path: Realm/Realm.Unity/io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Build Tests
run: dotnet run --project Tools/SetupUnityPackage/ -- tests --realm-package Realm/Realm.Unity/io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
- name: Store artifacts for UnityTests
uses: actions/upload-artifact@v4
with:
name: UnityTests
path: Tests/Tests.Unity
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
build-unity-tests-linux:
name: Build Unity linux
needs:
- build-packages
- build-unity
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on:
- unity
- linux
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Cleanup Workspace
run: git clean -fdx
- name: Fetch io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
uses: actions/download-artifact@v4
with:
name: io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
path: Realm/Realm.Unity
- name: Fetch UnityTests
uses: actions/download-artifact@v4
with:
name: UnityTests
path: Tests/Tests.Unity
- name: Build Unity Tests
run: unity-editor -runTests -batchmode -projectPath ${{ github.workspace }}/Tests/Tests.Unity -testPlatform StandaloneLinux64 -testSettingsFile ${{ github.workspace }}/Tests/Tests.Unity/.TestConfigs/Mono-Net4.json -logFile -
- name: Store artifacts for UnityTestsRunner.linux
uses: actions/upload-artifact@v4
with:
name: UnityTestsRunner.linux
path: Tests/Tests.Unity/Player_StandaloneLinux64_Mono-Net4/
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
run-unity-tests-linux:
name: Test Unity linux
needs:
- build-unity-tests-linux
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch UnityTestsRunner.linux
uses: actions/download-artifact@v4
with:
name: UnityTestsRunner.linux
path: TestRunner
- name: Install xvfb
run: sudo apt install -y xvfb libglu1 libxcursor1
- name: Run Tests
run: |-
chmod +x ${{ github.workspace }}/TestRunner/PlayerWithTests.x86_64
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' ${{ github.workspace }}/TestRunner/PlayerWithTests.x86_64 -logFile - --result=${{ github.workspace }}/TestResults.xml
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Unity linux Mono-Net4
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
build-unity-tests-windows:
name: Build Unity windows
needs:
- build-packages
- build-unity
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on:
- unity
- windows
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Cleanup Workspace
run: git clean -fdx
- name: Fetch io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
uses: actions/download-artifact@v4
with:
name: io.realm.unity-${{ needs.build-packages.outputs.package_version }}.tgz
path: Realm/Realm.Unity
- name: Fetch UnityTests
uses: actions/download-artifact@v4
with:
name: UnityTests
path: Tests/Tests.Unity
- name: Build Unity Tests
run: unity-editor -runTests -batchmode -projectPath ${{ github.workspace }}/Tests/Tests.Unity -testPlatform StandaloneWindows64 -testSettingsFile ${{ github.workspace }}/Tests/Tests.Unity/.TestConfigs/Mono-Net4.json -logFile build.log
- name: Store artifacts for UnityTestsRunner.windows
uses: actions/upload-artifact@v4
with:
name: UnityTestsRunner.windows
path: Tests/Tests.Unity/Player_StandaloneWindows64_Mono-Net4/
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
run-unity-tests-windows:
name: Test Unity windows
needs:
- build-unity-tests-windows
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch UnityTestsRunner.windows
uses: actions/download-artifact@v4
with:
name: UnityTestsRunner.windows
path: TestRunner
- name: Run Tests
run: |-
Start-Process ${{ github.workspace }}\TestRunner\PlayerWithTests.exe -Wait -ArgumentList "-logFile","${{ github.workspace }}\test.log","--result=${{ github.workspace }}\TestResults.xml"
cat ${{ github.workspace }}\test.log
shell: pwsh
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Unity windows Mono-Net4
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-net-framework:
name: Test .NET Framework
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Realm.Tests
run: msbuild Tests/Realm.Tests -restore -p:Configuration=Release -p:TargetFramework=net461 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true
- name: Run the tests
run: ./Tests/Realm.Tests/bin/Release/net461/Realm.Tests.exe --result=TestResults.xml --labels=After
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results .NET Framework
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-uwp:
name: Test UWP
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Import test certificate
run: |-
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
$currentDirectory = Get-Location
[IO.File]::WriteAllBytes("${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx", $pfx_cert_byte)
certutil -f -p "${{ secrets.Pfx_Password }}" -importpfx my ${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx
shell: powershell
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.UWP
run: msbuild Tests/Tests.UWP -restore -p:Configuration=Release -p:AppxBundle=Always -p:PackageCertificateKeyFile=${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx -p:PackageCertificatePassword=${{ secrets.Pfx_Password }} -p:UseDotNetNativeToolchain=false -p:AppxBundlePlatforms=x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run the tests
run: ./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs
shell: powershell
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results UWP
path: ${{ env.TEST_RESULTS }}
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-net-core:
name: Test ${{ matrix.framework }}, ${{ (matrix.os.runner == 'win81' && 'win81') || matrix.os.runtime }}
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: ${{ matrix.os.runner }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Cleanup Workspace
run: git clean -fdx
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Clear nuget cache
if: ${{ matrix.os.runner == 'win81' }}
run: dotnet nuget locals all --clear
- name: Extract .NET version
id: get-net-version
run: |2-
NET_VERSION=$(echo '${{ matrix.framework }}.x' | sed 's/net//g')
echo "version=$NET_VERSION" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: ${{ steps.get-net-version.outputs.version }}
- name: Publish Tests/Realm.Tests
run: dotnet publish Tests/Realm.Tests -c Release -f ${{ matrix.framework }} -r ${{ matrix.os.runtime }} -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true --no-self-contained
- name: Output executable path
id: dotnet-publish
run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/${{ matrix.framework }}/${{ matrix.os.runtime }}/Realm.Tests' >> $GITHUB_OUTPUT
shell: bash
- name: Run the tests
env:
DOTNET_DbgEnableMiniDump: 1
DOTNET_EnableCrashReport: 1
run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After
- name: Archive core dump
if: ${{ failure() && runner.os != 'Windows' }}
uses: actions/upload-artifact@v4
with:
name: crash-report-net-core-${{ runner.os }}-${{ runner.arch }}
path: /tmp/coredump*
retention-days: 30
if-no-files-found: warn
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results ${{ matrix.framework }}, ${{ (matrix.os.runner == 'win81' && 'win81') || matrix.os.runtime }}
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
strategy:
matrix:
framework:
- net6.0
os:
- runner: windows-latest
runtime: win-x64
- runner: ubuntu-latest
runtime: linux-x64
- runner: macos-13
runtime: osx-x64
include:
- framework: net8.0
os:
runner: macos-14
runtime: osx-arm64
fail-fast: false
test-macos-xamarin:
name: Test Xamarin.macOS
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-12
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.XamarinMac
run: msbuild Tests/Tests.XamarinMac -restore -p:Configuration=Release -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run the tests
run: Tests/Tests.XamarinMac/bin/Release/Tests.XamarinMac.app/Contents/MacOS/Tests.XamarinMac --headless --result=${{ github.workspace }}/TestResults.xml --labels=All
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Xamarin.macOS
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-macos-maui:
name: Test Maui.MacCatalyst
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-14
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Setup Maui workload
run: dotnet workload install maui
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
xcode-version: latest-stable
- name: Build Tests/Tests.Maui
run: dotnet build Tests/Tests.Maui -c Release -f net8.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run the tests
run: Tests/Tests.Maui/bin/Release/net8.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.xml --labels=All
- name: Transform Results
run: xsltproc --output TestResults.xml_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt TestResults.xml
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Maui.MacCatalyst
path: TestResults.xml_transformed.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-ios-xamarin:
name: Test Xamarin.iOS
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-12
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.iOS
run: msbuild Tests/Tests.iOS -restore -p:Configuration=Release -p:Platform=iPhoneSimulator -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run on Simulator
uses: realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf
with:
appPath: Tests/Tests.iOS/bin/iPhoneSimulator/Release/Tests.iOS.app
bundleId: io.realm.dotnettests
iphoneToSimulate: iPhone-8
arguments: '--headless --result=${{ github.workspace }}/TestResults.xml --labels=All '
os: iOS
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Xamarin.iOS
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-ios-maui:
name: Test Maui.iOS
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-14
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Setup Maui workload
run: dotnet workload install maui
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
xcode-version: latest-stable
- name: Build Tests/Tests.Maui
run: dotnet build Tests/Tests.Maui -c Release -f net8.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run on Simulator
uses: realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf
with:
appPath: Tests/Tests.Maui/bin/Release/net8.0-ios/iossimulator-x64/Tests.Maui.app
bundleId: io.realm.mauitests
iphoneToSimulate: iPhone-15
arguments: --headless --result=${{ github.workspace }}/TestResults.xml --labels=All
os: iOS
- name: Transform Results
run: xsltproc --output TestResults.xml_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt TestResults.xml
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Maui.iOS
path: TestResults.xml_transformed.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-tvos:
name: Test Xamarin.tvOS
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: macos-12
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.XamarinTVOS
run: msbuild Tests/Tests.XamarinTVOS -restore -p:Configuration=Release -p:Platform=iPhoneSimulator -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run on Simulator
uses: realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf
with:
appPath: Tests/Tests.XamarinTVOS/bin/iPhoneSimulator/Release/Tests.XamarinTVOS.app
bundleId: io.realm.Tests-XamarinTVOS
iphoneToSimulate: Apple-TV-1080p
arguments: --headless --result=${{ github.workspace }}/TestResults.xml --labels=All
os: tvOS
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Xamarin.tvOS
path: TestResults.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-android-xamarin:
name: Test Xamarin.Android
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Setup JDK
uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a
with:
distribution: microsoft
java-version: 17
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Add msbuild to PATH
if: ${{ runner.os == 'Windows' }}
uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9
- name: Build Tests/Tests.Android
run: msbuild Tests/Tests.Android -t:SignAndroidPackage -restore -p:Configuration=Release -p:AndroidUseSharedRuntime=False -p:EmbedAssembliesIntoApk=True -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_DEVICEFARM_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVICEFARM_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Run the tests
id: run_tests
uses: ./.github/actions/run-android-device-farm-test
with:
apk-path: ${{ github.workspace }}/Tests/Tests.Android/bin/Release/io.realm.xamarintests-Signed.apk
app-id: io.realm.xamarintests
project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }}
device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }}
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Xamarin.Android
path: ${{ steps.run_tests.outputs.test-results-path }}
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-android-maui:
name: Test Maui.Android
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Setup JDK
uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a
with:
distribution: microsoft
java-version: 17
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59
with:
dotnet-version: 8.0.x
- name: Setup Maui workload
run: dotnet workload install maui
- name: Publish Tests/Tests.Maui
run: dotnet publish Tests/Tests.Maui -c Release -f net8.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} --no-self-contained
- name: Output executable path
id: dotnet-publish
run: echo 'executable-path=./Tests/Tests.Maui/bin/Release/net8.0-android/null/Tests.Maui' >> $GITHUB_OUTPUT
shell: bash
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_DEVICEFARM_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVICEFARM_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Run the tests
id: run_tests
uses: ./.github/actions/run-android-device-farm-test
with:
apk-path: ${{ github.workspace }}/Tests/Tests.Maui/bin/Release/net8.0-android/publish/io.realm.mauitests-Signed.apk
app-id: io.realm.mauitests
project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }}
device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }}
- name: Transform Results
run: xsltproc --output ${{ steps.run_tests.outputs.test-results-path }}_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt ${{ steps.run_tests.outputs.test-results-path }}
- name: Publish Unit Test Results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Results Maui.Android
path: ${{ steps.run_tests.outputs.test-results-path }}_transformed.xml
reporter: java-junit
list-suites: failed
path-replace-backslashes: true
fail-on-error: true
test-woven-classes:
name: Test Woven Classes
needs:
- build-packages
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register problem matchers
run: |-
echo "::add-matcher::.github/problem-matchers/csc.json"
echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v4
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Publish Tests/Realm.Tests
run: dotnet publish Tests/Realm.Tests -c Release -f net8.0 -r win-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true -p:TestWeavedClasses=true --no-self-contained
- name: Output executable path