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

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