cic-staff-client/.gitlab-ci.yml

80 lines
1.6 KiB
YAML
Raw Normal View History

2020-11-25 09:49:35 +01:00
stages:
- install
2020-11-25 11:29:55 +01:00
- build_and_test
2020-11-25 09:49:35 +01:00
2020-11-25 11:26:00 +01:00
variables:
PROJECT_PATH: "$CI_PROJECT_DIR"
APP_OUTPUT_PATH: "$CI_PROJECT_DIR/artifacts/app"
OUTPUT_PATH: "$CI_PROJECT_DIR/artifacts"
2020-11-25 09:49:35 +01:00
install_dependencies:
stage: install
2020-11-25 09:34:04 +01:00
image: node:15-alpine3.10
tags:
- docker
script:
2020-11-25 09:49:35 +01:00
- npm install
cache:
key:
files:
- package-lock.json
paths:
- node_modules
policy: pull
only:
refs:
- merge_requests
- master
changes:
- package-lock.json
2020-11-25 11:26:00 +01:00
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