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

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