.hearthforge-ci.toml
⎇
Raw
1# Checks and build. Runs on every push to master and on every tag.
2# Docker Hub mirror: same official image, no anonymous pull limit
3image = "mirror.gcr.io/library/golang:1.27"
4work_dir = "/ci/build"
5clone_project_to = "/ci/build/project"
6shell_setup = "set -euo pipefail"
7timeout = 1800
8memory_limit = "3g"
9
10cache = [
11 { path = "/go/pkg/mod", max_size = "1g" },
12 { path = "/root/.cache/go-build", max_size = "1g" },
13]
14
15[on]
16push = ["master", "main"]
17tag = true
18
19[[steps]]
20name = "tools"
21run_sh = """
22go install mvdan.cc/gofumpt@latest
23go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
24go install golang.org/x/vuln/cmd/govulncheck@latest
25"""
26
27[[steps]]
28name = "tidy"
29# The checkout has no .git, so compare copies instead of using git diff.
30run_sh = "cd project && cp go.mod /tmp/go.mod && cp go.sum /tmp/go.sum && go mod tidy && diff /tmp/go.mod go.mod && diff /tmp/go.sum go.sum"
31
32[[steps]]
33name = "format"
34run_sh = "cd project && test -z \"$(gofumpt -l -extra .)\" || (gofumpt -l -extra . && exit 1)"
35
36[[steps]]
37name = "lint"
38run_sh = "cd project && golangci-lint run ./..."
39
40[[steps]]
41name = "vulncheck"
42warn_on_fail = true
43run_sh = "cd project && govulncheck ./..."
44
45[[steps]]
46name = "test"
47run_sh = "cd project && go test -race -count=1 ./..."
48
49[[steps]]
50name = "build"
51run_sh = "cd project && CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o physiobase ./cmd/physiobase"
52publish_file = ["/ci/build/project/physiobase"]
53