.drone.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. workspace:
  2. base: /go
  3. path: src/code.gitea.io/gitea
  4. clone:
  5. git:
  6. image: plugins/git:next
  7. depth: 50
  8. tags: true
  9. pipeline:
  10. download_translations:
  11. image: jonasfranz/crowdin
  12. pull: true
  13. secrets: [ crowdin_key ]
  14. project_identifier: gitea
  15. ignore_branch: true
  16. download: true
  17. export_dir: options/locale/
  18. when:
  19. event: [ push ]
  20. branch: [ master ]
  21. update-translations:
  22. image: alpine:3.7
  23. commands:
  24. - mv ./options/locale/locale_en-US.ini ./options/
  25. - sed -i -e 's/="/=/g' -e 's/"$$//g' ./options/locale/*.ini
  26. - sed -i -e 's/\\\\"/"/g' ./options/locale/*.ini
  27. - mv ./options/locale_en-US.ini ./options/locale/
  28. when:
  29. event: [ push ]
  30. branch: [ master ]
  31. git_push:
  32. image: appleboy/drone-git-push
  33. pull: true
  34. secrets: [ git_push_ssh_key ]
  35. remote: git@github.com:go-gitea/gitea.git
  36. force: false
  37. commit: true
  38. commit_message: "[skip ci] Updated translations via Crowdin"
  39. author_name: GiteaBot
  40. author_email: teabot@gitea.io
  41. when:
  42. event: [ push ]
  43. branch: [ master ]
  44. pre-build:
  45. image: webhippie/nodejs:latest
  46. pull: true
  47. commands:
  48. - npm install
  49. - make stylesheets-check
  50. when:
  51. event: [ push, tag, pull_request ]
  52. build-without-gcc:
  53. image: golang:1.9
  54. pull: true
  55. commands:
  56. - go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
  57. when:
  58. event: [ push, tag, pull_request ]
  59. build:
  60. image: golang:1.11
  61. pull: true
  62. environment:
  63. TAGS: bindata sqlite sqlite_unlock_notify
  64. commands:
  65. - make clean
  66. - make generate
  67. - make vet
  68. - make lint
  69. - make fmt-check
  70. - make swagger-check
  71. - make swagger-validate
  72. - make misspell-check
  73. - make test-vendor
  74. - make build
  75. when:
  76. event: [ push, tag, pull_request ]
  77. test:
  78. image: golang:1.11
  79. pull: true
  80. group: test
  81. environment:
  82. TAGS: bindata sqlite sqlite_unlock_notify
  83. commands:
  84. - make unit-test-coverage
  85. when:
  86. event: [ push, pull_request ]
  87. branch: [ master ]
  88. test:
  89. image: golang:1.11
  90. pull: true
  91. group: test
  92. environment:
  93. TAGS: bindata sqlite sqlite_unlock_notify
  94. commands:
  95. - make test
  96. when:
  97. event: [ push, pull_request ]
  98. branch: [ release/* ]
  99. test:
  100. image: golang:1.11
  101. pull: true
  102. group: test
  103. environment:
  104. TAGS: bindata
  105. commands:
  106. - make test
  107. when:
  108. event: [ tag ]
  109. test-sqlite:
  110. image: golang:1.11
  111. pull: true
  112. group: test
  113. environment:
  114. TAGS: bindata
  115. commands:
  116. - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
  117. - apt-get install -y git-lfs
  118. - (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.sqlite.test)' | sh)) &
  119. - make test-sqlite
  120. when:
  121. event: [ push, tag, pull_request ]
  122. test-mysql:
  123. image: golang:1.11
  124. pull: true
  125. group: test
  126. environment:
  127. TAGS: bindata
  128. TEST_LDAP: "1"
  129. commands:
  130. - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
  131. - apt-get install -y git-lfs
  132. - make integration-test-coverage
  133. when:
  134. event: [ push, pull_request ]
  135. branch: [ master ]
  136. test-mysql:
  137. image: golang:1.11
  138. pull: true
  139. group: test
  140. environment:
  141. TAGS: bindata
  142. TEST_LDAP: "1"
  143. commands:
  144. - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
  145. - apt-get install -y git-lfs
  146. - (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) &
  147. - make test-mysql
  148. when:
  149. event: [ tag ]
  150. test-pgsql:
  151. image: golang:1.11
  152. pull: true
  153. group: test
  154. environment:
  155. TAGS: bindata
  156. TEST_LDAP: "1"
  157. commands:
  158. - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
  159. - apt-get install -y git-lfs
  160. - (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) &
  161. - make test-pgsql
  162. when:
  163. event: [ push, tag, pull_request ]
  164. test-mssql:
  165. image: golang:1.11
  166. pull: true
  167. group: test
  168. environment:
  169. TAGS: bindata
  170. TEST_LDAP: "1"
  171. commands:
  172. - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
  173. - apt-get install -y git-lfs
  174. - make test-mssql
  175. when:
  176. event: [ push, tag, pull_request ]
  177. generate-coverage:
  178. image: golang:1.11
  179. pull: true
  180. environment:
  181. TAGS: bindata
  182. commands:
  183. - make coverage
  184. when:
  185. event: [ push, pull_request ]
  186. branch: [ master ]
  187. coverage:
  188. image: robertstettner/drone-codecov
  189. secrets: [ codecov_token ]
  190. files:
  191. - coverage.all
  192. when:
  193. event: [ push, pull_request ]
  194. branch: [ master ]
  195. static:
  196. image: karalabe/xgo-latest:latest
  197. pull: true
  198. environment:
  199. TAGS: bindata sqlite sqlite_unlock_notify
  200. commands:
  201. - export PATH=$PATH:$GOPATH/bin
  202. - make release
  203. when:
  204. event: [ push, tag ]
  205. build-docs:
  206. image: webhippie/hugo:latest
  207. pull: true
  208. commands:
  209. - cd docs
  210. - make trans-copy
  211. - make clean
  212. - make build
  213. publish-docs:
  214. image: lucap/drone-netlify:latest
  215. pull: true
  216. secrets: [ netlify_token ]
  217. site_id: d2260bae-7861-4c02-8646-8f6440b12672
  218. path: docs/public/
  219. when:
  220. event: [ push ]
  221. branch: [ master ]
  222. docker:
  223. image: plugins/docker:17.12
  224. pull: true
  225. secrets: [ docker_username, docker_password ]
  226. repo: gitea/gitea
  227. tags: [ '${DRONE_BRANCH##release/v}' ]
  228. when:
  229. event: [ push ]
  230. branch: [ release/* ]
  231. docker:
  232. image: plugins/docker:17.12
  233. secrets: [ docker_username, docker_password ]
  234. pull: true
  235. repo: gitea/gitea
  236. default_tags: true
  237. when:
  238. event: [ push, tag ]
  239. gpg-sign:
  240. image: plugins/gpgsign:1
  241. pull: true
  242. secrets: [ gpgsign_key, gpgsign_passphrase ]
  243. detach_sign: true
  244. files:
  245. - dist/release/*
  246. excludes:
  247. - dist/release/*.sha256
  248. when:
  249. event: [ push, tag ]
  250. release:
  251. image: plugins/s3:1
  252. pull: true
  253. secrets: [ aws_access_key_id, aws_secret_access_key ]
  254. bucket: releases
  255. acl: public-read
  256. endpoint: https://storage.gitea.io
  257. path_style: true
  258. strip_prefix: dist/release/
  259. source: dist/release/*
  260. target: /gitea/${DRONE_TAG##v}
  261. when:
  262. event: [ tag ]
  263. release:
  264. image: plugins/s3:1
  265. pull: true
  266. secrets: [ aws_access_key_id, aws_secret_access_key ]
  267. bucket: releases
  268. acl: public-read
  269. endpoint: https://storage.gitea.io
  270. path_style: true
  271. strip_prefix: dist/release/
  272. source: dist/release/*
  273. target: /gitea/${DRONE_BRANCH##release/v}
  274. when:
  275. event: [ push ]
  276. branch: [ release/* ]
  277. release:
  278. image: plugins/s3:1
  279. pull: true
  280. secrets: [ aws_access_key_id, aws_secret_access_key ]
  281. bucket: releases
  282. acl: public-read
  283. endpoint: https://storage.gitea.io
  284. path_style: true
  285. strip_prefix: dist/release/
  286. source: dist/release/*
  287. target: /gitea/master
  288. when:
  289. event: [ push ]
  290. branch: [ master ]
  291. github:
  292. image: plugins/github-release:1
  293. pull: true
  294. secrets: [ github_token ]
  295. files:
  296. - dist/release/*
  297. when:
  298. event: [ tag ]
  299. upload_translations:
  300. image: jonasfranz/crowdin
  301. pull: true
  302. secrets: [ crowdin_key ]
  303. project_identifier: gitea
  304. ignore_branch: true
  305. download: false
  306. files:
  307. locale_en-US.ini: options/locale/locale_en-US.ini
  308. when:
  309. event: [ push ]
  310. branch: [ master ]
  311. discord:
  312. image: appleboy/drone-discord:1.0.0
  313. pull: true
  314. secrets: [ discord_webhook_id, discord_webhook_token ]
  315. when:
  316. event: [ push, tag, pull_request ]
  317. status: [ changed, failure ]
  318. services:
  319. mysql:
  320. image: mysql:5.7
  321. environment:
  322. - MYSQL_DATABASE=test
  323. - MYSQL_ALLOW_EMPTY_PASSWORD=yes
  324. when:
  325. event: [ push, tag, pull_request ]
  326. pgsql:
  327. image: postgres:9.5
  328. environment:
  329. - POSTGRES_DB=test
  330. when:
  331. event: [ push, tag, pull_request ]
  332. mssql:
  333. image: microsoft/mssql-server-linux:latest
  334. environment:
  335. - ACCEPT_EULA=Y
  336. - SA_PASSWORD=MwantsaSecurePassword1
  337. - MSSQL_PID=Standard
  338. when:
  339. event: [ push, tag, pull_request ]
  340. ldap:
  341. image: gitea/test-openldap:latest
  342. when:
  343. event: [ push, tag, pull_request ]