Merge remote-tracking branch 'origin/master' into spencer/transaction-list

This commit is contained in:
Spencer Ofwiti 2021-01-15 08:04:47 +03:00
commit 0fffd9395e
6 changed files with 144 additions and 7 deletions

View File

@ -1,4 +1,3 @@
# Created by .ignore support plugin (hsz.mobi)
.idea/
dist/
node_modules/

102
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,102 @@
stages:
- install
- build
- test
- package
cache:
key:
files:
- package-lock.json
paths:
- node_modules/
policy: pull
image: node:alpine
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
tags:
- docker
script:
- npm install -g @angular/cli@$CLI_VERSION
- npm install
only:
refs:
- merge_requests
- master
changes:
- package-lock.json
build:
stage: build
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
test:karma:
stage: test
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 --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/
test:e2e:
stage: test
allow_failure: false
tags:
- docker
script:
- npm ng e2e
test:nglint:
stage: test
tags:
- docker
script:
- npm ng lint
docker-build:
stage: package
image: docker:latest
services:
- docker:dind
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA"
before_script:
- docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY
script:
- docker build -t $IMAGE_TAG -f Dockerfile .
- docker push $IMAGE_TAG
only:
- master

View File

@ -1,6 +1,6 @@
### STAGE 1: Build ###
# defining version of the base image
FROM node:15.1.0-alpine as build
FROM node:alpine as build
# defining work directory
WORKDIR /app
@ -18,7 +18,7 @@ RUN npm run build --prod
### STAGE 2: Setup ###
# defining nginx image version
FROM nginx:1.19.4-alpine
FROM nginx:alpine
## Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*

View File

@ -7,6 +7,7 @@ module.exports = function (config) {
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-junit-reporter'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
@ -17,16 +18,32 @@ module.exports = function (config) {
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/cic-staff-client'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
reports: ['html', 'lcovonly', 'text-summary', 'cobertura'],
fixWebpackSourcePaths: true,
'report-config': {
'text-summary': {
file: 'text-summary.txt'
}
},
},
reporters: ['progress', 'kjhtml'],
junitReporter: {
outputDir: require('path').join(__dirname, './tests/cic-staff-client'),
outputFile: 'junit-test-results.xml',
useBrowserName: false
},
reporters: ['progress', 'kjhtml', 'junit'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
customLaunchers: {
GitlabHeadlessChrome: {
base: 'ChromeHeadless',
flags: ['--no-sandbox'],
},
},
});
};

18
package-lock.json generated
View File

@ -8730,6 +8730,24 @@
"integrity": "sha512-PtilRLno5O6wH3lDihRnz0Ba8oSn0YUJqKjjux1peoYGwo0AQqrWRbdWk/RLzcGlb+onTyXAnHl6M+Hu3UxG/Q==",
"dev": true
},
"karma-junit-reporter": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/karma-junit-reporter/-/karma-junit-reporter-2.0.1.tgz",
"integrity": "sha512-VtcGfE0JE4OE1wn0LK8xxDKaTP7slN8DO3I+4xg6gAi1IoAHAXOJ1V9G/y45Xg6sxdxPOR3THCFtDlAfBo9Afw==",
"dev": true,
"requires": {
"path-is-absolute": "^1.0.0",
"xmlbuilder": "12.0.0"
},
"dependencies": {
"xmlbuilder": {
"version": "12.0.0",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-12.0.0.tgz",
"integrity": "sha512-lMo8DJ8u6JRWp0/Y4XLa/atVDr75H9litKlb2E5j3V3MesoL50EBgZDWoLT3F/LztVnG67GjPXLZpqcky/UMnQ==",
"dev": true
}
}
},
"karma-source-map-support": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.4.0.tgz",

View File

@ -58,6 +58,7 @@
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-junit-reporter": "^2.0.1",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",