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

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