.hearthforge-ci.toml
⎇
Raw
1# Checks for the Go port. Runs on every push to master and on every tag.
2image = "docker.io/golang:1.26"
3work_dir = "/ci/build"
4clone_project_to = "/ci/build/project"
5shell_setup = "set -euo pipefail"
6timeout = 1800
7memory_limit = "4g"
8
9cache = [
10 { path = "/root/go/pkg/mod", max_size = "2g" },
11 { path = "/root/.cache/go-build", max_size = "2g" },
12]
13
14[on]
15push = ["master", "main"]
16tag = true
17
18[[steps]]
19name = "tools"
20run_sh = """
21apt-get update -qq && apt-get install -y -qq --no-install-recommends openssh-client git > /dev/null
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 \"$(/root/go/bin/gofumpt -l -extra .)\" || (/root/go/bin/gofumpt -l -extra . && exit 1)"
35
36[[steps]]
37name = "lint"
38run_sh = "cd project && /root/go/bin/golangci-lint run ./..."
39
40[[steps]]
41name = "vulncheck"
42warn_on_fail = true
43run_sh = "cd project && /root/go/bin/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 hearthforge ./cmd/hearthforge"
52publish_file = ["/ci/build/project/hearthforge"]
53
54[[steps]]
55name = "browser"
56timeout = 1200
57run_sh = """
58apt-get update -qq && apt-get install -y -qq --no-install-recommends chromium > /dev/null
59cd project && HEARTHFORGE_BROWSER=$(command -v chromium) go test -count=1 -run 'TestBrowser' ./internal/web/e2e/
60"""
61