.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 { path = "/root/.bun", max_size = "1g" },
13 { path = "/root/.cache/ms-playwright", max_size = "2g" },
14]
15
16[on]
17push = ["master", "main"]
18tag = true
19
20[[steps]]
21name = "tools"
22run_sh = """
23go install mvdan.cc/gofumpt@latest
24go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
25go install golang.org/x/vuln/cmd/govulncheck@latest
26"""
27
28[[steps]]
29name = "tidy"
30# The checkout has no .git, so compare copies instead of using git diff.
31run_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"
32
33[[steps]]
34name = "format"
35run_sh = "cd project && test -z \"$(/root/go/bin/gofumpt -l -extra .)\" || (/root/go/bin/gofumpt -l -extra . && exit 1)"
36
37[[steps]]
38name = "lint"
39run_sh = "cd project && /root/go/bin/golangci-lint run ./..."
40
41[[steps]]
42name = "vulncheck"
43warn_on_fail = true
44run_sh = "cd project && /root/go/bin/govulncheck ./..."
45
46[[steps]]
47name = "test"
48run_sh = "cd project && go test -race -count=1 ./..."
49
50[[steps]]
51name = "build"
52run_sh = "cd project && CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o hearthforge ./cmd/hearthforge"
53publish_file = ["/ci/build/project/hearthforge"]
54
55[[steps]]
56name = "e2e"
57timeout = 2400
58run_sh = """
59apt-get update -qq && apt-get install -y -qq --no-install-recommends unzip openssh-client git > /dev/null
60curl -fsSL https://bun.sh/install | bash
61export PATH="/root/.bun/bin:$PATH"
62cd project/tests
63bun install --frozen-lockfile
64bunx playwright install --with-deps chromium
65HEARTHFORGE_BIN=/ci/build/project/hearthforge bun run test
66"""
67