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