THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

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.

757 lines
14KB

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