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