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 14KB

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