ci: distribute the compiled integration test binary

This commit is contained in:
Kristoffer Dalby
2026-10-07 14:30:37 +00:00
parent bcc71f9b57
commit c9852c43da
3 changed files with 16 additions and 13 deletions
+7 -12
View File
@@ -46,14 +46,14 @@ jobs:
if: steps.changed-files.outputs.files == 'true'
- uses: Mic92/hestia@dfed9ced335d28978ba74e513939a10db1f71025 # v3.1.0
if: steps.changed-files.outputs.files == 'true'
- name: Build binaries and warm Go cache
- name: Build binaries
if: steps.changed-files.outputs.files == 'true'
run: |
# Build all Go binaries in one nix shell to maximize cache reuse
# Build once for the native worker architecture. Static binaries
# also run in the minimal Headscale image without a Go toolchain.
go build -o hi ./cmd/hi
CGO_ENABLED=0 GOOS=linux go build -o headscale ./cmd/headscale
# Build integration test binary to warm the cache with all dependencies
go test -c ./integration -o /dev/null 2>/dev/null || true
CGO_ENABLED=0 GOOS=linux go test -c ./integration -o integration.test
- name: Upload hi binary
if: steps.changed-files.outputs.files == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -61,17 +61,12 @@ jobs:
name: hi-binary
path: hi
retention-days: 10
- name: Package Go cache
if: steps.changed-files.outputs.files == 'true'
run: |
# Package Go module cache and build cache
tar -czf go-cache.tar.gz -C ~ go .cache/go-build
- name: Upload Go cache
- name: Upload integration test binary
if: steps.changed-files.outputs.files == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: go-cache
path: go-cache.tar.gz
name: integration-test-binary
path: integration.test
retention-days: 10
- name: Force overlay2 storage driver
if: steps.changed-files.outputs.files == 'true'
+6
View File
@@ -289,6 +289,12 @@ func createTestContainer(ctx context.Context, cli *client.Client, config *RunCon
},
}
if config.TestBinary != "" {
// A custom server image may have its own entrypoint; run the tests directly.
containerConfig.Entrypoint = testCmd[:1]
containerConfig.Cmd = testCmd[1:]
}
// Get the correct Docker socket path from the current context
dockerSocketPath := getDockerSocketPath()
+3 -1
View File
@@ -142,8 +142,10 @@ func TestCompiledTestContainer(t *testing.T) {
request := <-requests
assert.Equal(t, "headscale:ci-test", request.Image)
// A custom server image may already have a headscale entrypoint.
assert.Equal(t, []string{"/integration.test"}, []string(request.Entrypoint))
assert.Equal(t, []string{
"/integration.test", "-test.run", config.TestPattern,
"-test.run", config.TestPattern,
"-test.failfast", "-test.timeout", "15m0s", "-test.v",
}, []string(request.Cmd))
assert.Contains(t, request.Env, "HEADSCALE_INTEGRATION_POSTGRES=1")