Refactor ci pipeline.

This commit is contained in:
Spencer Ofwiti 2020-12-28 14:31:42 +03:00
parent 5e74238df2
commit 5549821f26
1 changed files with 13 additions and 59 deletions

View File

@ -2,7 +2,8 @@ stages:
- install
- build
- test
- build_and_test
image: node:15-alpine3.10
variables:
PROJECT_PATH: "$CI_PROJECT_DIR"
@ -12,7 +13,6 @@ variables:
install_dependencies:
stage: install
image: node:15-alpine3.10
tags:
- docker
script:
@ -34,7 +34,6 @@ install_dependencies:
build:
stage: build
image: node:15-alpine3.10
tags:
- docker
script:
@ -58,14 +57,22 @@ build:
test:karma:
stage: test
image: node:15-alpine3.10
allow_failure: false
tags:
- docker
before_script:
- apk add chromium
- export CHROME_BIN=/usr/bin/chromium-browser
script:
- npm ng test --code-coverage --progress false --watch false
coverage: '/Lines \W+: (\d+\.\d+)%.*/'
- npm ng test --code-coverage --progress false --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
paths:
- coverage/
cache:
@ -78,7 +85,6 @@ test:karma:
test:e2e:
stage: test
image: node:15-alpine3.10
allow_failure: false
tags:
- docker
@ -94,7 +100,6 @@ test:e2e:
test:nglint:
stage: test
image: node:15-alpine3.10
tags:
- docker
script:
@ -106,54 +111,3 @@ test:nglint:
paths:
- node_modules
policy: pull
build_app:
stage: build_and_test
image: node:15-alpine3.10
tags:
- docker
script:
- npm 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:
- npm ng lint
- npm 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