gitea源码

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. name: compliance
  2. on:
  3. pull_request:
  4. concurrency:
  5. group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  6. cancel-in-progress: true
  7. jobs:
  8. files-changed:
  9. uses: ./.github/workflows/files-changed.yml
  10. lint-backend:
  11. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  12. needs: files-changed
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: actions/checkout@v4
  16. - uses: actions/setup-go@v5
  17. with:
  18. go-version-file: go.mod
  19. check-latest: true
  20. - run: make deps-backend deps-tools
  21. - run: make lint-backend
  22. env:
  23. TAGS: bindata sqlite sqlite_unlock_notify
  24. lint-templates:
  25. if: needs.files-changed.outputs.templates == 'true'
  26. needs: files-changed
  27. runs-on: ubuntu-latest
  28. steps:
  29. - uses: actions/checkout@v4
  30. - uses: astral-sh/setup-uv@v6
  31. - run: uv python install 3.12
  32. - uses: pnpm/action-setup@v4
  33. - uses: actions/setup-node@v5
  34. with:
  35. node-version: 24
  36. - run: make deps-py
  37. - run: make deps-frontend
  38. - run: make lint-templates
  39. lint-yaml:
  40. if: needs.files-changed.outputs.yaml == 'true'
  41. needs: files-changed
  42. runs-on: ubuntu-latest
  43. steps:
  44. - uses: actions/checkout@v4
  45. - uses: astral-sh/setup-uv@v6
  46. - run: uv python install 3.12
  47. - run: make deps-py
  48. - run: make lint-yaml
  49. lint-swagger:
  50. if: needs.files-changed.outputs.swagger == 'true'
  51. needs: files-changed
  52. runs-on: ubuntu-latest
  53. steps:
  54. - uses: actions/checkout@v4
  55. - uses: pnpm/action-setup@v4
  56. - uses: actions/setup-node@v5
  57. with:
  58. node-version: 24
  59. - run: make deps-frontend
  60. - run: make lint-swagger
  61. lint-spell:
  62. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.templates == 'true'
  63. needs: files-changed
  64. runs-on: ubuntu-latest
  65. steps:
  66. - uses: actions/checkout@v4
  67. - uses: actions/setup-go@v5
  68. with:
  69. go-version-file: go.mod
  70. check-latest: true
  71. - run: make lint-spell
  72. lint-go-windows:
  73. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  74. needs: files-changed
  75. runs-on: ubuntu-latest
  76. steps:
  77. - uses: actions/checkout@v4
  78. - uses: actions/setup-go@v5
  79. with:
  80. go-version-file: go.mod
  81. check-latest: true
  82. - run: make deps-backend deps-tools
  83. - run: make lint-go-windows lint-go-gitea-vet
  84. env:
  85. TAGS: bindata sqlite sqlite_unlock_notify
  86. GOOS: windows
  87. GOARCH: amd64
  88. lint-go-gogit:
  89. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  90. needs: files-changed
  91. runs-on: ubuntu-latest
  92. steps:
  93. - uses: actions/checkout@v4
  94. - uses: actions/setup-go@v5
  95. with:
  96. go-version-file: go.mod
  97. check-latest: true
  98. - run: make deps-backend deps-tools
  99. - run: make lint-go
  100. env:
  101. TAGS: bindata gogit sqlite sqlite_unlock_notify
  102. checks-backend:
  103. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  104. needs: files-changed
  105. runs-on: ubuntu-latest
  106. steps:
  107. - uses: actions/checkout@v4
  108. - uses: actions/setup-go@v5
  109. with:
  110. go-version-file: go.mod
  111. check-latest: true
  112. - run: make deps-backend deps-tools
  113. - run: make --always-make checks-backend # ensure the "go-licenses" make target runs
  114. frontend:
  115. if: needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
  116. needs: files-changed
  117. runs-on: ubuntu-latest
  118. steps:
  119. - uses: actions/checkout@v4
  120. - uses: pnpm/action-setup@v4
  121. - uses: actions/setup-node@v5
  122. with:
  123. node-version: 24
  124. - run: make deps-frontend
  125. - run: make lint-frontend
  126. - run: make checks-frontend
  127. - run: make test-frontend
  128. - run: make frontend
  129. backend:
  130. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  131. needs: files-changed
  132. runs-on: ubuntu-latest
  133. steps:
  134. - uses: actions/checkout@v4
  135. - uses: actions/setup-go@v5
  136. with:
  137. go-version-file: go.mod
  138. check-latest: true
  139. # no frontend build here as backend should be able to build
  140. # even without any frontend files
  141. - run: make deps-backend
  142. - run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
  143. - name: build-backend-arm64
  144. run: make backend # test cross compile
  145. env:
  146. GOOS: linux
  147. GOARCH: arm64
  148. TAGS: bindata gogit
  149. - name: build-backend-windows
  150. run: go build -o gitea_windows
  151. env:
  152. GOOS: windows
  153. GOARCH: amd64
  154. TAGS: bindata gogit
  155. - name: build-backend-386
  156. run: go build -o gitea_linux_386 # test if compatible with 32 bit
  157. env:
  158. GOOS: linux
  159. GOARCH: 386
  160. docs:
  161. if: needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.actions == 'true'
  162. needs: files-changed
  163. runs-on: ubuntu-latest
  164. steps:
  165. - uses: actions/checkout@v4
  166. - uses: pnpm/action-setup@v4
  167. - uses: actions/setup-node@v5
  168. with:
  169. node-version: 24
  170. - run: make deps-frontend
  171. - run: make lint-md
  172. actions:
  173. if: needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.actions == 'true'
  174. needs: files-changed
  175. runs-on: ubuntu-latest
  176. steps:
  177. - uses: actions/checkout@v4
  178. - uses: actions/setup-go@v5
  179. with:
  180. go-version-file: go.mod
  181. check-latest: true
  182. - run: make lint-actions