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