Taskfile.yaml 2.4 KB

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