Taskfile.yaml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # https://taskfile.dev
  2. version: "3"
  3. env:
  4. CGO_ENABLED: 0
  5. TEA_DEBUG: 1
  6. GOEXPERIMENT: greenteagc
  7. tasks:
  8. lint:install:
  9. desc: Install golangci-lint
  10. cmds:
  11. - go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
  12. env:
  13. GOTOOLCHAIN: go1.25.0
  14. lint:
  15. desc: Run base linters
  16. cmds:
  17. - golangci-lint run --path-mode=abs --config=".golangci.yml" --timeout=5m
  18. env:
  19. GOEXPERIMENT: null
  20. lint-fix:
  21. desc: Run base linters and fix issues
  22. cmds:
  23. - golangci-lint run --path-mode=abs --config=".golangci.yml" --timeout=5m --fix
  24. env:
  25. GOEXPERIMENT: null
  26. build:
  27. desc: Run build
  28. cmds:
  29. - go build .
  30. generates:
  31. - crush
  32. run:
  33. desc: Run build
  34. env:
  35. CRUSH_PROFILE: true
  36. cmds:
  37. - go run . {{.CLI_ARGS}}
  38. test:
  39. desc: Run tests
  40. cmds:
  41. - go test ./... {{.CLI_ARGS}}
  42. fmt:
  43. desc: Run gofumpt
  44. cmds:
  45. - gofumpt -w .
  46. install:
  47. desc: Install the application
  48. cmds:
  49. - go install -v .
  50. profile:cpu:
  51. desc: 10s CPU profile
  52. cmds:
  53. - go tool pprof -http :6061 'http://localhost:6060/debug/pprof/profile?seconds=10'
  54. profile:heap:
  55. desc: Heap profile
  56. cmds:
  57. - go tool pprof -http :6061 'http://localhost:6060/debug/pprof/heap'
  58. profile:allocs:
  59. desc: Allocations profile
  60. cmds:
  61. - go tool pprof -http :6061 'http://localhost:6060/debug/pprof/allocs'
  62. schema:
  63. desc: Generate JSON schema for configuration
  64. cmds:
  65. - go run main.go schema > schema.json
  66. - echo "Generated schema.json"
  67. generates:
  68. - schema.json
  69. release:
  70. desc: Create and push a new tag following semver
  71. vars:
  72. NEXT:
  73. sh: svu next --always || go run github.com/caarlos0/svu/v3@latest next --always
  74. prompt: "This will release {{.NEXT}}. Continue?"
  75. preconditions:
  76. - sh: '[ $(git symbolic-ref --short HEAD) = "main" ]'
  77. msg: Not on main branch
  78. - sh: "[ $(git status --porcelain=2 | wc -l) = 0 ]"
  79. msg: "Git is dirty"
  80. cmds:
  81. - task: fetch-tags
  82. - git commit --allow-empty -m "{{.NEXT}}"
  83. - git tag --annotate --sign {{.NEXT}} {{.CLI_ARGS}}
  84. - echo "Pushing {{.NEXT}}..."
  85. - git push origin --tags
  86. fetch-tags:
  87. cmds:
  88. - git tag -d nightly || true
  89. - git fetch --tags