本站源代码
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.

781 lines
15KB

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