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