2
0

Taskfile.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. version: '3'
  2. vars:
  3. BINARY_EXT:
  4. sh: echo '{{if eq OS "windows"}}.exe{{end}}'
  5. tasks:
  6. web:
  7. desc: Build the binary and start the web server.
  8. deps: [build]
  9. cmds:
  10. - ./gogs web
  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{{.BINARY_EXT}}
  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. sources:
  28. - gogs.go
  29. - internal/**/*.go
  30. generate-bindata:
  31. desc: Generate bindata for all assets.
  32. deps: [clean]
  33. cmds:
  34. - go generate internal/assets/conf/conf.go
  35. - go generate internal/assets/templates/templates.go
  36. - go generate internal/assets/public/public.go
  37. generate-schemadoc:
  38. desc: Generate database schema documentation.
  39. cmds:
  40. - go generate ./internal/db/schemadoc
  41. generate:
  42. desc: Run all go:generate commands.
  43. deps: [generate-bindata, generate-schemadoc]
  44. test:
  45. desc: Run all tests.
  46. cmds:
  47. - go test -cover -race ./...
  48. clean:
  49. desc: Cleans up system meta files for code generation.
  50. cmds:
  51. - find . -name "*.DS_Store" -type f -delete
  52. release:
  53. desc: Build the binary and pack resources to a ZIP file.
  54. deps: [build]
  55. cmds:
  56. - rm -rf {{.RELEASE_GOGS}}
  57. - mkdir -p {{.RELEASE_GOGS}}
  58. - cp -r gogs{{.BINARY_EXT}} LICENSE README.md README_ZH.md scripts {{.RELEASE_GOGS}}
  59. - cd {{.RELEASE_ROOT}} && zip -r gogs.$(NOW).zip "gogs"
  60. vars:
  61. RELEASE_ROOT: release
  62. RELEASE_GOGS: release/gogs
  63. less:
  64. desc: Generate CSS from LESS files.
  65. cmds:
  66. - lessc --clean-css --source-map "public/less/gogs.less" public/css/gogs.min.css
  67. fixme:
  68. desc: Show all occurrences of "FIXME".
  69. cmds:
  70. - grep -rnw "FIXME" internal
  71. todo:
  72. desc: Show all occurrences of "TODO".
  73. cmds:
  74. - grep -rnw "TODO" internal
  75. legacy:
  76. desc: Identify legacy and deprecated lines.
  77. cmds:
  78. - grep -rnw "\(LEGACY\|Deprecated\)" internal