# Checks for the Go port. Runs on every push to master and on every tag. image = "docker.io/golang:1.26" work_dir = "/ci/build" clone_project_to = "/ci/build/project" shell_setup = "set -euo pipefail" timeout = 1800 memory_limit = "4g" cache = [ { path = "/root/go/pkg/mod", max_size = "2g" }, { path = "/root/.cache/go-build", max_size = "2g" }, { path = "/root/.bun", max_size = "1g" }, { path = "/root/.cache/ms-playwright", max_size = "2g" }, ] [on] push = ["master", "main"] tag = true [[steps]] name = "tools" run_sh = """ go install mvdan.cc/gofumpt@latest go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest go install golang.org/x/vuln/cmd/govulncheck@latest """ [[steps]] name = "tidy" # The checkout has no .git, so compare copies instead of using git diff. 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" [[steps]] name = "format" run_sh = "cd project && test -z \"$(/root/go/bin/gofumpt -l -extra .)\" || (/root/go/bin/gofumpt -l -extra . && exit 1)" [[steps]] name = "lint" run_sh = "cd project && /root/go/bin/golangci-lint run ./..." [[steps]] name = "vulncheck" warn_on_fail = true run_sh = "cd project && /root/go/bin/govulncheck ./..." [[steps]] name = "test" run_sh = "cd project && go test -race -count=1 ./..." [[steps]] name = "build" run_sh = "cd project && CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o hearthforge ./cmd/hearthforge" publish_file = ["/ci/build/project/hearthforge"] [[steps]] name = "e2e" timeout = 2400 run_sh = """ apt-get update -qq && apt-get install -y -qq --no-install-recommends unzip openssh-client git > /dev/null curl -fsSL https://bun.sh/install | bash export PATH="/root/.bun/bin:$PATH" cd project/tests bun install --frozen-lockfile bunx playwright install --with-deps chromium HEARTHFORGE_BIN=/ci/build/project/hearthforge bun run test """