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

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