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

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