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

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