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

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