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

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