mirror of
https://github.com/juanfont/headscale.git
synced 2026-10-23 23:06:49 +09:00
ci: distribute the compiled integration test binary
This commit is contained in:
1 parent
bcc71f9b57
commit
c9852c43da
3 files changed
+16
-13
No files matched your search
@@ -46,14 +46,14 @@ jobs:
|
|||||||
if: steps.changed-files.outputs.files == 'true'
|
if: steps.changed-files.outputs.files == 'true'
|
||||||
- uses: Mic92/hestia@dfed9ced335d28978ba74e513939a10db1f71025 # v3.1.0
|
- uses: Mic92/hestia@dfed9ced335d28978ba74e513939a10db1f71025 # v3.1.0
|
||||||
if: steps.changed-files.outputs.files == 'true'
|
if: steps.changed-files.outputs.files == 'true'
|
||||||
- name: Build binaries and warm Go cache
|
- name: Build binaries
|
||||||
if: steps.changed-files.outputs.files == 'true'
|
if: steps.changed-files.outputs.files == 'true'
|
||||||
run: |
|
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
|
go build -o hi ./cmd/hi
|
||||||
CGO_ENABLED=0 GOOS=linux go build -o headscale ./cmd/headscale
|
CGO_ENABLED=0 GOOS=linux go build -o headscale ./cmd/headscale
|
||||||
# Build integration test binary to warm the cache with all dependencies
|
CGO_ENABLED=0 GOOS=linux go test -c ./integration -o integration.test
|
||||||
go test -c ./integration -o /dev/null 2>/dev/null || true
|
|
||||||
- name: Upload hi binary
|
- name: Upload hi binary
|
||||||
if: steps.changed-files.outputs.files == 'true'
|
if: steps.changed-files.outputs.files == 'true'
|
||||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||||
@@ -61,17 +61,12 @@ jobs:
|
|||||||
name: hi-binary
|
name: hi-binary
|
||||||
path: hi
|
path: hi
|
||||||
retention-days: 10
|
retention-days: 10
|
||||||
- name: Package Go cache
|
- name: Upload integration test binary
|
||||||
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
|
|
||||||
if: steps.changed-files.outputs.files == 'true'
|
if: steps.changed-files.outputs.files == 'true'
|
||||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||||
with:
|
with:
|
||||||
name: go-cache
|
name: integration-test-binary
|
||||||
path: go-cache.tar.gz
|
path: integration.test
|
||||||
retention-days: 10
|
retention-days: 10
|
||||||
- name: Force overlay2 storage driver
|
- name: Force overlay2 storage driver
|
||||||
if: steps.changed-files.outputs.files == 'true'
|
if: steps.changed-files.outputs.files == 'true'
|
||||||
|
|||||||
@@ -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
|
// Get the correct Docker socket path from the current context
|
||||||
dockerSocketPath := getDockerSocketPath()
|
dockerSocketPath := getDockerSocketPath()
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -142,8 +142,10 @@ func TestCompiledTestContainer(t *testing.T) {
|
|||||||
|
|
||||||
request := <-requests
|
request := <-requests
|
||||||
assert.Equal(t, "headscale:ci-test", request.Image)
|
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{
|
assert.Equal(t, []string{
|
||||||
"/integration.test", "-test.run", config.TestPattern,
|
"-test.run", config.TestPattern,
|
||||||
"-test.failfast", "-test.timeout", "15m0s", "-test.v",
|
"-test.failfast", "-test.timeout", "15m0s", "-test.v",
|
||||||
}, []string(request.Cmd))
|
}, []string(request.Cmd))
|
||||||
assert.Contains(t, request.Env, "HEADSCALE_INTEGRATION_POSTGRES=1")
|
assert.Contains(t, request.Env, "HEADSCALE_INTEGRATION_POSTGRES=1")
|
||||||
|
|||||||
Reference in new issue
Block a user