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

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