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

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