-
Notifications
You must be signed in to change notification settings - Fork 43
1048 lines (1012 loc) · 37.1 KB
/
ci.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
name: CI
on:
push:
branches:
- '*'
tags:
- v*
env:
#OPENTAP_COLOR: auto # github messes with the "auto" detection (i.e. it has no effect), and "always" breaks a lot of things
OPENTAP_ANSI_COLORS: true
OPENTAP_NO_UPDATE_CHECK: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_CONSOLE_ANSI_COLOR: true
SMARTINSTALLER_IMAGE: ghcr.io/opentap/smartinstaller:2.1.0-rc
jobs:
GetVersion:
runs-on: ubuntu-20.04
outputs:
ShortVersion: ${{ steps.gitversion.outputs.ShortVersion }}
LongVersion: ${{ steps.gitversion.outputs.LongVersion }}
GitVersion: ${{ steps.gitversion.outputs.GitVersion }}
SmartInstallerVersion: ${{ steps.smartInstallerVersion.outputs.ver }}
steps:
# The get-gitversion action installs OpenTAP and fetches with fetch-depth: 0
- name: GitVersion
id: gitversion
uses: opentap/get-gitversion@bump-opentap
- name: SmartInstallerVersion
id: smartInstallerVersion
run: echo "VER=$SMARTINSTALLER_IMAGE" >> $GITHUB_OUTPUT
CheckSecrets:
runs-on: ubuntu-latest
outputs:
gitlab_registry_token_is_set: ${{ steps.check_GITLAB_REGISTRY_TOKEN.outputs.is_set }}
sign_is_set: ${{ steps.check_sign.outputs.is_set }}
steps:
- id: check_GITLAB_REGISTRY_TOKEN
name: Check whether GITLAB_REGISTRY_TOKEN is set
run: |
if [ -z "${{ secrets.GITLAB_REGISTRY_TOKEN }}" ]; then
echo "Not set"
echo "is_set=false" >> $GITHUB_OUTPUT
else
echo "Set"
echo "is_set=true" >> $GITHUB_OUTPUT
fi
- id: check_sign
name: Check whether sign secrets are set
run: |
if [ -z "${{ secrets.SIGN_SERVER_CERT }}" -o \
-z "${{ secrets.TAP_SIGN_ADDRESS }}" -o \
-z "${{ secrets.TAP_SIGN_AUTH }}" -o \
-z "${{ secrets.S3_KEY_ID }}" -o \
-z "${{ secrets.S3_SECRET }}" ]; then
echo "Not set"
echo "is_set=false" >> $GITHUB_OUTPUT
else
echo "Set"
echo "is_set=true" >> $GITHUB_OUTPUT
fi
##############
### BUILDS ###
##############
Build-DevGuide:
needs: CheckSecrets
if: needs.CheckSecrets.outputs.gitlab_registry_token_is_set == 'true'
runs-on: ubuntu-latest
container:
image: registry.gitlab.com/opentap/buildrunners/documentationgeneration:latest
credentials:
username: github
password: ${{ secrets.GITLAB_REGISTRY_TOKEN}}
steps:
- name: Checkout
uses: actions/checkout@v3
- run: tap generate-pdf "doc/Developer Guide/Readme.md" --toc --skip-first-file --out "sdk/Examples/OpenTAP Developer Guide.pdf" --frontpage "doc/Developer Guide/Frontpage.html" --frontpage-file "doc/Developer Guide/Frontpage.png"
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: doc-devguide
retention-days: 5
path: |
sdk/Examples/OpenTAP Developer Guide.pdf
Build-ApiDoc:
needs: CheckSecrets
if: needs.CheckSecrets.outputs.gitlab_registry_token_is_set == 'true'
runs-on: ubuntu-latest
container:
image: registry.gitlab.com/opentap/buildrunners/doxygen:alpine
credentials:
username: github
password: ${{ secrets.GITLAB_REGISTRY_TOKEN}}
steps:
- name: Checkout
uses: actions/checkout@v4
- run: |
mkdir Help API
ver=$(grep ^version .gitversion | sed 's/version[ ]*=[ ]*//' | cut -d. -f 1-2)
sed -i "s/\$(GitVersion)/$ver/" "doc/API Documentation/Doxyfile"
rootdir=`pwd`
cd "doc/API Documentation"
doxygen Doxyfile
cd apiref/html
chmcmd index.hhp
mv OpenTapApiReference.chm $rootdir/Help/
cp -r . $rootdir/API/
- name: Upload binaries (CHM)
uses: actions/upload-artifact@v4
with:
name: doc-api-chm
retention-days: 5
path: Help/OpenTapApiReference.chm
- name: Upload binaries (HTML)
uses: actions/upload-artifact@v4
with:
name: doc-api-html
retention-days: 5
path: API
Build-Pages:
runs-on: ubuntu-latest
needs:
- Build-ApiDoc
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
run: rm 'doc/User Guide/Readme.md' 'doc/Developer Guide/Readme.md'
- name: Download API Artifacts
uses: actions/download-artifact@v4
with:
name: doc-api-html
path: API
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: "doc/package-lock.json"
- name: Install dependencies
run: npm ci
working-directory: doc
# This is needed because the router wants to serve index.html as the default page
- name: Rename Index
run: mv Readme.md index.md
working-directory: doc
- name: Build with VitePress
run: npm run docs:build
working-directory: doc
- name: Copy API
run: cp -r API public/api
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
publish_dir: public
deploy_key: ${{ secrets.PAGES_DEPLOY_TOKEN }}
publish_branch: main
external_repository: opentap/opentap.github.io
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pages
retention-days: 5
path: public
Build-Linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Build
run: dotnet publish -c Release OpenTAP.sln
- name: Copy Debug Package
run: cp ./bin/Release/OpenTap.Debug.TapPackage ./bin/Release/publish/dbg.zip
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: Linux-bin
retention-days: 5
path: |
bin/Release/publish/*
Build-Win:
runs-on: windows-2022
strategy:
matrix:
Architecture: [x86, x64]
needs: GetVersion
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Nuget Cache
uses: actions/cache@v4
id: cache
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files
restore-keys: ${{ runner.os }}-nuget-
- name: Stamp Version
run: |
$AssemblyVersion = "`"${{needs.GetVersion.outputs.ShortVersion}}.0`""
$AssemblyFileVersion = "`"${{needs.GetVersion.outputs.ShortVersion}}`""
$GitVersion = "`"${{needs.GetVersion.outputs.GitVersion}}`""
Push-Location ./tap/Properties
$AssemblyInfoFile = (Get-Content AssemblyInfo.cs.Template)
$AssemblyInfoFile = ($AssemblyInfoFile) -replace '"AssemblyVersion"', $AssemblyVersion
$AssemblyInfoFile = ($AssemblyInfoFile) -replace '"AssemblyFileVersion"', $AssemblyFileVersion
$AssemblyInfoFile = ($AssemblyInfoFile) -replace '"AssemblyInformationalVersion"', $GitVersion
$AssemblyInfoFile | Set-Content AssemblyInfo.cs
cat AssemblyInfo.cs
Pop-Location
- name: Restore
#if: steps.cache.outputs.cache-hit != 'true'
run: |
dotnet restore /p:Platform=${{ matrix.Architecture }}
- name: Build
run: dotnet build --no-restore -c Release /p:Platform=${{ matrix.Architecture }}
- name: Build tap.csproj
run: dotnet build --no-restore tap/tap.csproj -c Release /p:Platform=${{ matrix.Architecture }}
- name: cat tap.runtimeconfig.json
run: get-content ./bin/Release/tap.runtimeconfig.json
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: win-${{ matrix.Architecture }}-bin
retention-days: 5
path: |
bin/Release/*
Build-MacOS:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Build
run: dotnet publish -c Release OpenTAP.sln
- name: Copy Debug Package
run: cp ./bin/Release/OpenTap.Debug.TapPackage ./bin/Release/publish/dbg.zip
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: MacOS-bin
retention-days: 5
path: |
bin/Release/publish/*
##############
### TESTS ###
##############
TestEngine:
runs-on: windows-2022
needs: Build-Win
strategy:
matrix:
retries: [ 0, 1 ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: win-x64-bin
path: bin/
- name: Test
run: |
$ErrorActionPreference = "Stop" # Timeout: 5 minutes (normally takes 2 minutes to run)
dotnet vstest bin/OpenTap.UnitTests.dll --logger:"console;verbosity=detailed" -- RunConfiguration.TestSessionTimeout=300000 RunConfiguration.TreatNoTestsAsError=true
TestPackage:
runs-on: windows-2022
needs: Build-Win
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: win-x64-bin
path: bin/Release
- name: Test
run: |
$ErrorActionPreference = "Stop"
#Copy-Item .\bin\Release\runtimes\win-x64\native\git2-b7bad55.dll .\bin\Release
cd bin/Release # Timeout: 10 minutes (normally takes 5 minutes to run)
dotnet vstest /framework:.NETFramework,Version=v4.62 /Platform:x64 OpenTap.Package.UnitTests.dll --logger:"console;verbosity=detailed" -- RunConfiguration.TestSessionTimeout=600000 RunConfiguration.TreatNoTestsAsError=true
TestWindowsPlan:
runs-on: windows-2022
needs:
- Build-Win
- Package-Templates
strategy:
matrix:
retries: [ 0, 1 ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: win-x64-bin
path: bin/Release/
- name: Download Template package
uses: actions/download-artifact@v4
with:
name: package-templates
path: sdk-template
- name: Install Templates
run: dotnet new --install ./sdk-template/*.nupkg
- name: Test
working-directory: bin/Release
run: ./tap.exe run ../../tests/regression.TapPlan --verbose --color
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: regression-files
path: |
NewProj*/**
TestLinuxPlan:
runs-on: ubuntu-20.04
needs:
- Build-Linux
- Package-Templates
strategy:
matrix:
retries: [ 0, 1 ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: Linux-bin
path: bin/Release/
- name: Download Template package
uses: actions/download-artifact@v4
with:
name: package-templates
path: sdk-template
- name: Install Templates
run: dotnet new --install ./sdk-template/*.nupkg
- run: chmod +x bin/Release/tap
# The .pdb files are in use for some reason during `tap package install`
- run: rm ./bin/Release/*.pdb
- run: bin/Release/tap package install ./bin/Release/dbg.zip -f --no-isolation
- run: bin/Release/tap run tests/regression.TapPlan --verbose --color
TestMacPlan:
runs-on: macos-14
needs:
- Build-MacOS
- Package-Templates
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: MacOS-bin
path: bin/Release/
- name: Download Template package
uses: actions/download-artifact@v4
with:
name: package-templates
path: sdk-template
- name: Install Templates
run: dotnet new --install ./sdk-template/*.nupkg
- run: chmod +x bin/Release/tap
# The .pdb files are in use for some reason during `tap package install`
- run: rm ./bin/Release/*.pdb
- run: bin/Release/tap package install ./bin/Release/dbg.zip -f --no-isolation
- run: bin/Release/tap run tests/regression.TapPlan --verbose --color
###############
### Package ###
###############
Package-Win:
if: needs.CheckSecrets.outputs.sign_is_set == 'true'
runs-on: windows-2022
strategy:
matrix:
Architecture: [x86, x64]
needs:
- CheckSecrets
- Build-Win
- Build-ApiDoc
- GetVersion
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Download x64 binaries
uses: actions/download-artifact@v4
with:
name: win-x64-bin
path: bin/Release-x64/
- name: Download x86 binaries
uses: actions/download-artifact@v4
with:
name: win-x86-bin
path: bin/Release-x86/
- name: Download API Reference
uses: actions/download-artifact@v4
with:
name: doc-api-chm
path: Help/
- name: Caching Signing tools
uses: actions/cache@v4
id: cache
with:
path: ./sign.TapPackage
key: ${{ runner.os }}-signpackage-1.3.0 }}
- name: Copy Signing tools
if: steps.cache.outputs.cache-hit != 'true'
run: aws s3 cp s3://ks-github-runner-tools/sign.1.3.0.TapPackage ./sign.TapPackage --region eu-central-1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET }}
- name: Install Sign
working-directory: bin/Release-x64
run: .\tap.exe package install -f -v --no-isolation ../../sign.TapPackage
- name: Write Sign Cert
env:
TAP_SIGN_CERT: ${{ github.workspace }}/sign.cer
run: echo "${{ secrets.SIGN_SERVER_CERT }}" > $env:TAP_SIGN_CERT
- name: Create Package
working-directory: bin/Release-${{ matrix.Architecture }}
env:
TAP_SIGN_ADDRESS: ${{ secrets.TAP_SIGN_ADDRESS }}
TAP_SIGN_AUTH: ${{ secrets.TAP_SIGN_AUTH }}
TAP_SIGN_CERT: ${{ github.workspace }}/sign.cer
Sign: ${{github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v')}}
Platform: "Windows"
Architecture: "${{ matrix.Architecture }}"
run: ..\Release-x64\tap.exe package create -v -c ../../package.xml -o ../../OpenTAP.${{ needs.GetVersion.outputs.GitVersion }}.${{ matrix.Architecture }}.Windows.TapPackage
- uses: actions/upload-artifact@v4
with:
name: win-${{ matrix.Architecture }}-package
retention-days: 14
path: |
OpenTAP.*.Windows.TapPackage
Package-Cross:
runs-on: ubuntu-latest
needs:
- Build-Linux
- Build-MacOS
- Build-ApiDoc
- GetVersion
strategy:
matrix:
include:
- os: MacOS
arch: x64
- os: MacOS
arch: arm64
- os: Linux
arch: x64
- os: Linux
arch: arm
- os: Linux
arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Download linux binaries
uses: actions/download-artifact@v4
with:
name: Linux-bin
path: bin/Linux-x64/
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-bin
path: bin/output/
- name: Download API Reference
uses: actions/download-artifact@v4
with:
name: doc-api-chm
path: Help/
- name: Manually copy the correct newtonsoft dll here since it was overwritten by a unittest
run: cp Installer/Assets/Newtonsoft.Json.dll bin/output/
- name: Set execute permissions
run: chmod +x bin/Linux-x64/tap
- name: Package
working-directory: bin/output/
run: ../Linux-x64/tap package create -v -c ../../package.xml -o Packages/OpenTAP.${{ matrix.os }}.${{ matrix.arch }}.TapPackage
env:
Platform: ${{ matrix.os }}
Architecture: ${{ matrix.arch }}
Sign: false
- name: Rename package
run: cp bin/output/Packages/OpenTAP.${{ matrix.os }}.${{ matrix.arch }}.TapPackage OpenTAP.${{ needs.GetVersion.outputs.GitVersion }}.${{ matrix.os }}.${{ matrix.arch }}.TapPackage
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.arch }}-package
retention-days: 14
path: |
OpenTAP.*.TapPackage
Package-Templates:
runs-on: windows-2022
needs:
- GetVersion
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Update Version
run: |
Set-Content .\templates\Templates.csproj (Get-Content .\templates\Templates.csproj).Replace("`$(GitVersion)", "${{needs.GetVersion.outputs.LongVersion}}")
Set-Content .\templates\src\project\ProjectName.csproj (Get-Content .\templates\src\project\ProjectName.csproj).Replace("`$(GitVersion)", "${{needs.GetVersion.outputs.LongVersion}}")
- name: Package
run: dotnet pack ./templates/
- uses: actions/upload-artifact@v4
with:
name: package-templates
retention-days: 14
path: ./bin/Release/OpenTAP.Templates.*.nupkg
Package-SDK:
runs-on: windows-2022
needs:
- Build-Win
- Build-DevGuide
- Build-ApiDoc
- GetVersion
- Package-Templates
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: win-x64-bin
path: bin/Release/
- name: Download Developer Guide
uses: actions/download-artifact@v3
with:
name: doc-devguide
path: sdk/Examples/
- name: Download API Reference
uses: actions/download-artifact@v4
with:
name: doc-api-chm
path: Help/
- name: Download Template package
uses: actions/download-artifact@v4
with:
name: package-templates
path: bin/Release/Packages2/SDK/
- name: Package
run: |
$env:Sign = "false"
$env:Architecture = "x86"
$env:Platform = "Windows"
cd bin/Release
Remove-Item -Recurse -Force ./Packages
#cp .\runtimes\win-x64\native\git2-b7bad55.dll .
.\tap.exe package create ../../package.xml --install -v -c
Copy-Item "../../sdk/Examples" "Packages/SDK/Examples" -Recurse
Copy-Item "../../Package/PackageSchema.xsd" "Packages/SDK/PackageSchema.xsd"
cd Packages/SDK/Examples
$doc = New-Object System.Xml.XmlDataDocument
$doc.PreserveWhitespace=1
$doc.Load("$pwd/Directory.Build.props")
$ele = $doc.GetElementsByTagName("PropertyGroup") | Where-Object { $_.GetElementsByTagName("GitVersion").Count -gt 0 }
$doc.FirstChild.RemoveChild($ele) # First Child is the Project element
$doc.Save("$pwd/Directory.Build.props")
cd ../../..
Move-Item "Packages2/SDK/OpenTap.Templates.*.nupkg" "Packages/SDK/"
$content=(Get-Content Packages/SDK/Examples/Directory.Build.props).Replace("`$(GitVersion)", "${{needs.GetVersion.outputs.LongVersion}}")
Set-Content Packages/SDK/Examples/Directory.Build.props $content
./tap package create -v -c ../../sdk/sdk.package.xml
Move-Item "*.TapPackage" "../.."
- uses: actions/upload-artifact@v4
with:
name: package-sdk
retention-days: 14
path: |
SDK.*.TapPackage
Package-Diff:
runs-on: ubuntu-20.04
needs:
- Package-Cross
steps:
- uses: opentap/setup-opentap@v1.0
with:
version: 9.21.1
packages: 'Package Diff:0.1.0-beta.19+2b1aa952'
- name: Download package
uses: actions/download-artifact@v4
with:
name: Linux-x64-package
path: .
- name: Rename Package
run: mv OpenTAP.*.TapPackage OpenTAP.TapPackage
- name: Diff Package
run: tap package diff OpenTAP.TapPackage -o diff
Package-NuGet:
runs-on: windows-2022
needs:
- Build-Win
- Package-Win
- Package-Cross
- GetVersion
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix tags
if: startsWith(github.ref, 'refs/tags/v')
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v4. See https://github.com/actions/checkout/issues/290
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: win-x64-bin
path: bin/Release/
- name: Download x86 package
uses: actions/download-artifact@v4
with:
name: win-x86-package
path: .
- name: Download x64 package
uses: actions/download-artifact@v4
with:
name: win-x64-package
path: .
- name: Download Linux arm package
uses: actions/download-artifact@v4
with:
name: Linux-arm64-package
path: .
- name: Download Linux x64 package
uses: actions/download-artifact@v4
with:
name: Linux-x64-package
path: .
- name: Download MacOS x64 package
uses: actions/download-artifact@v4
with:
name: MacOS-x64-package
path: .
- name: Download MacOS arm64 package
uses: actions/download-artifact@v4
with:
name: MacOS-arm64-package
path: .
- name: Package
run: |
#cp bin\Release\runtimes\win-x64\native\git2-b7bad55.dll bin\Release
$content=(Get-Content ./nuget/OpenTAP.nuspec).Replace("`$(GitVersion)", "${{needs.GetVersion.outputs.LongVersion}}")
Set-Content ./nuget/OpenTAP.nuspec $content
New-Item -Force ./nuget/build/payload -ItemType Directory | Out-Null
# Expand-Archive will only extract .zip extensions
Move-Item OpenTAP.*.x86.Windows.TapPackage OpenTAP.x86.zip
Move-Item OpenTAP.*.x64.Windows.TapPackage OpenTAP.x64.zip
Move-Item OpenTAP.*.Linux.x64.TapPackage OpenTAP.Linux.x64.zip
Move-Item OpenTAP.*.Linux.arm64.TapPackage OpenTAP.Linux.arm64.zip
Move-Item OpenTAP.*.MacOS.x64.TapPackage OpenTAP.MacOS.x64.zip
Move-Item OpenTAP.*.MacOS.arm64.TapPackage OpenTAP.MacOS.arm64.zip
Move-Item ./bin/Release/Keysight.OpenTap.Sdk.MSBuild.dll ./nuget/build
Move-Item ./bin/Release/DotNet.Glob.NetStandard1.1.dll ./nuget/build/DotNet.Glob.dll
echo "Install opentap"
./bin/Release/tap package install ./OpenTap.x64.zip -t ./nuget/build/payload -f -v --no-isolation
# package.xml, tap.dll, and tap.runtimeconfig.json of an installation should always come from
# one of the Runtime directories. Delete it from the payload directory.
Remove-Item ./nuget/build/payload/Packages/OpenTAP/package.xml
# these files only exists when building for net6.0.
#Remove-Item ./nuget/build/payload/tap.dll
#Remove-Item ./nuget/build/payload/tap.runtimeconfig.json
Move-Item ./bin/Release/OpenTap.Package.xml ./nuget/build/payload
Move-Item ./bin/Release/OpenTap.xml ./nuget/build/payload
Push-Location ./nuget/build/payload
Remove-Item tap.exe
Remove-Item ./Dependencies/LibGit2Sharp.0.27.0.0/git2*.dll
Pop-Location
echo "Expand archive"
Expand-Archive OpenTAP.x64.zip win-x64 -Verbose
Expand-Archive OpenTAP.x86.zip win-x86 -Verbose
Expand-Archive OpenTAP.Linux.x64.zip linux-x64 -Verbose
Expand-Archive OpenTAP.Linux.arm64.zip linux-arm64 -Verbose
Expand-Archive OpenTAP.MacOS.x64.zip macos-x64 -Verbose
Expand-Archive OpenTAP.MacOS.arm64.zip macos-arm64 -Verbose
./nuget/NugetPackager.ps1
cd ./nuget
Invoke-WebRequest -Method Get -Uri "https://dist.nuget.org/win-x86-commandline/v5.7.1/nuget.exe" -OutFile nuget.exe
echo "Pack nuget"
.\nuget pack OpenTAP.nuspec -OutputDirectory ../
- uses: actions/upload-artifact@v4
with:
name: nuget-package
retention-days: 14
path: |
*.nupkg
Build-Installer-Windows:
runs-on: ubuntu-latest
needs:
- GetVersion
- Package-Win
- Package-SDK
container:
image: ${{ needs.GetVersion.outputs.SmartInstallerVersion }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Windows package
uses: actions/download-artifact@v4
with:
name: win-x64-package
path: .
- run: mv OpenTAP.*.Windows.TapPackage Installer/Assets/OpenTAP.TapPackage
- run: echo "${{ secrets.SIGN_SERVER_CERT }}" > $GITHUB_WORKSPACE/sign.cer
- name: Download SDK package
uses: actions/download-artifact@v4
with:
name: package-sdk
path: Installer/Assets
- run: mv SDK*TapPackage SDK.TapPackage
name: Rename SDK
working-directory: Installer/Assets
- run: tap installer create "opentap.installer.xml" -v --target-os win
working-directory: Installer/Assets
env:
TAP_SIGN_ADDRESS: ${{ secrets.TAP_SIGN_ADDRESS }}
TAP_SIGN_AUTH: ${{ secrets.TAP_SIGN_AUTH }}
TAP_SIGN_CERT: ${{ github.workspace }}/sign.cer
- run: mv Installer/Assets/setup.exe OpenTAP.${{needs.GetVersion.outputs.LongVersion}}.exe
- uses: actions/upload-artifact@v4
with:
name: installer-windows
retention-days: 14
path: OpenTAP.*.exe
Publish-Installer-Windows:
if: contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
environment: packages.opentap.io
runs-on: ubuntu-latest
needs:
- Build-Installer-Windows
- GetVersion
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: installer-windows
- name: Rename Artifact
run: mv OpenTAP.*.exe OpenTAP.exe
- name: Upload Installer
env:
INSTALLER_PUBLISH_KEY: ${{ secrets.INSTALLER_PUBLISH_KEY }}
run: |
curl -i -X POST 'http://packages.opentap.io/4.0/Objects/www/' \
-H 'Metadata-Version: "${{ needs.GetVersion.outputs.LongVersion }}"' \
-H 'Metadata-OS: "Windows"' \
-H "Authorization: Token: $INSTALLER_PUBLISH_KEY" \
--form 'file=@"'$(pwd)'/OpenTAP.exe"'
Build-Installer-Linux:
runs-on: ubuntu-latest
needs:
- GetVersion
- Package-Cross
- Package-SDK
container:
image: ${{ needs.GetVersion.outputs.SmartInstallerVersion }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Linux package
uses: actions/download-artifact@v4
with:
name: Linux-x64-package
path: .
- run: mv OpenTAP.*.Linux.*.TapPackage Installer/Assets/OpenTAP.TapPackage
name: Rename package
- name: Download SDK package
uses: actions/download-artifact@v4
with:
name: package-sdk
path: Installer/Assets
- run: mv SDK*TapPackage SDK.TapPackage
name: Rename SDK
working-directory: Installer/Assets
- run: tap installer create "opentap.installer.linux.xml" -v --target-os linux
working-directory: Installer/Assets
name: Build installer
- run: mv Installer/Assets/Installer Installer/Assets/OpenTAP
- uses: actions/upload-artifact@v4
with:
name: installer-linux
retention-days: 14
path: Installer/Assets/OpenTAP
Publish-Installer-Linux:
if: contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
environment: packages.opentap.io
runs-on: ubuntu-latest
needs:
- Build-Installer-Linux
- GetVersion
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: installer-linux
- name: Upload Installer
env:
INSTALLER_PUBLISH_KEY: ${{ secrets.INSTALLER_PUBLISH_KEY }}
run: |
curl -i -X POST 'http://packages.opentap.io/4.0/Objects/www/' \
-H 'Metadata-Version: "${{ needs.GetVersion.outputs.LongVersion }}"' \
-H 'Metadata-OS: "Linux"' \
-H "Authorization: Token: $INSTALLER_PUBLISH_KEY" \
--form 'file=@"'$(pwd)'/OpenTAP"'
Docker-Linux:
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v')
runs-on: ubuntu-20.04
environment: sign
strategy:
matrix:
include:
- target: production
tag-suffix: "-slim"
- target: development
tag-suffix: ""
- target: production-hardened
tag-suffix: "-slim-hardened"
needs:
- Package-Cross
- GetVersion
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Linux package
uses: actions/download-artifact@v4
with:
name: Linux-x64-package
path: .
- name: Prepare
run: |
mv OpenTAP.*.Linux.*.TapPackage docker/Linux/OpenTAP.Linux.TapPackage
echo "TAG_NAME=alpha" >> $GITHUB_ENV
- name: Set tag (beta)
if: github.ref == 'refs/heads/main'
run: echo "TAG_NAME=beta" >> $GITHUB_ENV
- name: Set tag (rc)
if: contains(github.ref, 'refs/heads/release')
run: echo "TAG_NAME=rc" >> $GITHUB_ENV
- name: Set tag (release)
if: contains(github.ref, 'refs/tags/v')
run: echo "TAG_NAME=${{needs.GetVersion.outputs.ShortVersion}}" >> $GITHUB_ENV
- name: Docker Build
uses: aevea/action-kaniko@master
with:
image: opentapio/opentap
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
target: ${{ matrix.target }}
tag: ${{env.TAG_NAME}}${{ matrix.tag-suffix }}
path: docker/Linux
###############
### Publish ###
###############
Publish-NuGet:
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v')
environment: nuget.org
runs-on: windows-2022
needs:
- Package-NuGet
steps:
- name: Download nuget package
uses: actions/download-artifact@v4
with:
name: nuget-package
path: .
- name: Package
run: nuget push OpenTAP.*.nupkg ${{ secrets.NUGET_KEY }} -NonInteractive -Source https://api.nuget.org/v3/index.json
Publish-Templates:
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v')
environment: nuget.org
runs-on: windows-2022
needs:
- Package-Templates
steps:
- name: Download Template package
uses: actions/download-artifact@v4
with:
name: package-templates
path: .
- name: Package
run: nuget push OpenTAP.Templates*.nupkg ${{ secrets.NUGET_KEY }} -NonInteractive -Source https://api.nuget.org/v3/index.json
Publish-TapPackages:
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v')
environment: packages.opentap.io
runs-on: ubuntu-latest
needs:
- Package-Win
- Package-Cross
- Package-SDK
steps:
- name: Download Windows-x86 package
uses: actions/download-artifact@v4
with:
name: win-x86-package
path: ./publish/