Taskfile.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. version: '3'
  2. tasks:
  3. web:
  4. desc: Build the binary and start the web server.
  5. deps: [build]
  6. cmds:
  7. - ./gogs web
  8. sources:
  9. - gogs.go
  10. - internal/**/*.go
  11. build:
  12. desc: Build the binary.
  13. cmds:
  14. - go build -v
  15. -ldflags '
  16. -X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}"
  17. -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}"
  18. '
  19. -tags '{{.TAGS}}'
  20. -trimpath -o gogs
  21. vars:
  22. PKG_PATH: gogs.io/gogs/internal/conf
  23. BUILD_TIME:
  24. sh: date -u '+%Y-%m-%d %I:%M:%S %Z'
  25. BUILD_COMMIT:
  26. sh: git rev-parse HEAD
  27. generate-bindata:
  28. desc: Generate bindata for all assets.
  29. deps: [clean]
  30. cmds:
  31. - go generate internal/assets/conf/conf.go
  32. - go generate internal/assets/templates/templates.go
  33. - go generate internal/assets/public/public.go
  34. generate-schemadoc:
  35. desc: Generate database schema documentation.
  36. cmds:
  37. - go generate ./internal/db/schemadoc
  38. generate:
  39. desc: Run all go:generate commands.
  40. deps: [generate-bindata, generate-schemadoc]
  41. test:
  42. desc: Run all tests.
  43. cmds:
  44. - go test -cover -race ./...
  45. clean:
  46. desc: Cleans up system meta files for code generation.
  47. cmds:
  48. - find . -name "*.DS_Store" -type f -delete
  49. release:
  50. desc: Build the binary and pack resources to a ZIP file.
  51. deps: [build]
  52. cmds:
  53. - rm -rf {{.RELEASE_GOGS}}
  54. - mkdir -p {{.RELEASE_GOGS}}
  55. - cp -r gogs LICENSE README.md README_ZH.md scripts {{.RELEASE_GOGS}}
  56. - cd {{.RELEASE_ROOT}} && zip -r gogs.$(NOW).zip "gogs"
  57. vars:
  58. RELEASE_ROOT: release
  59. RELEASE_GOGS: release/gogs
  60. less:
  61. desc: Generate CSS from LESS files.
  62. cmds:
  63. - lessc --clean-css --source-map "public/less/gogs.less" public/css/gogs.min.css
  64. fixme:
  65. desc: Show all occurrences of "FIXME".
  66. cmds:
  67. - grep -rnw "FIXME" internal
  68. todo:
  69. desc: Show all occurrences of "TODO".
  70. cmds:
  71. - grep -rnw "TODO" internal
  72. legacy:
  73. desc: Identify legacy and deprecated lines.
  74. cmds:
  75. - grep -rnw "\(LEGACY\|Deprecated\)" internal