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

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