本项目是群体化方法与技术的开源实现案例,在基于Gitea的基础上,进一步支持社交化的协同开发、协同学习、协同研究等群体创新实践服务,特别是针对新一代人工智能技术特点,重点支持项目管理、git代码管理、大数据集存储管理与智能计算平台接入。 https://git.openi.org.cn
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.
 
 
 
 
 
 

821 lines
16 KiB

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