stages: - install - build - test - build_and_test variables: PROJECT_PATH: "$CI_PROJECT_DIR" APP_OUTPUT_PATH: "$CI_PROJECT_DIR/dist/cic-staff-client" OUTPUT_PATH: "$CI_PROJECT_DIR/dist" CLI_VERSION: 10.2.0 install_dependencies: stage: install image: node:15-alpine3.10 tags: - docker script: - npm install cache: key: files: - package-lock.json paths: - node_modules policy: pull only: refs: - merge_requests - master changes: - package-lock.json build: stage: build image: trion/ng-cli tags: - docker before_script: - npm ci script: - ng build --prod artifacts: expire_in: 1 days paths: - dist/cic-staff-client cache: key: files: - package-lock.json paths: - node_modules policy: pull test:karma: stage: test image: trion/ng-cli-karma allow_failure: false tags: - docker script: - ng test --code-coverage --progress false --watch false coverage: '/Lines \W+: (\d+\.\d+)%.*/' artifacts: paths: - coverage/ cache: key: files: - package-lock.json paths: - node_modules policy: pull test:e2e: stage: test image: trion/ng-cli-e2e allow_failure: false tags: - docker script: - ng e2e cache: key: files: - package-lock.json paths: - node_modules policy: pull test:nglint: stage: test image: trion/ng-cli tags: - docker script: - ng lint cache: key: files: - package-lock.json paths: - node_modules policy: pull build_app: stage: build_and_test image: node:15-alpine3.10 tags: - docker script: - ng build --prod after_script: - mv $PROJECT_PATH/nginx.conf $PROJECT_PATH/default.conf - cp $PROJECT_PATH/default.conf $APP_OUTPUT_PATH - cp $PROJECT_PATH/Dockerfile $APP_OUTPUT_PATH artifacts: name: "cic-staff-client-pipeline" expire_in: 1 days paths: - $APP_OUTPUT_PATH cache: key: files: - package-lock.json paths: - node_modules policy: pull test_app: stage: build_and_test image: node:15-alpine3.10 tags: - docker before_script: - apk add chromium - export CHROME_BIN=/usr/bin/chromium-browser script: - ng lint - ng test --code-coverage --watch=false --browsers=GitlabChromeHeadless coverage: '/Statements\s+:\s\d+.\d+%/' artifacts: name: "tests-and-coverage" reports: junit: - $OUTPUT_PATH/tests/junit-test-results.xml cobertura: - $OUTPUT_PATH/coverage/cobetura-coverage.xml cache: key: files: - package-lock.json paths: - node_modules policy: pull