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

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