Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

.drone.yml 16KB

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