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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  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
  215. pull: always
  216. image: robertstettner/drone-codecov
  217. settings:
  218. files:
  219. - coverage.all
  220. environment:
  221. CODECOV_TOKEN:
  222. from_secret: codecov_token
  223. depends_on:
  224. - generate-coverage
  225. when:
  226. branch:
  227. - master
  228. event:
  229. - push
  230. - pull_request
  231. ---
  232. kind: pipeline
  233. name: testing-arm64
  234. platform:
  235. os: linux
  236. arch: arm64
  237. depends_on:
  238. - compliance
  239. workspace:
  240. base: /go
  241. path: src/code.gitea.io/gitea
  242. services:
  243. - name: pgsql
  244. pull: default
  245. image: postgres:9.5
  246. environment:
  247. POSTGRES_DB: test
  248. POSTGRES_PASSWORD: postgres
  249. - name: ldap
  250. pull: default
  251. image: gitea/test-openldap:latest
  252. steps:
  253. - name: fetch-tags
  254. pull: default
  255. image: docker:git
  256. commands:
  257. - git fetch --tags --force
  258. when:
  259. event:
  260. exclude:
  261. - pull_request
  262. - name: build
  263. pull: always
  264. image: golang:1.14
  265. commands:
  266. - make backend
  267. environment:
  268. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  269. GOSUMDB: sum.golang.org
  270. TAGS: bindata sqlite sqlite_unlock_notify
  271. - name: test-sqlite
  272. pull: always
  273. image: golang:1.14
  274. commands:
  275. - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
  276. - apt-get install -y git-lfs
  277. - timeout -s ABRT 40m make test-sqlite-migration test-sqlite
  278. environment:
  279. GOPROXY: off
  280. TAGS: bindata
  281. USE_REPO_TEST_DIR: 1
  282. depends_on:
  283. - build
  284. - name: test-pgsql
  285. pull: always
  286. image: golang:1.14
  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-pgsql-migration test-pgsql
  291. environment:
  292. GOPROXY: off
  293. TAGS: bindata
  294. TEST_LDAP: 1
  295. USE_REPO_TEST_DIR: 1
  296. depends_on:
  297. - build
  298. ---
  299. kind: pipeline
  300. name: translations
  301. platform:
  302. os: linux
  303. arch: arm64
  304. workspace:
  305. base: /go
  306. path: src/code.gitea.io/gitea
  307. trigger:
  308. branch:
  309. - master
  310. event:
  311. - push
  312. steps:
  313. - name: download
  314. pull: always
  315. image: jonasfranz/crowdin
  316. settings:
  317. download: true
  318. export_dir: options/locale/
  319. ignore_branch: true
  320. project_identifier: gitea
  321. environment:
  322. CROWDIN_KEY:
  323. from_secret: crowdin_key
  324. - name: update
  325. pull: default
  326. image: alpine:3.12
  327. commands:
  328. - ./build/update-locales.sh
  329. - name: push
  330. pull: always
  331. image: appleboy/drone-git-push
  332. settings:
  333. author_email: "teabot@gitea.io"
  334. author_name: GiteaBot
  335. commit: true
  336. commit_message: "[skip ci] Updated translations via Crowdin"
  337. remote: "git@github.com:go-gitea/gitea.git"
  338. environment:
  339. GIT_PUSH_SSH_KEY:
  340. from_secret: git_push_ssh_key
  341. - name: upload_translations
  342. pull: always
  343. image: jonasfranz/crowdin
  344. settings:
  345. files:
  346. locale_en-US.ini: options/locale/locale_en-US.ini
  347. ignore_branch: true
  348. project_identifier: gitea
  349. environment:
  350. CROWDIN_KEY:
  351. from_secret: crowdin_key
  352. ---
  353. kind: pipeline
  354. name: release-latest
  355. platform:
  356. os: linux
  357. arch: amd64
  358. workspace:
  359. base: /go
  360. path: src/code.gitea.io/gitea
  361. trigger:
  362. branch:
  363. - master
  364. - "release/*"
  365. event:
  366. - push
  367. depends_on:
  368. - testing-amd64
  369. - testing-arm64
  370. - translations
  371. steps:
  372. - name: fetch-tags
  373. pull: default
  374. image: docker:git
  375. commands:
  376. - git fetch --tags --force
  377. - name: static
  378. pull: always
  379. image: techknowlogick/xgo:go-1.14.x
  380. commands:
  381. - apt update && apt -y install curl
  382. - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
  383. - export PATH=$PATH:$GOPATH/bin
  384. - make release
  385. environment:
  386. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  387. TAGS: bindata sqlite sqlite_unlock_notify
  388. - name: gpg-sign
  389. pull: always
  390. image: plugins/gpgsign:1
  391. settings:
  392. detach_sign: true
  393. excludes:
  394. - "dist/release/*.sha256"
  395. files:
  396. - "dist/release/*"
  397. environment:
  398. GPGSIGN_KEY:
  399. from_secret: gpgsign_key
  400. GPGSIGN_PASSPHRASE:
  401. from_secret: gpgsign_passphrase
  402. - name: release-branch
  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/${DRONE_BRANCH##release/v}"
  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. when:
  419. branch:
  420. - "release/*"
  421. event:
  422. - push
  423. - name: release-master
  424. pull: always
  425. image: plugins/s3:1
  426. settings:
  427. acl: public-read
  428. bucket: releases
  429. endpoint: https://storage.gitea.io
  430. path_style: true
  431. source: "dist/release/*"
  432. strip_prefix: dist/release/
  433. target: /gitea/master
  434. environment:
  435. AWS_ACCESS_KEY_ID:
  436. from_secret: aws_access_key_id
  437. AWS_SECRET_ACCESS_KEY:
  438. from_secret: aws_secret_access_key
  439. when:
  440. branch:
  441. - master
  442. event:
  443. - push
  444. ---
  445. kind: pipeline
  446. name: release-version
  447. platform:
  448. os: linux
  449. arch: amd64
  450. workspace:
  451. base: /go
  452. path: src/code.gitea.io/gitea
  453. trigger:
  454. event:
  455. - tag
  456. depends_on:
  457. - testing-arm64
  458. - testing-amd64
  459. steps:
  460. - name: fetch-tags
  461. pull: default
  462. image: docker:git
  463. commands:
  464. - git fetch --tags --force
  465. - name: static
  466. pull: always
  467. image: techknowlogick/xgo:go-1.14.x
  468. commands:
  469. - apt update && apt -y install curl
  470. - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
  471. - export PATH=$PATH:$GOPATH/bin
  472. - make release
  473. environment:
  474. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  475. TAGS: bindata sqlite sqlite_unlock_notify
  476. - name: gpg-sign
  477. pull: always
  478. image: plugins/gpgsign:1
  479. settings:
  480. detach_sign: true
  481. excludes:
  482. - "dist/release/*.sha256"
  483. files:
  484. - "dist/release/*"
  485. environment:
  486. GPGSIGN_KEY:
  487. from_secret: gpgsign_key
  488. GPGSIGN_PASSPHRASE:
  489. from_secret: gpgsign_passphrase
  490. - name: release-tag
  491. pull: always
  492. image: plugins/s3:1
  493. settings:
  494. acl: public-read
  495. bucket: releases
  496. endpoint: https://storage.gitea.io
  497. path_style: true
  498. source: "dist/release/*"
  499. strip_prefix: dist/release/
  500. target: "/gitea/${DRONE_TAG##v}"
  501. environment:
  502. AWS_ACCESS_KEY_ID:
  503. from_secret: aws_access_key_id
  504. AWS_SECRET_ACCESS_KEY:
  505. from_secret: aws_secret_access_key
  506. - name: github
  507. pull: always
  508. image: plugins/github-release:1
  509. settings:
  510. files:
  511. - "dist/release/*"
  512. environment:
  513. GITHUB_TOKEN:
  514. from_secret: github_token
  515. ---
  516. kind: pipeline
  517. name: docs
  518. platform:
  519. os: linux
  520. arch: arm64
  521. depends_on:
  522. - compliance
  523. steps:
  524. - name: build-docs
  525. pull: always
  526. image: plugins/hugo:latest
  527. commands:
  528. - apk add --no-cache make bash curl
  529. - cd docs
  530. - make trans-copy clean build
  531. - name: publish-docs
  532. pull: always
  533. image: techknowlogick/drone-netlify:latest
  534. settings:
  535. path: docs/public/
  536. site_id: d2260bae-7861-4c02-8646-8f6440b12672
  537. environment:
  538. NETLIFY_TOKEN:
  539. from_secret: netlify_token
  540. when:
  541. branch:
  542. - master
  543. event:
  544. - push
  545. ---
  546. kind: pipeline
  547. name: docker-linux-amd64-release
  548. platform:
  549. os: linux
  550. arch: amd64
  551. workspace:
  552. base: /go
  553. path: src/code.gitea.io/gitea
  554. depends_on:
  555. - testing-amd64
  556. - testing-arm64
  557. trigger:
  558. ref:
  559. - refs/heads/master
  560. - "refs/tags/**"
  561. steps:
  562. - name: fetch-tags
  563. pull: default
  564. image: docker:git
  565. commands:
  566. - git fetch --tags --force
  567. - name: publish
  568. pull: always
  569. image: plugins/docker:linux-amd64
  570. settings:
  571. auto_tag: true
  572. auto_tag_suffix: linux-amd64
  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. when:
  581. event:
  582. exclude:
  583. - pull_request
  584. ---
  585. kind: pipeline
  586. name: docker-linux-arm64-dry-run
  587. platform:
  588. os: linux
  589. arch: arm64
  590. workspace:
  591. base: /go
  592. path: src/code.gitea.io/gitea
  593. depends_on:
  594. - compliance
  595. trigger:
  596. ref:
  597. - "refs/pull/**"
  598. steps:
  599. - name: dryrun
  600. pull: always
  601. image: plugins/docker:linux-arm64
  602. settings:
  603. dry_run: true
  604. repo: gitea/gitea
  605. tags: linux-arm64
  606. build_args:
  607. - GOPROXY=off
  608. when:
  609. event:
  610. - pull_request
  611. ---
  612. kind: pipeline
  613. name: docker-linux-arm64-release
  614. platform:
  615. os: linux
  616. arch: arm64
  617. workspace:
  618. base: /go
  619. path: src/code.gitea.io/gitea
  620. depends_on:
  621. - testing-amd64
  622. - testing-arm64
  623. trigger:
  624. ref:
  625. - refs/heads/master
  626. - "refs/tags/**"
  627. steps:
  628. - name: fetch-tags
  629. pull: default
  630. image: docker:git
  631. commands:
  632. - git fetch --tags --force
  633. - name: publish
  634. pull: always
  635. image: plugins/docker:linux-arm64
  636. settings:
  637. auto_tag: true
  638. auto_tag_suffix: linux-arm64
  639. repo: gitea/gitea
  640. build_args:
  641. - GOPROXY=off
  642. password:
  643. from_secret: docker_password
  644. username:
  645. from_secret: docker_username
  646. when:
  647. event:
  648. exclude:
  649. - pull_request
  650. ---
  651. kind: pipeline
  652. name: docker-manifest
  653. platform:
  654. os: linux
  655. arch: amd64
  656. steps:
  657. - name: manifest
  658. pull: always
  659. image: plugins/manifest
  660. settings:
  661. auto_tag: true
  662. ignore_missing: true
  663. spec: docker/manifest.tmpl
  664. password:
  665. from_secret: docker_password
  666. username:
  667. from_secret: docker_username
  668. trigger:
  669. ref:
  670. - refs/heads/master
  671. - "refs/tags/**"
  672. depends_on:
  673. - docker-linux-amd64-release
  674. - docker-linux-arm64-release
  675. ---
  676. kind: pipeline
  677. name: notifications
  678. platform:
  679. os: linux
  680. arch: arm64
  681. clone:
  682. disable: true
  683. trigger:
  684. branch:
  685. - master
  686. - "release/*"
  687. event:
  688. - push
  689. - tag
  690. status:
  691. - success
  692. - failure
  693. depends_on:
  694. - testing-amd64
  695. - testing-arm64
  696. - translations
  697. - release-version
  698. - release-latest
  699. - docker-linux-amd64-release
  700. - docker-linux-arm64-release
  701. - docker-manifest
  702. - docs
  703. steps:
  704. - name: discord
  705. pull: always
  706. image: appleboy/drone-discord:1.2.4
  707. settings:
  708. 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"
  709. webhook_id:
  710. from_secret: discord_webhook_id
  711. webhook_token:
  712. from_secret: discord_webhook_token