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

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