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