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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  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. - name: ldap
  208. pull: default
  209. image: gitea/test-openldap:latest
  210. steps:
  211. - name: fetch-tags
  212. pull: default
  213. image: docker:git
  214. commands:
  215. - git fetch --tags --force
  216. when:
  217. event:
  218. exclude:
  219. - pull_request
  220. - name: build
  221. pull: always
  222. image: golang:1.13
  223. commands:
  224. - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
  225. - make build
  226. environment:
  227. GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
  228. GOSUMDB: sum.golang.org
  229. TAGS: bindata sqlite sqlite_unlock_notify
  230. - name: test-sqlite
  231. pull: always
  232. image: golang:1.13
  233. commands:
  234. - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
  235. - apt-get install -y git-lfs
  236. - timeout -s ABRT 20m make test-sqlite-migration
  237. - timeout -s ABRT 20m make test-sqlite
  238. environment:
  239. GOPROXY: off
  240. TAGS: bindata
  241. depends_on:
  242. - build
  243. - name: test-pgsql
  244. pull: always
  245. image: golang:1.13
  246. commands:
  247. - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
  248. - apt-get install -y git-lfs
  249. - timeout -s ABRT 20m make test-pgsql-migration
  250. - timeout -s ABRT 20m make test-pgsql
  251. environment:
  252. GOPROXY: off
  253. TAGS: bindata
  254. TEST_LDAP: 1
  255. depends_on:
  256. - build
  257. ---
  258. kind: pipeline
  259. name: translations
  260. platform:
  261. os: linux
  262. arch: arm64
  263. workspace:
  264. base: /go
  265. path: src/code.gitea.io/gitea
  266. trigger:
  267. branch:
  268. - master
  269. event:
  270. - push
  271. steps:
  272. - name: download
  273. pull: always
  274. image: jonasfranz/crowdin
  275. settings:
  276. download: true
  277. export_dir: options/locale/
  278. ignore_branch: true
  279. project_identifier: gitea
  280. environment:
  281. CROWDIN_KEY:
  282. from_secret: crowdin_key
  283. - name: update
  284. pull: default
  285. image: alpine:3.11
  286. commands:
  287. - ./scripts/update-locales.sh
  288. - name: push
  289. pull: always
  290. image: appleboy/drone-git-push
  291. settings:
  292. author_email: "teabot@gitea.io"
  293. author_name: GiteaBot
  294. commit: true
  295. commit_message: "[skip ci] Updated translations via Crowdin"
  296. remote: "git@github.com:go-gitea/gitea.git"
  297. environment:
  298. GIT_PUSH_SSH_KEY:
  299. from_secret: git_push_ssh_key
  300. - name: upload_translations
  301. pull: always
  302. image: jonasfranz/crowdin
  303. settings:
  304. files:
  305. locale_en-US.ini: options/locale/locale_en-US.ini
  306. ignore_branch: true
  307. project_identifier: gitea
  308. environment:
  309. CROWDIN_KEY:
  310. from_secret: crowdin_key
  311. ---
  312. kind: pipeline
  313. name: release-master
  314. platform:
  315. os: linux
  316. arch: amd64
  317. workspace:
  318. base: /go
  319. path: src/code.gitea.io/gitea
  320. trigger:
  321. branch:
  322. - master
  323. - "release/*"
  324. event:
  325. - push
  326. depends_on:
  327. - testing-amd64
  328. - testing-arm64
  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. - apt update && apt -y install curl
  341. - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
  342. - export PATH=$PATH:$GOPATH/bin
  343. - make release
  344. environment:
  345. GOPROXY: off
  346. TAGS: bindata sqlite sqlite_unlock_notify
  347. - name: gpg-sign
  348. pull: always
  349. image: plugins/gpgsign:1
  350. settings:
  351. detach_sign: true
  352. excludes:
  353. - "dist/release/*.sha256"
  354. files:
  355. - "dist/release/*"
  356. environment:
  357. GPGSIGN_KEY:
  358. from_secret: gpgsign_key
  359. GPGSIGN_PASSPHRASE:
  360. from_secret: gpgsign_passphrase
  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. when:
  378. branch:
  379. - "release/*"
  380. event:
  381. - push
  382. - name: release
  383. pull: always
  384. image: plugins/s3:1
  385. settings:
  386. acl: public-read
  387. bucket: releases
  388. endpoint: https://storage.gitea.io
  389. path_style: true
  390. source: "dist/release/*"
  391. strip_prefix: dist/release/
  392. target: /gitea/master
  393. environment:
  394. AWS_ACCESS_KEY_ID:
  395. from_secret: aws_access_key_id
  396. AWS_SECRET_ACCESS_KEY:
  397. from_secret: aws_secret_access_key
  398. when:
  399. branch:
  400. - master
  401. event:
  402. - push
  403. ---
  404. kind: pipeline
  405. name: release-version
  406. platform:
  407. os: linux
  408. arch: amd64
  409. workspace:
  410. base: /go
  411. path: src/code.gitea.io/gitea
  412. trigger:
  413. event:
  414. - tag
  415. depends_on:
  416. - testing-arm64
  417. - testing-amd64
  418. steps:
  419. - name: fetch-tags
  420. pull: default
  421. image: docker:git
  422. commands:
  423. - git fetch --tags --force
  424. - name: static
  425. pull: always
  426. image: techknowlogick/xgo:latest
  427. commands:
  428. - apt update && apt -y install curl
  429. - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
  430. - export PATH=$PATH:$GOPATH/bin
  431. - make release
  432. environment:
  433. GOPROXY: off
  434. TAGS: bindata sqlite sqlite_unlock_notify
  435. - name: gpg-sign
  436. pull: always
  437. image: plugins/gpgsign:1
  438. settings:
  439. detach_sign: true
  440. excludes:
  441. - "dist/release/*.sha256"
  442. files:
  443. - "dist/release/*"
  444. environment:
  445. GPGSIGN_KEY:
  446. from_secret: gpgsign_key
  447. GPGSIGN_PASSPHRASE:
  448. from_secret: gpgsign_passphrase
  449. - name: release
  450. pull: always
  451. image: plugins/s3:1
  452. settings:
  453. acl: public-read
  454. bucket: releases
  455. endpoint: https://storage.gitea.io
  456. path_style: true
  457. source: "dist/release/*"
  458. strip_prefix: dist/release/
  459. target: "/gitea/${DRONE_TAG##v}"
  460. environment:
  461. AWS_ACCESS_KEY_ID:
  462. from_secret: aws_access_key_id
  463. AWS_SECRET_ACCESS_KEY:
  464. from_secret: aws_secret_access_key
  465. - name: github
  466. pull: always
  467. image: plugins/github-release:1
  468. settings:
  469. files:
  470. - "dist/release/*"
  471. environment:
  472. GITHUB_TOKEN:
  473. from_secret: github_token
  474. ---
  475. kind: pipeline
  476. name: docs
  477. platform:
  478. os: linux
  479. arch: arm64
  480. steps:
  481. - name: build-docs
  482. pull: always
  483. image: plugins/hugo:latest
  484. commands:
  485. - apk add --no-cache make bash curl
  486. - cd docs
  487. - make trans-copy
  488. - make clean
  489. - make build
  490. - name: publish-docs
  491. pull: always
  492. image: techknowlogick/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-release
  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-amd64
  515. - testing-arm64
  516. trigger:
  517. ref:
  518. - refs/heads/master
  519. - "refs/tags/**"
  520. steps:
  521. - name: fetch-tags
  522. pull: default
  523. image: docker:git
  524. commands:
  525. - git fetch --tags --force
  526. - name: publish
  527. pull: always
  528. image: plugins/docker:linux-amd64
  529. settings:
  530. auto_tag: true
  531. auto_tag_suffix: linux-amd64
  532. repo: gitea/gitea
  533. build_args:
  534. - GOPROXY=off
  535. password:
  536. from_secret: docker_password
  537. username:
  538. from_secret: docker_username
  539. when:
  540. event:
  541. exclude:
  542. - pull_request
  543. ---
  544. kind: pipeline
  545. name: docker-linux-arm64-dry-run
  546. platform:
  547. os: linux
  548. arch: arm64
  549. workspace:
  550. base: /go
  551. path: src/code.gitea.io/gitea
  552. depends_on:
  553. - compliance
  554. trigger:
  555. ref:
  556. - "refs/pull/**"
  557. steps:
  558. - name: dryrun
  559. pull: always
  560. image: plugins/docker:linux-arm64
  561. settings:
  562. dry_run: true
  563. repo: gitea/gitea
  564. tags: linux-arm64
  565. build_args:
  566. - GOPROXY=off
  567. when:
  568. event:
  569. - pull_request
  570. ---
  571. kind: pipeline
  572. name: docker-linux-arm64-release
  573. platform:
  574. os: linux
  575. arch: arm64
  576. workspace:
  577. base: /go
  578. path: src/code.gitea.io/gitea
  579. depends_on:
  580. - testing-amd64
  581. - testing-arm64
  582. trigger:
  583. ref:
  584. - refs/heads/master
  585. - "refs/tags/**"
  586. steps:
  587. - name: fetch-tags
  588. pull: default
  589. image: docker:git
  590. commands:
  591. - git fetch --tags --force
  592. - name: publish
  593. pull: always
  594. image: plugins/docker:linux-arm64
  595. settings:
  596. auto_tag: true
  597. auto_tag_suffix: linux-arm64
  598. repo: gitea/gitea
  599. build_args:
  600. - GOPROXY=off
  601. password:
  602. from_secret: docker_password
  603. username:
  604. from_secret: docker_username
  605. when:
  606. event:
  607. exclude:
  608. - pull_request
  609. ---
  610. kind: pipeline
  611. name: docker-manifest
  612. platform:
  613. os: linux
  614. arch: amd64
  615. steps:
  616. - name: manifest
  617. pull: always
  618. image: plugins/manifest
  619. settings:
  620. auto_tag: true
  621. ignore_missing: true
  622. spec: docker/manifest.tmpl
  623. password:
  624. from_secret: docker_password
  625. username:
  626. from_secret: docker_username
  627. trigger:
  628. ref:
  629. - refs/heads/master
  630. - "refs/tags/**"
  631. depends_on:
  632. - docker-linux-amd64-release
  633. - docker-linux-arm64-release
  634. ---
  635. kind: pipeline
  636. name: notifications
  637. platform:
  638. os: linux
  639. arch: arm64
  640. clone:
  641. disable: true
  642. trigger:
  643. branch:
  644. - master
  645. - "release/*"
  646. event:
  647. - push
  648. - tag
  649. status:
  650. - success
  651. - failure
  652. depends_on:
  653. - testing-amd64
  654. - testing-arm64
  655. - translations
  656. - release-version
  657. - release-master
  658. - docker-linux-amd64-release
  659. - docker-linux-arm64-release
  660. - docker-manifest
  661. - docs
  662. steps:
  663. - name: discord
  664. pull: always
  665. image: appleboy/drone-discord:1.2.4
  666. settings:
  667. 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"
  668. webhook_id:
  669. from_secret: discord_webhook_id
  670. webhook_token:
  671. from_secret: discord_webhook_token