Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

.drone.yml 13KB

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