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 14KB

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