when:
  - event: [push, pull_request, manual]

steps:
  - name: build
    image: golang:1.25-bookworm
    commands:
      - go version
      - go mod download
      - >-
        go build
        -ldflags "-X forge.lthn.ai/core/cli/pkg/cli.AppVersion=ci
        -X forge.lthn.ai/core/cli/pkg/cli.BuildCommit=${CI_COMMIT_SHA:0:7}
        -X forge.lthn.ai/core/cli/pkg/cli.BuildDate=$(date -u +%Y%m%d)"
        -o ./bin/core .
      - ./bin/core --version

  - name: test
    image: golang:1.25-bookworm
    commands:
      - go test -short -count=1 -timeout 120s ./...
