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

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