stages: - prepare - linters - tests - deploy_dev .cache-tpl: &cache-tpl key: "$CI_COMMIT_REF_SLUG" paths: - node_modules - frontend/components policy: pull .test-template: &test-template image: node:10-stretch tags: - docker cache: <<: *cache-tpl before_script: - npm install -g grunt-cli - 'echo "INFO: NB node packages : $(ls node_modules | wc -l)"' - 'echo "INFO: NB bower packages : $(ls frontend/components | wc -l)"' except: variables: - $SKIP_TESTS .test-template-svc: &test-template-svc <<: *test-template services: - name: docker.elastic.co/elasticsearch/elasticsearch:6.3.2 alias: elasticsearch command: [ "bin/elasticsearch", "-Ediscovery.type=single-node" ] - name: mongo:3.2.0 alias: mongo variables: MONGO_HOST: mongo MONGO_PORT: 27017 ELASTICSEARCH_HOST : elasticsearch ELASTICSEARCH_PORT: 9200 prepare: image: node:10-stretch stage: prepare tags: - docker cache: <<: *cache-tpl policy: pull-push script: - npm install - npm install -g bower - bower install --allow-root - 'echo "INFO: NB node packages : $(ls node_modules | wc -l)"' - 'echo "INFO: NB bower packages : $(ls frontend/components | wc -l)"' except: variables: - $SKIP_PREPARE linters: <<: *test-template stage: linters script: - grunt -v linters except: variables: - $SKIP_LINTERS test-unit-frontend: <<: *test-template stage: tests script: - grunt -v test-unit-frontend test-unit-backend: <<: *test-template stage: tests script: - grunt -v test-unit-backend test-midway-backend: <<: *test-template-svc stage: tests script: - grunt -v test-midway-backend deploy_dev: stage: deploy_dev tags: - dev.open-paas.org - deployment environment: name: dev url: https://dev.open-paas.org only: - master@linagora/lgs/openpaas/linagora.esn.resource script: - cd /srv/${CI_PROJECT_NAME} - git fetch --all - git checkout ${CI_COMMIT_SHA} - npm install --ignore-scripts --production - npm update --production - npm prune - bower install --production - bower prune - git checkout -- . - sudo /etc/init.d/rse.dev restart