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.
 
 
 
 
 
 

941 lines
19 KiB

  1. ---
  2. kind: pipeline
  3. name: compliance
  4. platform:
  5. os: linux
  6. arch: arm64
  7. trigger:
  8. event:
  9. - push
  10. - tag
  11. - pull_request
  12. steps:
  13. - name: deps-frontend
  14. pull: always
  15. image: node:14
  16. commands:
  17. - make node_modules
  18. - name: lint-frontend
  19. image: node:14
  20. commands:
  21. - make lint-frontend
  22. depends_on: [deps-frontend]
  23. - name: lint-backend
  24. pull: always
  25. image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
  26. commands:
  27. - make lint-backend
  28. environment:
  29. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  30. GOSUMDB: sum.golang.org
  31. TAGS: bindata sqlite sqlite_unlock_notify
  32. - name: lint-backend-windows
  33. pull: always
  34. image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
  35. commands:
  36. - make golangci-lint vet
  37. environment:
  38. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  39. GOSUMDB: sum.golang.org
  40. TAGS: bindata sqlite sqlite_unlock_notify
  41. GOOS: windows
  42. GOARCH: amd64
  43. - name: lint-backend-gogit
  44. pull: always
  45. image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
  46. commands:
  47. - make lint-backend
  48. environment:
  49. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  50. GOSUMDB: sum.golang.org
  51. TAGS: bindata gogit sqlite sqlite_unlock_notify
  52. - name: checks-frontend
  53. image: node:14
  54. commands:
  55. - make checks-frontend
  56. depends_on: [deps-frontend]
  57. - name: checks-backend
  58. pull: always
  59. image: golang:1.16
  60. commands:
  61. - make checks-backend
  62. depends_on: [lint-backend]
  63. - name: test-frontend
  64. image: node:14
  65. commands:
  66. - make test-frontend
  67. depends_on: [lint-frontend]
  68. - name: build-frontend
  69. image: node:14
  70. commands:
  71. - make frontend
  72. depends_on: [test-frontend]
  73. - name: build-backend-no-gcc
  74. pull: always
  75. image: golang:1.14 # this step is kept as the lowest version of golang that we support
  76. environment:
  77. GO111MODULE: on
  78. GOPROXY: off
  79. commands:
  80. - go build -mod=vendor -o gitea_no_gcc # test if build succeeds without the sqlite tag
  81. depends_on: [checks-backend]
  82. - name: build-backend-arm64
  83. image: golang:1.16
  84. environment:
  85. GO111MODULE: on
  86. GOPROXY: off
  87. GOOS: linux
  88. GOARCH: arm64
  89. TAGS: bindata gogit
  90. commands:
  91. - make backend # test cross compile
  92. - rm ./gitea # clean
  93. depends_on: [checks-backend]
  94. - name: build-backend-windows
  95. image: golang:1.16
  96. environment:
  97. GO111MODULE: on
  98. GOPROXY: off
  99. GOOS: windows
  100. GOARCH: amd64
  101. TAGS: bindata gogit
  102. commands:
  103. - go build -mod=vendor -o gitea_windows
  104. depends_on: [checks-backend]
  105. - name: build-backend-386
  106. image: golang:1.16
  107. environment:
  108. GO111MODULE: on
  109. GOPROXY: off
  110. GOOS: linux
  111. GOARCH: 386
  112. commands:
  113. - go build -mod=vendor -o gitea_linux_386 # test if compatible with 32 bit
  114. depends_on: [checks-backend]
  115. ---
  116. kind: pipeline
  117. name: testing-amd64
  118. platform:
  119. os: linux
  120. arch: amd64
  121. depends_on:
  122. - compliance
  123. trigger:
  124. event:
  125. - push
  126. - tag
  127. - pull_request
  128. services:
  129. - name: mysql
  130. image: mysql:5.7
  131. environment:
  132. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  133. MYSQL_DATABASE: test
  134. - name: mysql8
  135. image: mysql:8.0
  136. environment:
  137. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  138. MYSQL_DATABASE: testgitea
  139. - name: mssql
  140. image: mcr.microsoft.com/mssql/server:latest
  141. environment:
  142. ACCEPT_EULA: Y
  143. MSSQL_PID: Standard
  144. SA_PASSWORD: MwantsaSecurePassword1
  145. - name: ldap
  146. image: gitea/test-openldap:latest
  147. - name: elasticsearch
  148. environment:
  149. discovery.type: single-node
  150. image: elasticsearch:7.5.0
  151. - name: minio
  152. image: minio/minio:RELEASE.2021-03-12T00-00-47Z
  153. commands:
  154. - minio server /data
  155. environment:
  156. MINIO_ACCESS_KEY: 123456
  157. MINIO_SECRET_KEY: 12345678
  158. steps:
  159. - name: fetch-tags
  160. image: docker:git
  161. commands:
  162. - git fetch --tags --force
  163. when:
  164. event:
  165. exclude:
  166. - pull_request
  167. - name: build
  168. pull: always
  169. image: golang:1.16
  170. commands:
  171. - make backend
  172. environment:
  173. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  174. GOSUMDB: sum.golang.org
  175. TAGS: bindata sqlite sqlite_unlock_notify
  176. - name: tag-pre-condition
  177. pull: always
  178. image: drone/git
  179. commands:
  180. - git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA}
  181. - name: unit-test
  182. image: golang:1.16
  183. commands:
  184. - make unit-test-coverage test-check
  185. environment:
  186. GOPROXY: off
  187. TAGS: bindata sqlite sqlite_unlock_notify
  188. GITHUB_READ_TOKEN:
  189. from_secret: github_read_token
  190. - name: unit-test-gogit
  191. pull: always
  192. image: golang:1.16
  193. commands:
  194. - make unit-test-coverage test-check
  195. environment:
  196. GOPROXY: off
  197. TAGS: bindata gogit sqlite sqlite_unlock_notify
  198. GITHUB_READ_TOKEN:
  199. from_secret: github_read_token
  200. - name: test-mysql
  201. image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
  202. commands:
  203. - make test-mysql-migration integration-test-coverage
  204. environment:
  205. GOPROXY: off
  206. TAGS: bindata
  207. TEST_LDAP: 1
  208. USE_REPO_TEST_DIR: 1
  209. TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
  210. depends_on:
  211. - build
  212. - name: test-mysql8
  213. image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
  214. commands:
  215. - timeout -s ABRT 40m make test-mysql8-migration test-mysql8
  216. environment:
  217. GOPROXY: off
  218. TAGS: bindata
  219. TEST_LDAP: 1
  220. USE_REPO_TEST_DIR: 1
  221. depends_on:
  222. - build
  223. - name: test-mssql
  224. image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
  225. commands:
  226. - make test-mssql-migration test-mssql
  227. environment:
  228. GOPROXY: off
  229. TAGS: bindata
  230. TEST_LDAP: 1
  231. USE_REPO_TEST_DIR: 1
  232. depends_on:
  233. - build
  234. - name: generate-coverage
  235. image: golang:1.16
  236. commands:
  237. - make coverage
  238. environment:
  239. GOPROXY: off
  240. TAGS: bindata
  241. depends_on:
  242. - unit-test
  243. - test-mysql
  244. when:
  245. branch:
  246. - master
  247. event:
  248. - push
  249. - pull_request
  250. - name: coverage-codecov
  251. pull: always
  252. image: plugins/codecov
  253. settings:
  254. files:
  255. - coverage.all
  256. token:
  257. from_secret: codecov_token
  258. depends_on:
  259. - generate-coverage
  260. when:
  261. branch:
  262. - master
  263. event:
  264. - push
  265. - pull_request
  266. ---
  267. kind: pipeline
  268. name: testing-arm64
  269. platform:
  270. os: linux
  271. arch: arm64
  272. depends_on:
  273. - compliance
  274. trigger:
  275. event:
  276. - push
  277. - tag
  278. - pull_request
  279. services:
  280. - name: pgsql
  281. pull: default
  282. image: postgres:9.5
  283. environment:
  284. POSTGRES_DB: test
  285. POSTGRES_PASSWORD: postgres
  286. - name: ldap
  287. pull: default
  288. image: gitea/test-openldap:latest
  289. steps:
  290. - name: fetch-tags
  291. image: docker:git
  292. commands:
  293. - git fetch --tags --force
  294. when:
  295. event:
  296. exclude:
  297. - pull_request
  298. - name: build
  299. pull: always
  300. image: golang:1.16
  301. commands:
  302. - make backend
  303. environment:
  304. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  305. GOSUMDB: sum.golang.org
  306. TAGS: bindata gogit sqlite sqlite_unlock_notify
  307. - name: test-sqlite
  308. image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
  309. commands:
  310. - timeout -s ABRT 40m make test-sqlite-migration test-sqlite
  311. environment:
  312. GOPROXY: off
  313. TAGS: bindata gogit sqlite sqlite_unlock_notify
  314. TEST_TAGS: gogit sqlite sqlite_unlock_notify
  315. USE_REPO_TEST_DIR: 1
  316. depends_on:
  317. - build
  318. - name: test-pgsql
  319. image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
  320. commands:
  321. - timeout -s ABRT 40m make test-pgsql-migration test-pgsql
  322. environment:
  323. GOPROXY: off
  324. TAGS: bindata gogit
  325. TEST_TAGS: gogit
  326. TEST_LDAP: 1
  327. USE_REPO_TEST_DIR: 1
  328. depends_on:
  329. - build
  330. ---
  331. kind: pipeline
  332. name: update_translations
  333. platform:
  334. os: linux
  335. arch: arm64
  336. trigger:
  337. branch:
  338. - master
  339. event:
  340. - cron
  341. cron:
  342. - update_translations
  343. steps:
  344. - name: download
  345. pull: always
  346. image: jonasfranz/crowdin
  347. settings:
  348. download: true
  349. export_dir: options/locale/
  350. ignore_branch: true
  351. project_identifier: gitea
  352. environment:
  353. CROWDIN_KEY:
  354. from_secret: crowdin_key
  355. - name: update
  356. pull: default
  357. image: alpine:3.13
  358. commands:
  359. - ./build/update-locales.sh
  360. - name: push
  361. pull: always
  362. image: appleboy/drone-git-push
  363. settings:
  364. author_email: "teabot@gitea.io"
  365. author_name: GiteaBot
  366. commit: true
  367. commit_message: "[skip ci] Updated translations via Crowdin"
  368. remote: "git@github.com:go-gitea/gitea.git"
  369. environment:
  370. GIT_PUSH_SSH_KEY:
  371. from_secret: git_push_ssh_key
  372. - name: upload_translations
  373. pull: always
  374. image: jonasfranz/crowdin
  375. settings:
  376. files:
  377. locale_en-US.ini: options/locale/locale_en-US.ini
  378. ignore_branch: true
  379. project_identifier: gitea
  380. environment:
  381. CROWDIN_KEY:
  382. from_secret: crowdin_key
  383. ---
  384. kind: pipeline
  385. name: update_gitignore_and_licenses
  386. platform:
  387. os: linux
  388. arch: arm64
  389. trigger:
  390. branch:
  391. - master
  392. event:
  393. - cron
  394. cron:
  395. - update_gitignore_and_licenses
  396. steps:
  397. - name: download
  398. image: golang:1.16
  399. commands:
  400. - timeout -s ABRT 40m make generate-license generate-gitignore
  401. - name: push
  402. pull: always
  403. image: appleboy/drone-git-push
  404. settings:
  405. author_email: "teabot@gitea.io"
  406. author_name: GiteaBot
  407. commit: true
  408. commit_message: "[skip ci] Updated licenses and gitignores "
  409. remote: "git@github.com:go-gitea/gitea.git"
  410. environment:
  411. GIT_PUSH_SSH_KEY:
  412. from_secret: git_push_ssh_key
  413. ---
  414. kind: pipeline
  415. name: release-latest
  416. platform:
  417. os: linux
  418. arch: amd64
  419. workspace:
  420. base: /source
  421. path: /
  422. trigger:
  423. branch:
  424. - master
  425. - "release/*"
  426. event:
  427. - push
  428. depends_on:
  429. - testing-amd64
  430. - testing-arm64
  431. steps:
  432. - name: fetch-tags
  433. image: docker:git
  434. commands:
  435. - git fetch --tags --force
  436. - name: static
  437. pull: always
  438. image: techknowlogick/xgo:go-1.16.x
  439. commands:
  440. - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs
  441. - export PATH=$PATH:$GOPATH/bin
  442. - make release
  443. environment:
  444. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  445. TAGS: bindata sqlite sqlite_unlock_notify
  446. - name: gpg-sign
  447. pull: always
  448. image: plugins/gpgsign:1
  449. settings:
  450. detach_sign: true
  451. excludes:
  452. - "dist/release/*.sha256"
  453. files:
  454. - "dist/release/*"
  455. environment:
  456. GPGSIGN_KEY:
  457. from_secret: gpgsign_key
  458. GPGSIGN_PASSPHRASE:
  459. from_secret: gpgsign_passphrase
  460. - name: release-branch
  461. pull: always
  462. image: plugins/s3:1
  463. settings:
  464. acl: public-read
  465. bucket: releases
  466. endpoint: https://storage.gitea.io
  467. path_style: true
  468. source: "dist/release/*"
  469. strip_prefix: dist/release/
  470. target: "/gitea/${DRONE_BRANCH##release/v}"
  471. environment:
  472. AWS_ACCESS_KEY_ID:
  473. from_secret: aws_access_key_id
  474. AWS_SECRET_ACCESS_KEY:
  475. from_secret: aws_secret_access_key
  476. when:
  477. branch:
  478. - "release/*"
  479. event:
  480. - push
  481. - name: release-master
  482. image: plugins/s3:1
  483. settings:
  484. acl: public-read
  485. bucket: releases
  486. endpoint: https://storage.gitea.io
  487. path_style: true
  488. source: "dist/release/*"
  489. strip_prefix: dist/release/
  490. target: /gitea/master
  491. environment:
  492. AWS_ACCESS_KEY_ID:
  493. from_secret: aws_access_key_id
  494. AWS_SECRET_ACCESS_KEY:
  495. from_secret: aws_secret_access_key
  496. when:
  497. branch:
  498. - master
  499. event:
  500. - push
  501. ---
  502. kind: pipeline
  503. name: release-version
  504. platform:
  505. os: linux
  506. arch: amd64
  507. workspace:
  508. base: /source
  509. path: /
  510. trigger:
  511. event:
  512. - tag
  513. depends_on:
  514. - testing-arm64
  515. - testing-amd64
  516. steps:
  517. - name: fetch-tags
  518. pull: default
  519. image: docker:git
  520. commands:
  521. - git fetch --tags --force
  522. - name: static
  523. pull: always
  524. image: techknowlogick/xgo:go-1.16.x
  525. commands:
  526. - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs
  527. - export PATH=$PATH:$GOPATH/bin
  528. - make release
  529. environment:
  530. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  531. TAGS: bindata sqlite sqlite_unlock_notify
  532. - name: gpg-sign
  533. pull: always
  534. image: plugins/gpgsign:1
  535. settings:
  536. detach_sign: true
  537. excludes:
  538. - "dist/release/*.sha256"
  539. files:
  540. - "dist/release/*"
  541. environment:
  542. GPGSIGN_KEY:
  543. from_secret: gpgsign_key
  544. GPGSIGN_PASSPHRASE:
  545. from_secret: gpgsign_passphrase
  546. - name: release-tag
  547. pull: always
  548. image: plugins/s3:1
  549. settings:
  550. acl: public-read
  551. bucket: releases
  552. endpoint: https://storage.gitea.io
  553. path_style: true
  554. source: "dist/release/*"
  555. strip_prefix: dist/release/
  556. target: "/gitea/${DRONE_TAG##v}"
  557. environment:
  558. AWS_ACCESS_KEY_ID:
  559. from_secret: aws_access_key_id
  560. AWS_SECRET_ACCESS_KEY:
  561. from_secret: aws_secret_access_key
  562. - name: github
  563. pull: always
  564. image: plugins/github-release:1
  565. settings:
  566. files:
  567. - "dist/release/*"
  568. environment:
  569. GITHUB_TOKEN:
  570. from_secret: github_token
  571. ---
  572. kind: pipeline
  573. name: docs
  574. platform:
  575. os: linux
  576. arch: arm64
  577. depends_on:
  578. - compliance
  579. trigger:
  580. event:
  581. - push
  582. - tag
  583. - pull_request
  584. steps:
  585. - name: build-docs
  586. pull: always
  587. image: plugins/hugo:latest
  588. commands:
  589. - apk add --no-cache make bash curl
  590. - cd docs
  591. - make trans-copy clean build
  592. - name: publish-docs
  593. pull: always
  594. image: techknowlogick/drone-netlify:latest
  595. settings:
  596. path: docs/public/
  597. site_id: d2260bae-7861-4c02-8646-8f6440b12672
  598. environment:
  599. NETLIFY_TOKEN:
  600. from_secret: netlify_token
  601. when:
  602. branch:
  603. - master
  604. event:
  605. - push
  606. ---
  607. kind: pipeline
  608. name: docker-linux-amd64-release
  609. platform:
  610. os: linux
  611. arch: amd64
  612. depends_on:
  613. - testing-amd64
  614. - testing-arm64
  615. trigger:
  616. ref:
  617. - refs/heads/master
  618. - "refs/tags/**"
  619. event:
  620. exclude:
  621. - cron
  622. steps:
  623. - name: fetch-tags
  624. image: docker:git
  625. commands:
  626. - git fetch --tags --force
  627. - name: publish
  628. pull: always
  629. image: plugins/docker:linux-amd64
  630. settings:
  631. auto_tag: true
  632. auto_tag_suffix: linux-amd64
  633. repo: gitea/gitea
  634. build_args:
  635. - GOPROXY=off
  636. password:
  637. from_secret: docker_password
  638. username:
  639. from_secret: docker_username
  640. when:
  641. event:
  642. exclude:
  643. - pull_request
  644. - name: publish-rootless
  645. image: plugins/docker:linux-amd64
  646. settings:
  647. dockerfile: Dockerfile.rootless
  648. auto_tag: true
  649. auto_tag_suffix: linux-amd64-rootless
  650. repo: gitea/gitea
  651. build_args:
  652. - GOPROXY=off
  653. password:
  654. from_secret: docker_password
  655. username:
  656. from_secret: docker_username
  657. environment:
  658. PLUGIN_MIRROR:
  659. from_secret: plugin_mirror
  660. when:
  661. event:
  662. exclude:
  663. - pull_request
  664. ---
  665. kind: pipeline
  666. name: docker-linux-arm64-dry-run
  667. platform:
  668. os: linux
  669. arch: arm64
  670. depends_on:
  671. - compliance
  672. trigger:
  673. ref:
  674. - "refs/pull/**"
  675. steps:
  676. - name: dryrun
  677. pull: always
  678. image: plugins/docker:linux-arm64
  679. settings:
  680. dry_run: true
  681. repo: gitea/gitea
  682. tags: linux-arm64
  683. build_args:
  684. - GOPROXY=off
  685. environment:
  686. PLUGIN_MIRROR:
  687. from_secret: plugin_mirror
  688. when:
  689. event:
  690. - pull_request
  691. ---
  692. kind: pipeline
  693. name: docker-linux-arm64-release
  694. platform:
  695. os: linux
  696. arch: arm64
  697. depends_on:
  698. - testing-amd64
  699. - testing-arm64
  700. trigger:
  701. ref:
  702. - refs/heads/master
  703. - "refs/tags/**"
  704. event:
  705. exclude:
  706. - cron
  707. steps:
  708. - name: fetch-tags
  709. image: docker:git
  710. commands:
  711. - git fetch --tags --force
  712. - name: publish
  713. pull: always
  714. image: plugins/docker:linux-arm64
  715. settings:
  716. auto_tag: true
  717. auto_tag_suffix: linux-arm64
  718. repo: gitea/gitea
  719. build_args:
  720. - GOPROXY=off
  721. password:
  722. from_secret: docker_password
  723. username:
  724. from_secret: docker_username
  725. environment:
  726. PLUGIN_MIRROR:
  727. from_secret: plugin_mirror
  728. when:
  729. event:
  730. exclude:
  731. - pull_request
  732. - name: publish-rootless
  733. image: plugins/docker:linux-arm64
  734. settings:
  735. dockerfile: Dockerfile.rootless
  736. auto_tag: true
  737. auto_tag_suffix: linux-arm64-rootless
  738. repo: gitea/gitea
  739. build_args:
  740. - GOPROXY=off
  741. password:
  742. from_secret: docker_password
  743. username:
  744. from_secret: docker_username
  745. environment:
  746. PLUGIN_MIRROR:
  747. from_secret: plugin_mirror
  748. when:
  749. event:
  750. exclude:
  751. - pull_request
  752. ---
  753. kind: pipeline
  754. name: docker-manifest
  755. platform:
  756. os: linux
  757. arch: amd64
  758. steps:
  759. - name: manifest-rootless
  760. pull: always
  761. image: plugins/manifest
  762. settings:
  763. auto_tag: true
  764. ignore_missing: true
  765. spec: docker/manifest.rootless.tmpl
  766. password:
  767. from_secret: docker_password
  768. username:
  769. from_secret: docker_username
  770. - name: manifest
  771. image: plugins/manifest
  772. settings:
  773. auto_tag: true
  774. ignore_missing: true
  775. spec: docker/manifest.tmpl
  776. password:
  777. from_secret: docker_password
  778. username:
  779. from_secret: docker_username
  780. trigger:
  781. ref:
  782. - refs/heads/master
  783. - "refs/tags/**"
  784. event:
  785. exclude:
  786. - cron
  787. depends_on:
  788. - docker-linux-amd64-release
  789. - docker-linux-arm64-release
  790. ---
  791. kind: pipeline
  792. name: notifications
  793. platform:
  794. os: linux
  795. arch: arm64
  796. clone:
  797. disable: true
  798. trigger:
  799. branch:
  800. - master
  801. - "release/*"
  802. event:
  803. - push
  804. - tag
  805. status:
  806. - success
  807. - failure
  808. depends_on:
  809. - testing-amd64
  810. - testing-arm64
  811. - release-version
  812. - release-latest
  813. - docker-linux-amd64-release
  814. - docker-linux-arm64-release
  815. - docker-manifest
  816. - docs
  817. steps:
  818. - name: discord
  819. pull: always
  820. image: appleboy/drone-discord:1.2.4
  821. settings:
  822. message: "{{#success build.status}} ✅ Build #{{build.number}} of `{{repo.name}}` succeeded.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n🌐 {{ build.link }} {{else}} ❌ Build #{{build.number}} of `{{repo.name}}` failed.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n🌐 {{ build.link }} {{/success}}\n"
  823. webhook_id:
  824. from_secret: discord_webhook_id
  825. webhook_token:
  826. from_secret: discord_webhook_token