You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.drone.yml 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. ---
  2. kind: pipeline
  3. name: testing
  4. platform:
  5. os: linux
  6. arch: amd64
  7. workspace:
  8. base: /go
  9. path: src/code.gitea.io/gitea
  10. services:
  11. - name: mysql
  12. pull: default
  13. image: mysql:5.7
  14. environment:
  15. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  16. MYSQL_DATABASE: test
  17. - name: mysql8
  18. pull: default
  19. image: mysql:8.0
  20. environment:
  21. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  22. MYSQL_DATABASE: testgitea
  23. - name: pgsql
  24. pull: default
  25. image: postgres:9.5
  26. environment:
  27. POSTGRES_DB: test
  28. - name: mssql
  29. pull: default
  30. image: microsoft/mssql-server-linux:latest
  31. environment:
  32. ACCEPT_EULA: Y
  33. MSSQL_PID: Standard
  34. SA_PASSWORD: MwantsaSecurePassword1
  35. - name: ldap
  36. pull: default
  37. image: gitea/test-openldap:latest
  38. steps:
  39. - name: fetch-tags
  40. pull: default
  41. image: docker:git
  42. commands:
  43. - git fetch --tags --force
  44. when:
  45. event:
  46. exclude:
  47. - pull_request
  48. - name: pre-build
  49. pull: always
  50. image: webhippie/nodejs:latest
  51. commands:
  52. - make css
  53. - make js
  54. - name: build-without-gcc
  55. pull: always
  56. image: golang:1.10 # this step is kept as the lowest version of golang that we support
  57. commands:
  58. - go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
  59. - name: build
  60. pull: always
  61. image: golang:1.12
  62. commands:
  63. - make clean
  64. - make generate
  65. - make golangci-lint
  66. - make revive
  67. - make swagger-check
  68. - make swagger-validate
  69. - make test-vendor
  70. - make build
  71. environment:
  72. TAGS: bindata sqlite sqlite_unlock_notify
  73. - name: unit-test
  74. pull: always
  75. image: golang:1.12
  76. commands:
  77. - make unit-test-coverage
  78. environment:
  79. TAGS: bindata sqlite sqlite_unlock_notify
  80. depends_on:
  81. - build
  82. when:
  83. branch:
  84. - master
  85. event:
  86. - push
  87. - pull_request
  88. - name: release-test
  89. pull: always
  90. image: golang:1.12
  91. commands:
  92. - make test
  93. environment:
  94. TAGS: bindata sqlite sqlite_unlock_notify
  95. depends_on:
  96. - build
  97. when:
  98. branch:
  99. - "release/*"
  100. event:
  101. - push
  102. - pull_request
  103. - name: tag-test
  104. pull: always
  105. image: golang:1.12
  106. commands:
  107. - make test
  108. environment:
  109. TAGS: bindata
  110. depends_on:
  111. - build
  112. when:
  113. event:
  114. - tag
  115. - name: test-sqlite
  116. pull: always
  117. image: golang:1.12
  118. commands:
  119. - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
  120. - apt-get install -y git-lfs
  121. - timeout -s ABRT 20m make test-sqlite-migration
  122. - timeout -s ABRT 20m make test-sqlite
  123. environment:
  124. TAGS: bindata
  125. depends_on:
  126. - build
  127. - name: test-mysql
  128. pull: always
  129. image: golang:1.12
  130. commands:
  131. - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
  132. - apt-get install -y git-lfs
  133. - make test-mysql-migration
  134. - make integration-test-coverage
  135. environment:
  136. TAGS: bindata
  137. TEST_LDAP: 1
  138. depends_on:
  139. - build
  140. when:
  141. branch:
  142. - master
  143. event:
  144. - push
  145. - pull_request
  146. - name: tag-test-mysql
  147. pull: always
  148. image: golang:1.12
  149. commands:
  150. - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
  151. - apt-get install -y git-lfs
  152. - timeout -s ABRT 20m make test-mysql-migration
  153. - timeout -s ABRT 20m make test-mysql
  154. environment:
  155. TAGS: bindata
  156. TEST_LDAP: 1
  157. depends_on:
  158. - build
  159. when:
  160. event:
  161. - tag
  162. - name: test-mysql8
  163. pull: always
  164. image: golang:1.12
  165. commands:
  166. - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
  167. - apt-get install -y git-lfs
  168. - timeout -s ABRT 20m make test-mysql8-migration
  169. - timeout -s ABRT 20m make test-mysql8
  170. environment:
  171. TAGS: bindata
  172. TEST_LDAP: 1
  173. depends_on:
  174. - build
  175. - name: test-pgsql
  176. pull: always
  177. image: golang:1.12
  178. commands:
  179. - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
  180. - apt-get install -y git-lfs
  181. - timeout -s ABRT 20m make test-pgsql-migration
  182. - timeout -s ABRT 20m make test-pgsql
  183. environment:
  184. TAGS: bindata
  185. TEST_LDAP: 1
  186. depends_on:
  187. - build
  188. - name: test-mssql
  189. pull: always
  190. image: golang:1.12
  191. commands:
  192. - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
  193. - apt-get install -y git-lfs
  194. - make test-mssql-migration
  195. - make test-mssql
  196. environment:
  197. TAGS: bindata
  198. TEST_LDAP: 1
  199. depends_on:
  200. - build
  201. - name: generate-coverage
  202. pull: always
  203. image: golang:1.12
  204. commands:
  205. - make coverage
  206. environment:
  207. TAGS: bindata
  208. depends_on:
  209. - unit-test
  210. - test-mysql
  211. when:
  212. branch:
  213. - master
  214. event:
  215. - push
  216. - pull_request
  217. - name: coverage
  218. pull: always
  219. image: robertstettner/drone-codecov
  220. settings:
  221. files:
  222. - coverage.all
  223. environment:
  224. CODECOV_TOKEN:
  225. from_secret: codecov_token
  226. depends_on:
  227. - generate-coverage
  228. when:
  229. branch:
  230. - master
  231. event:
  232. - push
  233. - pull_request
  234. ---
  235. kind: pipeline
  236. name: translations
  237. platform:
  238. os: linux
  239. arch: amd64
  240. workspace:
  241. base: /go
  242. path: src/code.gitea.io/gitea
  243. trigger:
  244. branch:
  245. - master
  246. event:
  247. - push
  248. steps:
  249. - name: download
  250. pull: always
  251. image: jonasfranz/crowdin
  252. settings:
  253. download: true
  254. export_dir: options/locale/
  255. ignore_branch: true
  256. project_identifier: gitea
  257. environment:
  258. CROWDIN_KEY:
  259. from_secret: crowdin_key
  260. - name: update
  261. pull: default
  262. image: alpine:3.10
  263. commands:
  264. - mv ./options/locale/locale_en-US.ini ./options/
  265. - "sed -i -e 's/=\"/=/g' -e 's/\"$$//g' ./options/locale/*.ini"
  266. - "sed -i -e 's/\\\\\\\\\"/\"/g' ./options/locale/*.ini"
  267. - mv ./options/locale_en-US.ini ./options/locale/
  268. - name: push
  269. pull: always
  270. image: appleboy/drone-git-push
  271. settings:
  272. author_email: "teabot@gitea.io"
  273. author_name: GiteaBot
  274. commit: true
  275. commit_message: "[skip ci] Updated translations via Crowdin"
  276. remote: "git@github.com:go-gitea/gitea.git"
  277. environment:
  278. GIT_PUSH_SSH_KEY:
  279. from_secret: git_push_ssh_key
  280. - name: upload_translations
  281. pull: always
  282. image: jonasfranz/crowdin
  283. settings:
  284. files:
  285. locale_en-US.ini: options/locale/locale_en-US.ini
  286. ignore_branch: true
  287. project_identifier: gitea
  288. environment:
  289. CROWDIN_KEY:
  290. from_secret: crowdin_key
  291. ---
  292. kind: pipeline
  293. name: release-master
  294. platform:
  295. os: linux
  296. arch: amd64
  297. workspace:
  298. base: /go
  299. path: src/code.gitea.io/gitea
  300. trigger:
  301. branch:
  302. - master
  303. - "release/*"
  304. event:
  305. - push
  306. depends_on:
  307. - testing
  308. - translations
  309. steps:
  310. - name: fetch-tags
  311. pull: default
  312. image: docker:git
  313. commands:
  314. - git fetch --tags --force
  315. - name: static
  316. pull: always
  317. image: techknowlogick/xgo:latest
  318. commands:
  319. - export PATH=$PATH:$GOPATH/bin
  320. - make generate
  321. - make release
  322. environment:
  323. TAGS: bindata sqlite sqlite_unlock_notify
  324. - name: gpg-sign
  325. pull: always
  326. image: plugins/gpgsign:1
  327. settings:
  328. detach_sign: true
  329. excludes:
  330. - "dist/release/*.sha256"
  331. files:
  332. - "dist/release/*"
  333. environment:
  334. GPGSIGN_KEY:
  335. from_secret: gpgsign_key
  336. GPGSIGN_PASSPHRASE:
  337. from_secret: gpgsign_passphrase
  338. depends_on:
  339. - static
  340. - name: release-branch-release
  341. pull: always
  342. image: plugins/s3:1
  343. settings:
  344. acl: public-read
  345. bucket: releases
  346. endpoint: https://storage.gitea.io
  347. path_style: true
  348. source: "dist/release/*"
  349. strip_prefix: dist/release/
  350. target: "/gitea/${DRONE_BRANCH##release/v}"
  351. environment:
  352. AWS_ACCESS_KEY_ID:
  353. from_secret: aws_access_key_id
  354. AWS_SECRET_ACCESS_KEY:
  355. from_secret: aws_secret_access_key
  356. depends_on:
  357. - gpg-sign
  358. when:
  359. branch:
  360. - "release/*"
  361. event:
  362. - push
  363. - name: release
  364. pull: always
  365. image: plugins/s3:1
  366. settings:
  367. acl: public-read
  368. bucket: releases
  369. endpoint: https://storage.gitea.io
  370. path_style: true
  371. source: "dist/release/*"
  372. strip_prefix: dist/release/
  373. target: /gitea/master
  374. environment:
  375. AWS_ACCESS_KEY_ID:
  376. from_secret: aws_access_key_id
  377. AWS_SECRET_ACCESS_KEY:
  378. from_secret: aws_secret_access_key
  379. depends_on:
  380. - gpg-sign
  381. when:
  382. branch:
  383. - master
  384. event:
  385. - push
  386. ---
  387. kind: pipeline
  388. name: release-version
  389. platform:
  390. os: linux
  391. arch: amd64
  392. workspace:
  393. base: /go
  394. path: src/code.gitea.io/gitea
  395. trigger:
  396. event:
  397. - tag
  398. depends_on:
  399. - testing
  400. - translations
  401. steps:
  402. - name: fetch-tags
  403. pull: default
  404. image: docker:git
  405. commands:
  406. - git fetch --tags --force
  407. - name: static
  408. pull: always
  409. image: techknowlogick/xgo:latest
  410. commands:
  411. - export PATH=$PATH:$GOPATH/bin
  412. - make generate
  413. - make release
  414. environment:
  415. TAGS: bindata sqlite sqlite_unlock_notify
  416. - name: gpg-sign
  417. pull: always
  418. image: plugins/gpgsign:1
  419. settings:
  420. detach_sign: true
  421. excludes:
  422. - "dist/release/*.sha256"
  423. files:
  424. - "dist/release/*"
  425. environment:
  426. GPGSIGN_KEY:
  427. from_secret: gpgsign_key
  428. GPGSIGN_PASSPHRASE:
  429. from_secret: gpgsign_passphrase
  430. depends_on:
  431. - static
  432. - name: release
  433. pull: always
  434. image: plugins/s3:1
  435. settings:
  436. acl: public-read
  437. bucket: releases
  438. endpoint: https://storage.gitea.io
  439. path_style: true
  440. source: "dist/release/*"
  441. strip_prefix: dist/release/
  442. target: "/gitea/${DRONE_TAG##v}"
  443. environment:
  444. AWS_ACCESS_KEY_ID:
  445. from_secret: aws_access_key_id
  446. AWS_SECRET_ACCESS_KEY:
  447. from_secret: aws_secret_access_key
  448. depends_on:
  449. - gpg-sign
  450. - name: github
  451. pull: always
  452. image: plugins/github-release:1
  453. settings:
  454. files:
  455. - "dist/release/*"
  456. environment:
  457. GITHUB_TOKEN:
  458. from_secret: github_token
  459. depends_on:
  460. - gpg-sign
  461. ---
  462. kind: pipeline
  463. name: docs
  464. platform:
  465. os: linux
  466. arch: amd64
  467. workspace:
  468. base: /go
  469. path: src/code.gitea.io/gitea
  470. steps:
  471. - name: build-docs
  472. pull: always
  473. image: webhippie/hugo:latest
  474. commands:
  475. - cd docs
  476. - make trans-copy
  477. - make clean
  478. - make build
  479. - name: publish-docs
  480. pull: always
  481. image: lucap/drone-netlify:latest
  482. settings:
  483. path: docs/public/
  484. site_id: d2260bae-7861-4c02-8646-8f6440b12672
  485. environment:
  486. NETLIFY_TOKEN:
  487. from_secret: netlify_token
  488. when:
  489. branch:
  490. - master
  491. event:
  492. - push
  493. ---
  494. kind: pipeline
  495. name: docker
  496. platform:
  497. os: linux
  498. arch: amd64
  499. workspace:
  500. base: /go
  501. path: src/code.gitea.io/gitea
  502. steps:
  503. - name: fetch-tags
  504. pull: default
  505. image: docker:git
  506. commands:
  507. - git fetch --tags --force
  508. when:
  509. event:
  510. exclude:
  511. - pull_request
  512. - name: dryrun
  513. pull: always
  514. image: plugins/docker:18.09
  515. settings:
  516. cache_from: gitea/gitea
  517. dry_run: true
  518. repo: gitea/gitea
  519. when:
  520. event:
  521. - pull_request
  522. - name: release
  523. pull: always
  524. image: plugins/docker:18.09
  525. settings:
  526. cache_from: gitea/gitea
  527. repo: gitea/gitea
  528. tags:
  529. - "${DRONE_BRANCH##release/v}"
  530. environment:
  531. DOCKER_PASSWORD:
  532. from_secret: docker_password
  533. DOCKER_USERNAME:
  534. from_secret: docker_username
  535. depends_on:
  536. - dryrun
  537. when:
  538. branch:
  539. - "release/*"
  540. event:
  541. - push
  542. - name: latest
  543. pull: always
  544. image: plugins/docker:18.09
  545. settings:
  546. cache_from: gitea/gitea
  547. default_tags: true
  548. repo: gitea/gitea
  549. environment:
  550. DOCKER_PASSWORD:
  551. from_secret: docker_password
  552. DOCKER_USERNAME:
  553. from_secret: docker_username
  554. depends_on:
  555. - dryrun
  556. when:
  557. branch:
  558. - master
  559. event:
  560. - push
  561. - tag
  562. ---
  563. kind: pipeline
  564. name: notify
  565. platform:
  566. os: linux
  567. arch: amd64
  568. workspace:
  569. base: /go
  570. path: src/code.gitea.io/gitea
  571. when:
  572. status:
  573. - success
  574. - failure
  575. depends_on:
  576. - testing
  577. - translations
  578. - release-version
  579. - release-master
  580. - docker
  581. - docs
  582. steps:
  583. - name: discord
  584. pull: always
  585. image: appleboy/drone-discord:1.0.0
  586. environment:
  587. DISCORD_WEBHOOK_ID:
  588. from_secret: discord_webhook_id
  589. DISCORD_WEBHOOK_TOKEN:
  590. from_secret: discord_webhook_token