go-test¶
go test -race -coverprofile over the project's packages, with the
coverage badge driven by the standard go tool cover -func total line.
Runs on dev-tools.
An optional go-test-e2e job runs a separate test path under an env-var
build flag (default INT_TEST_E2E=1) when enable_e2e: true. When false,
the e2e job is not scheduled at all — no skipped-job noise.
Change-detected by default. Embed projects with a Svelte UI MUST extend
changes with their frontend path (e.g. pkg/studio/web/**) so a
frontend-only change still runs the Go embed/served-UI tests — see
Explanation: the Svelte frontend track.
Jobs¶
| Job | What it runs |
|---|---|
go-test |
go test -race -coverprofile=cover.out $[[ inputs.paths ]]; uploads cover.out as an always-on artifact. |
go-test-e2e |
(only when enable_e2e: true) go test $[[ inputs.e2e_paths ]] -v -timeout $[[ inputs.e2e_timeout ]], with $[[ inputs.e2e_env_var ]]=1. |
Inputs¶
| Input | Type | Default | Description |
|---|---|---|---|
image |
string | dev-tools:v0.1.2 |
Go toolchain image. |
stage |
string | test |
GitLab CI stage. |
paths |
string | "./..." |
Path expression for go test. |
coverage_regex |
string | '/total:\s+\(statements\)\s+(\d+\.\d+)%/' |
Regex GitLab uses to extract the coverage badge %. |
if |
string | '$CI_PIPELINE_SOURCE == "merge_request_event"' |
Gating rules:if: for the unit-test job. |
changes |
array | ["**/*.go", "**/go.mod", "**/go.sum", ".golangci.*", ".gitlab-ci.yml"] |
Change-detection paths. Must be extended for Svelte-embed projects. |
enable_e2e |
boolean | false |
Adds the go-test-e2e job. |
e2e_paths |
string | "./test/e2e/..." |
Path expression for the e2e run. |
e2e_timeout |
string | "5m" |
go test -timeout= value for e2e. |
e2e_env_var |
string | "INT_TEST_E2E" |
Env var set to 1 in the e2e job. |
Usage¶
include:
- component: gitlab.com/phpboyscout/cicd/[email protected]
inputs:
enable_e2e: true
See also¶
go-lint,go-security- Explanation: the Svelte frontend track, change-detection