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 15KB

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