Repository navigation
1974 lines (1683 loc) · 75.9 KB
/
Copy pathci.yml
File metadata and controls
1974 lines (1683 loc) · 75.9 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
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:
- master
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
sccache:
description: Enable sccache for Rust compilation caching
required: false
type: boolean
default: true
workflow_call:
inputs:
ref:
description: The commit SHA to build
required: false
type: string
sccache:
description: Enable sccache for Rust compilation caching
required: false
type: boolean
default: true
jobs:
preflight:
name: preflight
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.get-commit.outputs.ref }}
version: ${{ steps.get-version.outputs.version }}
rust-profile: ${{ steps.rust-profile.outputs.rust-profile }}
sccache: ${{ steps.sccache.outputs.enabled }}
jetsocat-build-matrix: ${{ steps.setup-matrix.outputs.jetsocat-build-matrix }}
gateway-build-matrix: ${{ steps.setup-matrix.outputs.gateway-build-matrix }}
agent-build-matrix: ${{ steps.setup-matrix.outputs.agent-build-matrix }}
steps:
- name: Setup matrix
id: setup-matrix
run: |
$Jobs = @()
$Archs = @( 'x64', 'arm64' )
$Platforms = @( 'linux', 'windows' )
$Platforms | ForEach-Object {
$Runner = switch ($_) { 'windows' { 'windows-2022' } 'linux' { 'ubuntu-22.04' } }
foreach ($Arch in $Archs) {
if ($Arch -Eq 'arm64' -And $_ -Eq 'windows') {
continue
}
$Jobs += @{
arch = $Arch
os = $_
runner = $Runner }
}
}
$GatewayMatrix = ConvertTo-JSON $Jobs -Compress
echo "gateway-build-matrix=$GatewayMatrix" >> $Env:GITHUB_OUTPUT
$Jobs = @()
$Platforms | ForEach-Object {
$Runner = switch ($_) { 'windows' { 'windows-2022' } 'linux' { 'ubuntu-22.04' } }
foreach ($Arch in $Archs) {
$Jobs += @{
arch = $Arch
os = $_
runner = $Runner }
}
}
$AgentMatrix = ConvertTo-JSON $Jobs -Compress
echo "agent-build-matrix=$AgentMatrix" >> $Env:GITHUB_OUTPUT
$Jobs = @()
$Platforms += 'macos'
$Platforms | ForEach-Object {
$Runner = switch ($_) { 'windows' { 'windows-2022' } 'macos' { 'macos-15' } 'linux' { 'ubuntu-22.04' } }
foreach ($Arch in $Archs) {
$Jobs += @{
arch = $Arch
os = $_
runner = $Runner }
}
}
$JetsocatMatrix = ConvertTo-JSON $Jobs -Compress
echo "jetsocat-build-matrix=$JetsocatMatrix" >> $Env:GITHUB_OUTPUT
shell: pwsh
## The SHA to build might be passed via workflow_call, otherwise the current commit is used
- name: Get commit
id: get-commit
run: |
$Ref = '${{ inputs.ref }}'
if (-Not $Ref) {
$Ref = '${{ github.sha }}'
}
echo "ref=$Ref" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ steps.get-commit.outputs.ref }}
- name: Get version
id: get-version
run: |
$Version = Get-Content VERSION -TotalCount 1
echo "version=$Version" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Install nightly rustfmt
run: rustup component add --toolchain nightly rustfmt
- name: Check formatting
run: |
cargo +nightly fmt --all -- --check
if ! [ $? -eq 0 ] ; then
echo "::error::Bad formatting, please run 'cargo +nightly fmt --all'"
exit 1
fi
- name: Configure rust profile
id: rust-profile
run: |
$CargoProfile = "release"
if ("${{ github.ref }}" -Eq "refs/heads/master") {
echo "::notice::Building production profile"
$CargoProfile = "production"
}
echo "rust-profile=$CargoProfile" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Configure sccache
id: sccache
run: |
# Enable sccache by default; only disable if explicitly set to false
# This handles push/pull_request triggers where inputs.sccache is undefined
$Enabled = if ("${{ inputs.sccache }}" -eq "false") { "false" } else { "true" }
echo "enabled=$Enabled" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Upload version artifact
uses: actions/upload-artifact@v7
with:
name: version
path: VERSION
lints:
name: lints [${{ matrix.os }}]
needs: [preflight]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
os: [windows, linux, macos]
include:
- os: windows
runner: windows-2022
- os: linux
runner: ubuntu-latest
- os: macos
runner: macos-15
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
# The macos-15 image's ~/.cargo/bin shims dispatch to Homebrew's rustup-init and
# fail for `cargo`; the official rustup installer replaces them with working ones.
- name: Repair Rust shims (macOS)
if: ${{ matrix.os == 'macos' }}
run: |
set -eux
rm -rf "$HOME/.cargo/bin"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| bash -s -- -y --default-toolchain none --no-modify-path --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash
- name: Setup Rust cache
uses: ./.github/actions/setup-rust-cache
with:
sccache-enabled: ${{ needs.preflight.outputs.sccache }}
- name: Check clippy
shell: pwsh
run: |
cargo clippy --workspace --tests -- -D warnings
if ($LASTEXITCODE -ne 0) {
Write-Output "::error::Clippy warnings detected, please run 'cargo clippy --workspace --tests' and fix all warnings"
exit 1
}
- name: Show sccache stats
if: ${{ needs.preflight.outputs.sccache == 'true' && !cancelled() }}
shell: pwsh
run: sccache --show-stats
oracle-markers:
name: oracle markers
needs: [preflight]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
# A pull request's merge commit and its first parent, the base the check compares against.
fetch-depth: 2
- name: Check oracle markers
env:
# Reads the files that markers pin in other repositories; a pin the token cannot read gets only a syntax check.
GH_TOKEN: ${{ secrets.DEVOLUTIONSBOT_TOKEN || github.token }}
run: |
$Base = if ('${{ github.event_name }}' -Eq 'pull_request' -And -Not '${{ inputs.ref }}') { 'HEAD^1' }
./ci/check-oracle-markers.ps1 -Base $Base
shell: pwsh
skill-links:
name: skill links
needs: [preflight]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Check skill links
run: ./ci/check-skill-links.ps1
shell: pwsh
oracle-markers-tests:
name: oracle marker check tests
needs: [preflight]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
# Detecting changes compares the commit with its first parent.
fetch-depth: 2
# Installing Pester from PSGallery fails at times, so a commit that leaves the check alone skips its tests.
# The steps are skipped rather than the job, because the success job requires every job to succeed.
- name: Detect changes to the check
id: changes
run: |
$Changed = 'true'
if (('${{ github.event_name }}' -In 'pull_request', 'push') -And -Not '${{ inputs.ref }}') {
$Files = git diff --name-only HEAD^1 HEAD -- ci/check-oracle-markers.ps1 ci/check-oracle-markers.Tests.ps1
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
if (-Not $Files) {
$Changed = 'false'
}
}
echo "changed=$Changed" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Install Pester
if: ${{ steps.changes.outputs.changed == 'true' }}
run: |
# Retry because PSGallery intermittently answers that no module named Pester matches.
# The retry is inline because this job may check out an older commit that lacks any shared helper.
for ($Attempt = 1; $true; $Attempt++) {
try {
Install-Module Pester -RequiredVersion 5.6.0 -Force -ErrorAction Stop
break
} catch {
if ($Attempt -ge 4) { throw }
Write-Warning "Installing Pester failed on attempt ${Attempt}: $_"
Start-Sleep -Seconds (30 * $Attempt)
}
}
shell: pwsh
- name: Pester tests
if: ${{ steps.changes.outputs.changed == 'true' }}
run: |
Import-Module Pester -RequiredVersion 5.6.0
$Result = Invoke-Pester ci/check-oracle-markers.Tests.ps1 -PassThru
if ($Result.Result -Ne 'Passed') {
exit 1
}
shell: pwsh
tests:
name: tests [${{ matrix.os }} ${{ matrix.arch }}]
needs: [preflight]
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: windows
arch: x64
runner: windows-2022
target: x86_64-pc-windows-msvc
- os: linux
arch: x64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos
arch: arm64
runner: macos-15
target: aarch64-apple-darwin
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
# The macos-15 image's ~/.cargo/bin shims dispatch to Homebrew's rustup-init and
# fail for `cargo`; the official rustup installer replaces them with working ones.
- name: Repair Rust shims (macOS)
if: ${{ matrix.os == 'macos' }}
run: |
set -eux
rm -rf "$HOME/.cargo/bin"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| bash -s -- -y --default-toolchain none --no-modify-path --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash
- name: Setup Rust cache
uses: ./.github/actions/setup-rust-cache
with:
sccache-enabled: ${{ needs.preflight.outputs.sccache }}
- name: Configure Linux runner
if: ${{ matrix.os == 'linux' }}
run: |
sudo apt-get update
sudo apt-get -o Acquire::Retries=3 install libsystemd-dev
- name: Tests
run: ./ci/tlk.ps1 test -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -CargoProfile 'dev'
shell: pwsh
env:
AWS_LC_SYS_NO_ASM: true
# A failed Agent Identity conformance run keeps its work directory, whose agent data directories and logs are the
# only record of the state that made it fail.
# The filter matches that directory under `target`, the temporary directory or `ProgramData`, and a file the runner
# cannot read, such as one only SYSTEM can open, is reported and skipped.
# UNTESTED: these steps run only after a failure; when changing them, check by hand with a failing conformance test
# that the artifact holds the kept agent data directories.
- name: Collect kept Agent Identity conformance directories
if: ${{ failure() }}
shell: pwsh
run: |
$Destination = Join-Path $Env:RUNNER_TEMP 'agent-identity-conformance'
New-Item -ItemType Directory -Force $Destination | Out-Null
$Parents = @('target', [IO.Path]::GetTempPath(), $Env:ProgramData) | Where-Object { $_ }
$Index = 0
Get-ChildItem -Path $Parents -Directory -Filter 'agent-identity-integration*' -ErrorAction SilentlyContinue |
ForEach-Object {
$Index++
$Copy = Join-Path $Destination "$Index-$($_.Name)"
Copy-Item -LiteralPath $_.FullName -Destination $Copy -Recurse -ErrorAction Continue
}
- name: Upload kept Agent Identity conformance directories
if: ${{ failure() }}
uses: actions/upload-artifact@v7
with:
name: agent-identity-conformance-${{ matrix.os }}-${{ matrix.arch }}-attempt-${{ github.run_attempt }}
path: ${{ runner.temp }}/agent-identity-conformance
if-no-files-found: ignore
- name: Timing-sensitive tests
run: |
cargo test --locked --target ${{ matrix.target }} -p testsuite --test integration_tests timing:: -- --ignored --test-threads=1
shell: pwsh
env:
AWS_LC_SYS_NO_ASM: true
- name: Root-only tests
if: ${{ matrix.os == 'linux' }}
# Cargo builds as the runner user and runs only the test binary as root, so no build output is owned by root.
# UNTESTED: the test binary runs as root.
# A root-only test run without root skips and passes, so after changing this step, check that its log has no SKIP line.
run: |
cargo test --locked --target ${{ matrix.target }} --config "target.${{ matrix.target }}.runner='sudo'" -p device-key --lib root_only_
cargo test --locked --target ${{ matrix.target }} --config "target.${{ matrix.target }}.runner='sudo'" -p testsuite --test integration_tests private_fs::unix::root_only_
env:
AWS_LC_SYS_NO_ASM: true
- name: Show sccache stats
if: ${{ needs.preflight.outputs.sccache == 'true' && !cancelled() }}
shell: pwsh
run: sccache --show-stats
agent-tunnel-e2e:
name: agent tunnel end-to-end test
needs: [preflight]
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Setup Rust cache
uses: ./.github/actions/setup-rust-cache
with:
sccache-enabled: ${{ needs.preflight.outputs.sccache }}
- name: Configure runner
run: docker info
- name: Test agent tunnel
shell: pwsh
run: cargo test --locked -p testsuite --test integration_tests cli::agent::tunnel::docker_isolates_real_agent_dns_and_ip_routes -- --ignored --exact --nocapture
env:
AWS_LC_SYS_NO_ASM: true
- name: Show sccache stats
if: ${{ needs.preflight.outputs.sccache == 'true' && !cancelled() }}
shell: pwsh
run: sccache --show-stats
check-dependencies:
name: Check no ${{ matrix.banned }} in ${{ matrix.package }} [${{ matrix.target }}]
needs: [preflight]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
banned: [aws-lc-rs]
target: [x86_64-unknown-linux-gnu, x86_64-pc-windows-msvc]
package: [devolutions-gateway, jetsocat]
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Check
run: ./ci/check-crate-is-not-in-the-tree.ps1 -Package '${{ matrix.package }}' -UnwantedDependency '${{ matrix.banned }}' -Target '${{ matrix.target }}'
shell: pwsh
jetsocat:
name: jetsocat [${{ matrix.os }} ${{ matrix.arch }}]
needs: [preflight]
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include: ${{ fromJson(needs.preflight.outputs.jetsocat-build-matrix) }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
# The macos-15 runner image ships `cargo`, `rustc`, etc. in ~/.cargo/bin as
# symlinks to Homebrew's `rustup-init`, which is a shell-script wrapper that
# only dispatches on the `rustup`/`rustup-init` names (not on `cargo`/`rustc`/
# `clippy`). Invoking `cargo` therefore runs `rustup-init` and fails with
# "unexpected argument 'build'". The official rustup installer lays down proper
# multi-call hard-link shims, so we run it to repair ~/.cargo/bin.
- name: Repair Rust shims (macOS)
if: ${{ matrix.os == 'macos' }}
run: |
set -eux
rm -rf "$HOME/.cargo/bin"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| bash -s -- -y --default-toolchain none --no-modify-path --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash
- name: Setup Rust cache
uses: ./.github/actions/setup-rust-cache
with:
sccache-enabled: ${{ needs.preflight.outputs.sccache }}
- name: Setup LLVM
if: ${{ runner.os == 'Linux' }}
uses: Devolutions/actions-public/setup-llvm@v1
with:
version: "18.1.8"
- name: Setup CBake
if: ${{ runner.os == 'Linux' }}
uses: Devolutions/actions-public/setup-cbake@v1
with:
sysroots: |
- ubuntu-18.04-amd64
- ubuntu-18.04-arm64
cargo_env_scripts: true
- name: Configure Linux (arm) runner
if: ${{ matrix.os == 'linux' && matrix.arch == 'arm64' }}
run: |
rustup target add aarch64-unknown-linux-gnu
echo "STRIP_EXECUTABLE=llvm-strip" >> $GITHUB_ENV
- name: Configure Windows runner
if: ${{ runner.os == 'Windows' }}
run: |
# Retry because the Chocolatey community feed intermittently fails with gateway timeouts.
# The retry is inline because this job may check out an older commit that lacks any shared helper.
function Install-ChocoPackage {
for ($Attempt = 1; $true; $Attempt++) {
choco install @args --no-progress
if ($LASTEXITCODE -eq 0) { return }
if ($Attempt -ge 4) { throw "choco install $args failed after $Attempt attempts with exit code $LASTEXITCODE" }
Start-Sleep -Seconds (30 * $Attempt)
}
}
# NASM is required by aws-lc-rs (used as rustls crypto backend)
Install-ChocoPackage nasm
# We need to add the NASM binary folder to the PATH manually.
Write-Output "$Env:ProgramFiles\NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# libclang / LLVM is a requirement for AWS LC.
# https://aws.github.io/aws-lc-rs/requirements/windows.html#libclang--llvm
$VSINSTALLDIR = $(vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath)
Write-Output "LIBCLANG_PATH=$VSINSTALLDIR\VC\Tools\Llvm\x64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
- name: Configure Windows (arm) runner
if: ${{ runner.os == 'Windows' && matrix.arch == 'arm64' }}
run: |
rustup target add aarch64-pc-windows-msvc
shell: pwsh
- name: Configure macOS (intel) runner
if: ${{ matrix.os == 'macos' && matrix.arch == 'x64' }}
run: |
rustup target add x86_64-apple-darwin
- name: Build
id: build
run: |
$StagingPath = Join-Path $Env:RUNNER_TEMP "staging"
$TargetOutputPath = Join-Path $StagingPath ${{ matrix.os }} ${{ matrix.arch }}
$ExecutableFileName = 'jetsocat'
if ($Env:RUNNER_OS -eq "Windows") {
$ExecutableFileName = "$($ExecutableFileName).exe"
$Env:CARGO_NO_DEFAULT_FEATURES = "true"
$Env:CARGO_FEATURES = "native-tls detect-proxy"
}
if ($Env:RUNNER_OS -eq "Linux") {
$LinuxArch = @{'x64'='amd64';'arm64'='arm64'}['${{ matrix.arch }}']
$RustArch = @{'x64'='x86_64';'arm64'='aarch64'}['${{ matrix.arch }}']
$RustTarget = "$RustArch-unknown-linux-gnu"
$Env:SYSROOT_NAME = "ubuntu-18.04-$LinuxArch"
. "$HOME/.cargo/cbake/${RustTarget}-enter.ps1"
$Env:AWS_LC_SYS_CMAKE_BUILDER="true"
}
$Env:TARGET_OUTPUT_PATH = $TargetOutputPath
$Env:JETSOCAT_EXECUTABLE = Join-Path $TargetOutputPath $ExecutableFileName
$Env:CARGO_PACKAGE = "jetsocat"
./ci/tlk.ps1 build -Product jetsocat -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -CargoProfile ${{ needs.preflight.outputs.rust-profile }}
echo "staging-path=$StagingPath" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Show sccache stats
if: ${{ needs.preflight.outputs.sccache == 'true' && !cancelled() }}
shell: pwsh
run: sccache --show-stats
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: jetsocat-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ steps.build.outputs.staging-path }}
jetsocat-merge:
name: jetsocat merge artifacts
runs-on: ubuntu-latest
needs: [preflight, jetsocat]
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v7
with:
name: jetsocat
pattern: jetsocat-*
delete-merged: true
jetsocat-lipo:
name: jetsocat macos universal
runs-on: ubuntu-24.04
needs: [preflight, jetsocat, jetsocat-merge]
steps:
- uses: actions/download-artifact@v8
with:
name: jetsocat
- name: Setup CCTools
uses: Devolutions/actions-public/setup-cctools@v1
- name: Lipo
run: |
$OutputPath = Join-Path "macos" "universal"
New-Item -ItemType Directory -Path $OutputPath | Out-Null
$Binaries = Get-ChildItem -Recurse -Path "macos" -Filter "jetsocat" -File | Foreach-Object { $_.FullName } | Select -Unique
$LipoCmd = $(@('lipo', '-create', '-output', (Join-Path -Path $OutputPath -ChildPath "jetsocat")) + $Binaries) -Join ' '
Write-Host $LipoCmd
Invoke-Expression $LipoCmd
shell: pwsh
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: jetsocat
path: .
overwrite: true
devolutions-gateway-webapp:
name: Devolutions Gateway Web Apps
# DEVOLUTIONSBOT_TOKEN is a repository secret, and it can't be used by PRs originating from forks.
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
needs: [preflight]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Check out Devolutions/actions
uses: actions/checkout@v6
with:
repository: Devolutions/actions
ref: v1
token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }}
path: ./.github/workflows
- name: Setup pnpm
uses: pnpm/action-setup@v5
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'pnpm'
cache-dependency-path: webapp/pnpm-lock.yaml
- name: Setup .npmrc config file
uses: ./.github/workflows/npmrc-setup
with:
npm_token: ${{ secrets.ARTIFACTORY_NPM_TOKEN }}
- name: Configure additional Artifactory auth
run: |
echo "//devolutions.jfrog.io/artifactory/api/npm/npm/:_auth=${{ secrets.ARTIFACTORY_NPM_TOKEN }}" >> .npmrc
echo "//devolutions.jfrog.io/artifactory/api/npm/npm/:always-auth=true" >> .npmrc
working-directory: webapp
- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: webapp
- name: Build packages (libraries)
run: pnpm build:libs
working-directory: webapp
- name: Build applications
run: pnpm build:apps
working-directory: webapp
- name: Check code quality
run: pnpm check
working-directory: webapp
- name: Run session-recording-log tests
run: pnpm --filter @devolutions/session-recording-log test
working-directory: webapp
- name: Run multi-video-player tests
run: pnpm --filter @devolutions/multi-video-player test --runInBand
working-directory: webapp
- name: Upload gateway-ui artifact
uses: actions/upload-artifact@v7
with:
name: webapp-client
path: webapp/dist/gateway-ui/
- name: Upload recording-player artifact
uses: actions/upload-artifact@v7
with:
name: webapp-player
path: webapp/dist/recording-player/
devolutions-gateway-powershell:
name: devolutions-gateway-powershell
needs: [preflight]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Install Pester
id: prepare
run: |
# Retry because PSGallery intermittently answers that no module named Pester matches.
# The retry is inline because this job may check out an older commit that lacks any shared helper.
for ($Attempt = 1; $true; $Attempt++) {
try {
Install-Module Pester -RequiredVersion 5.6.0 -ErrorAction Stop
break
} catch {
if ($Attempt -ge 4) { throw }
Write-Warning "Installing Pester failed on attempt ${Attempt}: $_"
Start-Sleep -Seconds (30 * $Attempt)
}
}
shell: pwsh
- name: Build module
run: |
$PSModuleVersion = "${{ needs.preflight.outputs.version }}"
./powershell/build.ps1
$PSModuleName = "DevolutionsGateway"
$PSModuleParentPath = Join-Path "powershell" "package"
Write-Host "PSModuleOutputPath = $PSModuleParentPath"
$PSStagingPath = Join-Path "powershell-staging" "PowerShell"
Write-Host "PSStagingPath = $PSStagingPath"
New-Item -Path $PSStagingPath -ItemType Directory | Out-Null
$PSModuleTarFilePath = Join-Path $PSStagingPath "$PSModuleName-ps-$PSModuleVersion.tar"
Write-Host "PSModuleTarFilePath = $PSModuleTarFilePath"
tar -cvf "$PSModuleTarFilePath" -C "$PSModuleParentPath" "$PSModuleName"
shell: pwsh
- name: Pester tests
run: |
./powershell/run-tests.ps1
shell: pwsh
- uses: actions/upload-artifact@v7
with:
name: devolutions-gateway-powershell
path: powershell-staging
# Run Windows-only installer cases on native Windows PowerShell 5.1 and PowerShell 7.
# Keep artifact production in the Ubuntu job above to avoid duplicate shipping PowerShell artifacts.
gateway-service-account-tests:
name: Gateway service account tests [Windows]
needs: [preflight]
runs-on: windows-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Install Pester for Windows PowerShell
run: |
# Retry because PSGallery intermittently answers that no module named Pester matches.
# The retry is inline because this job may check out an older commit that lacks any shared helper.
for ($Attempt = 1; $true; $Attempt++) {
try {
Install-Module Pester -RequiredVersion 5.6.0 -Scope CurrentUser -Force -ErrorAction Stop
break
} catch {
if ($Attempt -ge 4) { throw }
Write-Warning "Installing Pester failed on attempt ${Attempt}: $_"
Start-Sleep -Seconds (30 * $Attempt)
}
}
shell: powershell
- name: Run service account tests in Windows PowerShell
run: |
Import-Module Pester -RequiredVersion 5.6.0
$result = Invoke-Pester powershell\pester\ServiceAccount.Tests.ps1 -PassThru
if ($result.Result -ne 'Passed') {
exit 1
}
shell: powershell
- name: Install Pester for PowerShell 7
run: |
# Retry because PSGallery intermittently answers that no module named Pester matches.
# The retry is inline because this job may check out an older commit that lacks any shared helper.
for ($Attempt = 1; $true; $Attempt++) {
try {
Install-Module Pester -RequiredVersion 5.6.0 -Scope CurrentUser -Force -ErrorAction Stop
break
} catch {
if ($Attempt -ge 4) { throw }
Write-Warning "Installing Pester failed on attempt ${Attempt}: $_"
Start-Sleep -Seconds (30 * $Attempt)
}
}
shell: pwsh
- name: Run service account tests in PowerShell 7
run: |
Import-Module Pester -RequiredVersion 5.6.0
$result = Invoke-Pester powershell\pester\ServiceAccount.Tests.ps1 -PassThru
if ($result.Result -ne 'Passed') {
exit 1
}
shell: pwsh
devolutions-gateway:
name: devolutions-gateway [${{ matrix.os }} ${{ matrix.arch }}]
if: ${{ always() }}
needs: [preflight, devolutions-gateway-powershell, devolutions-gateway-webapp]
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include: ${{ fromJson(needs.preflight.outputs.gateway-build-matrix) }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Setup Rust cache
uses: ./.github/actions/setup-rust-cache
with:
sccache-enabled: ${{ needs.preflight.outputs.sccache }}
- name: Download webapp-client
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
uses: actions/download-artifact@v8
with:
name: webapp-client
path: webapp/dist/gateway-ui
- name: Download webapp-player
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
uses: actions/download-artifact@v8
with:
name: webapp-player
path: webapp/dist/recording-player
- name: Download devolutions-gateway-powershell
uses: actions/download-artifact@v8
with:
name: devolutions-gateway-powershell
path: powershell-staging
- name: Download Cadeau
run: |
$Platform = @{'windows'='win'; 'linux'='linux'}['${{ matrix.os }}']
$Arch = '${{ matrix.arch }}'
./ci/download-cadeau.ps1 -Platform $Platform -Architecture $Arch
shell: pwsh
- name: Load dynamic variables
id: load-variables
run: |
$PackageVersion = "${{ needs.preflight.outputs.version }}"
$StagingPath = Join-Path $Env:RUNNER_TEMP "staging"
$TargetOutputPath = Join-Path $StagingPath ${{ matrix.os }} ${{ matrix.arch }}
$ExecutableFileName = if ($Env:RUNNER_OS -eq "Windows") { "DevolutionsGateway.exe" } else { "devolutions-gateway" }
if ($Env:RUNNER_OS -eq "Windows") {
$PackageFileName = "DevolutionsGateway.msi"
$DGatewayPackage = Join-Path $TargetOutputPath $PackageFileName
echo "dgateway-package=$DGatewayPackage" >> $Env:GITHUB_OUTPUT
}
$DGatewayExecutable = Join-Path $TargetOutputPath $ExecutableFileName
echo "staging-path=$StagingPath" >> $Env:GITHUB_OUTPUT
echo "target-output-path=$TargetOutputPath" >> $Env:GITHUB_OUTPUT
echo "dgateway-executable=$DGatewayExecutable" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Setup LLVM
if: ${{ runner.os == 'Linux' }}
uses: Devolutions/actions-public/setup-llvm@v1
with:
version: "18.1.8"
- name: Setup CBake
if: ${{ runner.os == 'Linux' }}
uses: Devolutions/actions-public/setup-cbake@v1
with:
sysroots: |
- ubuntu-18.04-amd64
- ubuntu-18.04-arm64
cargo_env_scripts: true
- name: Configure Linux runner
if: ${{ matrix.os == 'linux' }}
run: ./ci/setup-linux-build-deps.ps1 -Architecture ${{ matrix.arch }}
shell: pwsh
- name: Install fpm
if: ${{ matrix.os == 'Linux' }}
run: sudo gem install --no-document fpm
- name: Configure Windows runner
if: ${{ matrix.os == 'windows' }}
run: |
# Retry because the Chocolatey community feed intermittently fails with gateway timeouts.
# The retry is inline because this job may check out an older commit that lacks any shared helper.
function Install-ChocoPackage {
for ($Attempt = 1; $true; $Attempt++) {
choco install @args --no-progress
if ($LASTEXITCODE -eq 0) { return }
if ($Attempt -ge 4) { throw "choco install $args failed after $Attempt attempts with exit code $LASTEXITCODE" }
Start-Sleep -Seconds (30 * $Attempt)
}
}
# https://github.com/actions/runner-images/issues/9667
choco uninstall wixtoolset
Install-ChocoPackage wixtoolset --version 3.14.0 --allow-downgrade --force
# WiX is installed on Windows runners but not in the PATH
Write-Output "C:\Program Files (x86)\WiX Toolset v3.14\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# NASM is required by aws-lc-rs (used as rustls crypto backend)
Install-ChocoPackage nasm
# We need to add the NASM binary folder to the PATH manually.
Write-Output "$Env:ProgramFiles\NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
- name: Find mc.exe
id: find_mc
if: ${{ matrix.os == 'windows' }}
run: |
$sdkRoots = @(
$Env:WindowsSdkDir
(Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name KitsRoot10 -ErrorAction SilentlyContinue)
"${Env:ProgramFiles(x86)}\Windows Kits\10"
) | Where-Object { $_ } | Select-Object -Unique
$candidates = @()
if ($Env:WindowsSdkVerBinPath) {
$candidates += Join-Path $Env:WindowsSdkVerBinPath "mc.exe"
$candidates += Join-Path $Env:WindowsSdkVerBinPath "x64\mc.exe"
}
foreach ($root in $sdkRoots) {
$bin = Join-Path $root "bin"
$candidates += Join-Path $bin "x64\mc.exe"
$candidates += Get-ChildItem -LiteralPath $bin -Directory -ErrorAction SilentlyContinue |
Where-Object Name -Match '^\d+\.\d+\.\d+\.\d+$' |
Sort-Object { [version]$_.Name } -Descending |
ForEach-Object { Join-Path $_.FullName "x64\mc.exe" }
}
$mc = $candidates | Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | Select-Object -First 1
if (-Not $mc) {
throw "mc.exe was not found in the installed Windows SDK"
}
$path = Split-Path -Parent $mc
Write-Output "windows_sdk_ver_bin_path=$path" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
Write-Output $path | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
shell: pwsh