cic-staff-client/.gitlab-ci.yml
2020-11-25 13:28:46 +03:00

80 lines
1.6 KiB
YAML

stages:
- install
- build_and-test
variables:
PROJECT_PATH: "$CI_PROJECT_DIR"
APP_OUTPUT_PATH: "$CI_PROJECT_DIR/artifacts/app"
OUTPUT_PATH: "$CI_PROJECT_DIR/artifacts"
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_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"
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