# https://taskfile.dev

version: '3'

vars:
  APP: sudoku-funpark
  BUILD_DIR: builds

tasks:
  default:
    cmds:
      - go run . --help
    silent: true
  server:
    cmds:
      - go run . -role scheduler
    silent: true
  agent:
    cmds:
      - go run . -role agent
    silent: true
  precommit:
    cmds:
      - pre-commit autoupdate
      - pre-commit run --all
    silent: true
  lint:
    cmds:
      - golangci-lint run
    silent: true
  build:
    cmds:
      - mkdir -p {{.BUILD_DIR}}
      - rm {{.BUILD_DIR}}/* || true
      - go tool dist list | grep -v android | grep -v ios | grep -v wasip1 | awk -F '/' '{printf "echo Compiling %s/%s; env CGO_ENABLED=1 GOOS=%s GOARCH=%s go build -o {{.BUILD_DIR}}/{{.APP}}.%s-%s\n",$1,$2,$1,$2,$1,$2 }' | sh
      - for i in `ls {{.BUILD_DIR}}/*windows*`; do mv -v $i $i.exe; done
  gource:
    cmds:
      - gource --auto-skip-seconds 1 --key -r 60
    silent: true
  godoc:
    cmds:
      - godoc -http=:6060
    silent: true
