@@ -146,6 +146,64 @@ jobs:
146
146
- name : Test
147
147
run : CGO_ENABLED=1 GOARCH=${{ matrix.arch }} CI=true go test -tags devcert -exec 'sudo' -timeout 10m -p 1 $(go list ./... | grep -v -e /management -e /signal -e /relay)
148
148
149
+ test_client_on_docker :
150
+ name : " Client (Docker) / Unit"
151
+ needs : [build-cache]
152
+ runs-on : ubuntu-22.04
153
+ steps :
154
+ - name : Install Go
155
+ uses : actions/setup-go@v5
156
+ with :
157
+ go-version : " 1.23.x"
158
+ cache : false
159
+
160
+ - name : Checkout code
161
+ uses : actions/checkout@v4
162
+
163
+ - name : Get Go environment
164
+ id : go-env
165
+ run : |
166
+ echo "cache_dir=$(go env GOCACHE)" >> $GITHUB_OUTPUT
167
+ echo "modcache_dir=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
168
+
169
+ - name : Cache Go modules
170
+ uses : actions/cache/restore@v4
171
+ id : cache-restore
172
+ with :
173
+ path : |
174
+ ${{ steps.go-env.outputs.cache_dir }}
175
+ ${{ steps.go-env.outputs.modcache_dir }}
176
+ key : ${{ runner.os }}-gotest-cache-${{ hashFiles('**/go.sum') }}
177
+ restore-keys : |
178
+ ${{ runner.os }}-gotest-cache-
179
+
180
+ - name : Run tests in container
181
+ env :
182
+ HOST_GOCACHE : ${{ steps.go-env.outputs.cache_dir }}
183
+ HOST_GOMODCACHE : ${{ steps.go-env.outputs.modcache_dir }}
184
+ run : |
185
+ CONTAINER_GOCACHE="/root/.cache/go-build"
186
+ CONTAINER_GOMODCACHE="/go/pkg/mod"
187
+
188
+ docker run --rm \
189
+ --cap-add=NET_ADMIN \
190
+ --privileged \
191
+ -v $PWD:/app \
192
+ -w /app \
193
+ -v "${HOST_GOCACHE}:${CONTAINER_GOCACHE}" \
194
+ -v "${HOST_GOMODCACHE}:${CONTAINER_GOMODCACHE}" \
195
+ -e CGO_ENABLED=1 \
196
+ -e CI=true \
197
+ -e GOARCH=${GOARCH_TARGET} \
198
+ -e GOCACHE=${CONTAINER_GOCACHE} \
199
+ -e GOMODCACHE=${CONTAINER_GOMODCACHE} \
200
+ golang:1.23-alpine \
201
+ sh -c ' \
202
+ apk update; apk add --no-cache \
203
+ ca-certificates iptables ip6tables dbus dbus-dev libpcap-dev build-base; \
204
+ go test -buildvcs=false -tags devcert -v -timeout 10m -p 1 $(go list -buildvcs=false ./... | grep -v -e /management -e /signal -e /relay -e /client/ui)
205
+ '
206
+
149
207
test_relay :
150
208
name : " Relay / Unit"
151
209
needs : [build-cache]
@@ -179,13 +237,6 @@ jobs:
179
237
restore-keys : |
180
238
${{ runner.os }}-gotest-cache-
181
239
182
- - name : Install dependencies
183
- run : sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev gcc-multilib libpcap-dev
184
-
185
- - name : Install 32-bit libpcap
186
- if : matrix.arch == '386'
187
- run : sudo dpkg --add-architecture i386 && sudo apt update && sudo apt-get install -y libpcap0.8-dev:i386
188
-
189
240
- name : Install modules
190
241
run : go mod tidy
191
242
@@ -232,13 +283,6 @@ jobs:
232
283
restore-keys : |
233
284
${{ runner.os }}-gotest-cache-
234
285
235
- - name : Install dependencies
236
- run : sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev gcc-multilib libpcap-dev
237
-
238
- - name : Install 32-bit libpcap
239
- if : matrix.arch == '386'
240
- run : sudo dpkg --add-architecture i386 && sudo apt update && sudo apt-get install -y libpcap0.8-dev:i386
241
-
242
286
- name : Install modules
243
287
run : go mod tidy
244
288
@@ -286,13 +330,6 @@ jobs:
286
330
restore-keys : |
287
331
${{ runner.os }}-gotest-cache-
288
332
289
- - name : Install dependencies
290
- run : sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev gcc-multilib libpcap-dev
291
-
292
- - name : Install 32-bit libpcap
293
- if : matrix.arch == '386'
294
- run : sudo dpkg --add-architecture i386 && sudo apt update && sudo apt-get install -y libpcap0.8-dev:i386
295
-
296
333
- name : Install modules
297
334
run : go mod tidy
298
335
@@ -354,13 +391,6 @@ jobs:
354
391
restore-keys : |
355
392
${{ runner.os }}-gotest-cache-
356
393
357
- - name : Install dependencies
358
- run : sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev gcc-multilib libpcap-dev
359
-
360
- - name : Install 32-bit libpcap
361
- if : matrix.arch == '386'
362
- run : sudo dpkg --add-architecture i386 && sudo apt update && sudo apt-get install -y libpcap0.8-dev:i386
363
-
364
394
- name : Install modules
365
395
run : go mod tidy
366
396
@@ -449,13 +479,6 @@ jobs:
449
479
restore-keys : |
450
480
${{ runner.os }}-gotest-cache-
451
481
452
- - name : Install dependencies
453
- run : sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev gcc-multilib libpcap-dev
454
-
455
- - name : Install 32-bit libpcap
456
- if : matrix.arch == '386'
457
- run : sudo dpkg --add-architecture i386 && sudo apt update && sudo apt-get install -y libpcap0.8-dev:i386
458
-
459
482
- name : Install modules
460
483
run : go mod tidy
461
484
@@ -520,13 +543,6 @@ jobs:
520
543
restore-keys : |
521
544
${{ runner.os }}-gotest-cache-
522
545
523
- - name : Install dependencies
524
- run : sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev gcc-multilib libpcap-dev
525
-
526
- - name : Install 32-bit libpcap
527
- if : matrix.arch == '386'
528
- run : sudo dpkg --add-architecture i386 && sudo apt update && sudo apt-get install -y libpcap0.8-dev:i386
529
-
530
546
- name : Install modules
531
547
run : go mod tidy
532
548
@@ -541,99 +557,3 @@ jobs:
541
557
go test -tags=integration \
542
558
-exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' \
543
559
-timeout 20m ./management/...
544
-
545
- test_client_on_docker :
546
- name : " Client (Docker) / Unit"
547
- needs : [ build-cache ]
548
- runs-on : ubuntu-22.04
549
- steps :
550
- - name : Install Go
551
- uses : actions/setup-go@v5
552
- with :
553
- go-version : " 1.23.x"
554
- cache : false
555
-
556
- - name : Checkout code
557
- uses : actions/checkout@v4
558
-
559
- - name : Get Go environment
560
- run : |
561
- echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV
562
- echo "modcache=$(go env.GOMODCACHE)" >> $GITHUB_ENV
563
-
564
- - name : Cache Go modules
565
- uses : actions/cache/restore@v4
566
- with :
567
- path : |
568
- ${{ env.cache }}
569
- ${{ env.modcache }}
570
- key : ${{ runner.os }}-gotest-cache-${{ hashFiles('**/go.sum') }}
571
- restore-keys : |
572
- ${{ runner.os }}-gotest-cache-
573
-
574
- - name : Install dependencies
575
- run : sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev gcc-multilib libpcap-dev
576
-
577
- - name : Install modules
578
- run : go mod tidy
579
-
580
- - name : Check git status
581
- run : git --no-pager diff --exit-code
582
-
583
- - name : Generate Shared Sock Test bin
584
- run : CGO_ENABLED=0 go test -c -o sharedsock-testing.bin ./sharedsock
585
-
586
- - name : Generate RouteManager Test bin
587
- run : CGO_ENABLED=0 go test -c -o routemanager-testing.bin ./client/internal/routemanager
588
-
589
- - name : Generate SystemOps Test bin (static via Alpine)
590
- run : |
591
- docker run --rm -v $PWD:/app -w /app \
592
- alpine:latest \
593
- sh -c "
594
- apk add --no-cache go gcc musl-dev libpcap-dev dbus-dev && \
595
- adduser -D -u $(id -u) builder && \
596
- su builder -c '\
597
- cd /app && \
598
- CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
599
- go test -c -o /app/systemops-testing.bin \
600
- -tags netgo \
601
- -ldflags=\"-w -extldflags \\\"-static -ldbus-1 -lpcap\\\"\" \
602
- ./client/internal/routemanager/systemops \
603
- '
604
- "
605
-
606
- - name : Generate nftables Manager Test bin
607
- run : CGO_ENABLED=0 go test -c -o nftablesmanager-testing.bin ./client/firewall/nftables/...
608
-
609
- - name : Generate Engine Test bin
610
- run : CGO_ENABLED=1 go test -c -o engine-testing.bin ./client/internal
611
-
612
- - name : Generate Peer Test bin
613
- run : CGO_ENABLED=0 go test -c -o peer-testing.bin ./client/internal/peer/
614
-
615
- - run : chmod +x *testing.bin
616
-
617
- - name : Run Shared Sock tests in docker
618
- run : docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/sharedsock --entrypoint /ci/sharedsock-testing.bin gcr.io/distroless/base:debug -test.timeout 5m -test.parallel 1
619
-
620
- - name : Run Iface tests in docker
621
- run : docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/netbird -v /tmp/cache:/tmp/cache -v /tmp/modcache:/tmp/modcache -w /netbird -e GOCACHE=/tmp/cache -e GOMODCACHE=/tmp/modcache -e CGO_ENABLED=0 golang:1.23-alpine go test -test.timeout 5m -test.parallel 1 ./client/iface/...
622
-
623
- - name : Run RouteManager tests in docker
624
- run : docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal/routemanager --entrypoint /ci/routemanager-testing.bin gcr.io/distroless/base:debug -test.timeout 5m -test.parallel 1
625
-
626
- - name : Run SystemOps tests in docker
627
- run : docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal/routemanager/systemops --entrypoint /ci/systemops-testing.bin gcr.io/distroless/base:debug -test.timeout 5m -test.parallel 1
628
-
629
- - name : Run nftables Manager tests in docker
630
- run : docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/firewall --entrypoint /ci/nftablesmanager-testing.bin gcr.io/distroless/base:debug -test.timeout 5m -test.parallel 1
631
-
632
- - name : Run Engine tests in docker with file store
633
- run : docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal -e NETBIRD_STORE_ENGINE="jsonfile" --entrypoint /ci/engine-testing.bin gcr.io/distroless/base:debug -test.timeout 5m -test.parallel 1
634
-
635
- - name : Run Engine tests in docker with sqlite store
636
- run : docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal -e NETBIRD_STORE_ENGINE="sqlite" --entrypoint /ci/engine-testing.bin gcr.io/distroless/base:debug -test.timeout 5m -test.parallel 1
637
-
638
- - name : Run Peer tests in docker
639
- run : docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal/peer --entrypoint /ci/peer-testing.bin gcr.io/distroless/base:debug -test.timeout 5m -test.parallel 1
0 commit comments