.gitlab-ci.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. image: chocobozzz/peertube-ci:10
  2. stages:
  3. - build-and-lint
  4. - test
  5. - clients
  6. - docker-nightly
  7. #before_script:
  8. # - 'sed -i -z "s/database:\n hostname: ''localhost''/database:\n hostname: ''postgres''/" config/test.yaml'
  9. # - 'sed -i -z "s/redis:\n hostname: ''localhost''/redis:\n hostname: ''redis''/" config/test.yaml'
  10. # - if [[ $CI_JOB_STAGE == "test" ]]; then psql -c "create user peertube with password 'peertube';"; fi
  11. # - NOCLIENT=1 yarn install --pure-lockfile --cache-folder .yarn-cache
  12. cache:
  13. key: yarn
  14. paths:
  15. - .yarn-cache
  16. - cached-fixtures
  17. ###
  18. ## Jobs templates
  19. #
  20. #.build-and-lint: &build-and-lint
  21. # stage: build-and-lint
  22. #
  23. #.tests: &tests
  24. # stage: test
  25. # dependencies:
  26. # - build-server
  27. # services:
  28. # - name: postgres:9.6
  29. # alias: postgres
  30. # - name: redis:latest
  31. # alias: redis
  32. # variables:
  33. # PGHOST: postgres
  34. # PGUSER: postgres
  35. # REDIS_HOST: redis
  36. # artifacts:
  37. # expire_in: 1 day
  38. # paths:
  39. # - test*/logs
  40. # when: always
  41. #
  42. ####
  43. ### Build and lint
  44. ##
  45. #build-server:
  46. # <<: *build-and-lint
  47. # artifacts:
  48. # expire_in: 5h
  49. # paths:
  50. # - dist/
  51. # script:
  52. # - npm run build:server
  53. #
  54. #lint:
  55. # <<: *build-and-lint
  56. # script:
  57. # - yarn install --pure-lockfile --cache-folder .yarn-cache
  58. # - npm run ci -- "lint"
  59. #
  60. ####
  61. ### Tests
  62. #
  63. #test-misc:
  64. # <<: *tests
  65. # script:
  66. # - yarn install --pure-lockfile --cache-folder .yarn-cache
  67. # - npm run ci -- "misc"
  68. #
  69. #test-cli:
  70. # <<: *tests
  71. # retry:
  72. # max: 1
  73. # script:
  74. # - npm run ci -- "cli"
  75. #
  76. #api:
  77. # <<: *tests
  78. # parallel: 4
  79. # retry:
  80. # max: 1
  81. # script:
  82. # - NODE_PENDING_JOB_WAIT=1000 npm run ci -- api-$CI_NODE_INDEX
  83. build-openapi-clients:
  84. stage: clients
  85. only:
  86. refs:
  87. - master
  88. - schedules
  89. changes:
  90. - support/doc/api/openapi.yaml
  91. script:
  92. - apt-get update -qq
  93. - apt-get -yqqq install openjdk-8-jre
  94. - yarn install --pure-lockfile
  95. - scripts/openapi-peertube-version.sh
  96. - scripts/openapi-clients.sh
  97. build-nightly:
  98. stage: docker-nightly
  99. only:
  100. - schedules
  101. script:
  102. - yarn install --pure-lockfile --cache-folder .yarn-cache
  103. - npm run nightly
  104. - mkdir "${HOME}/.ssh"
  105. - chmod 700 "${HOME}/.ssh"
  106. - if [ ! -z ${DEPLOYEMENT_KNOWN_HOSTS+x} ]; then echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts; fi
  107. - eval `ssh-agent -s`
  108. - if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then ssh-add <(echo "${DEPLOYEMENT_KEY}"); fi
  109. - if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then scp ./peertube-nightly-* ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web/nightly; fi
  110. .docker: &docker
  111. stage: docker-nightly
  112. cache: {}
  113. image:
  114. name: gcr.io/kaniko-project/executor:debug
  115. entrypoint: [""]
  116. before_script:
  117. - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$CI_REGISTRY_AUTH\",\"email\":\"$CI_REGISTRY_EMAIL\"}}}" > /kaniko/.docker/config.json
  118. script:
  119. - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/support/docker/production/Dockerfile.buster --destination $DOCKER_IMAGE_NAME
  120. build-docker-develop:
  121. <<: *docker
  122. only:
  123. - schedules
  124. variables:
  125. DOCKER_IMAGE_NAME: chocobozzz/peertube:develop-buster
  126. build-docker-tag:
  127. <<: *docker
  128. only:
  129. - tags
  130. variables:
  131. DOCKER_IMAGE_NAME: chocobozzz/peertube:$CI_COMMIT_TAG-buster
  132. build-docker-master:
  133. <<: *docker
  134. only:
  135. - master
  136. variables:
  137. DOCKER_IMAGE_NAME: chocobozzz/peertube:production-buster