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

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