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

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