Merge remote-tracking branch 'origin/master' into spencer/auth
This commit is contained in:
commit
461f861b42
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.idea/
|
||||||
|
dist/
|
||||||
|
node_modules/
|
102
.gitlab-ci.yml
Normal file
102
.gitlab-ci.yml
Normal 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
|
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
### STAGE 1: Build ###
|
||||||
|
# defining version of the base image
|
||||||
|
FROM node:alpine as build
|
||||||
|
|
||||||
|
# defining work directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# copying the json files into the image
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# copying rest of project
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# running build script
|
||||||
|
RUN npm run build --prod
|
||||||
|
|
||||||
|
### STAGE 2: Setup ###
|
||||||
|
# defining nginx image version
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
## Remove default nginx website
|
||||||
|
RUN rm -rf /usr/share/nginx/html/*
|
||||||
|
|
||||||
|
# copy dist output from our first image
|
||||||
|
COPY --from=build /app/dist/cic-staff-client /usr/share/nginx/html
|
||||||
|
|
||||||
|
# copy nginx configuration file
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
EXPOSE 80 443
|
||||||
|
|
||||||
|
CMD [ "nginx", "-g", "daemon off;" ]
|
@ -7,6 +7,7 @@ module.exports = function (config) {
|
|||||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
plugins: [
|
plugins: [
|
||||||
require('karma-jasmine'),
|
require('karma-jasmine'),
|
||||||
|
require('karma-junit-reporter'),
|
||||||
require('karma-chrome-launcher'),
|
require('karma-chrome-launcher'),
|
||||||
require('karma-jasmine-html-reporter'),
|
require('karma-jasmine-html-reporter'),
|
||||||
require('karma-coverage-istanbul-reporter'),
|
require('karma-coverage-istanbul-reporter'),
|
||||||
@ -17,16 +18,32 @@ module.exports = function (config) {
|
|||||||
},
|
},
|
||||||
coverageIstanbulReporter: {
|
coverageIstanbulReporter: {
|
||||||
dir: require('path').join(__dirname, './coverage/cic-staff-client'),
|
dir: require('path').join(__dirname, './coverage/cic-staff-client'),
|
||||||
reports: ['html', 'lcovonly', 'text-summary'],
|
reports: ['html', 'lcovonly', 'text-summary', 'cobertura'],
|
||||||
fixWebpackSourcePaths: true
|
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,
|
port: 9876,
|
||||||
colors: true,
|
colors: true,
|
||||||
logLevel: config.LOG_INFO,
|
logLevel: config.LOG_INFO,
|
||||||
autoWatch: true,
|
autoWatch: true,
|
||||||
browsers: ['Chrome'],
|
browsers: ['Chrome'],
|
||||||
singleRun: false,
|
singleRun: false,
|
||||||
restartOnFileChange: true
|
restartOnFileChange: true,
|
||||||
|
customLaunchers: {
|
||||||
|
GitlabHeadlessChrome: {
|
||||||
|
base: 'ChromeHeadless',
|
||||||
|
flags: ['--no-sandbox'],
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
8
nginx.conf
Normal file
8
nginx.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $uri $uri/ /index.html =404;
|
||||||
|
}
|
||||||
|
}
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -7057,6 +7057,24 @@
|
|||||||
"integrity": "sha512-PtilRLno5O6wH3lDihRnz0Ba8oSn0YUJqKjjux1peoYGwo0AQqrWRbdWk/RLzcGlb+onTyXAnHl6M+Hu3UxG/Q==",
|
"integrity": "sha512-PtilRLno5O6wH3lDihRnz0Ba8oSn0YUJqKjjux1peoYGwo0AQqrWRbdWk/RLzcGlb+onTyXAnHl6M+Hu3UxG/Q==",
|
||||||
"dev": true
|
"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": {
|
"karma-source-map-support": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.4.0.tgz",
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
"@angular-devkit/build-angular": "~0.1002.0",
|
"@angular-devkit/build-angular": "~0.1002.0",
|
||||||
"@angular/cli": "~10.2.0",
|
"@angular/cli": "~10.2.0",
|
||||||
"@angular/compiler-cli": "~10.2.0",
|
"@angular/compiler-cli": "~10.2.0",
|
||||||
"@types/node": "^12.11.1",
|
|
||||||
"@types/jasmine": "~3.5.0",
|
"@types/jasmine": "~3.5.0",
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
|
"@types/node": "^12.11.1",
|
||||||
"codelyzer": "^6.0.0",
|
"codelyzer": "^6.0.0",
|
||||||
"jasmine-core": "~3.6.0",
|
"jasmine-core": "~3.6.0",
|
||||||
"jasmine-spec-reporter": "~5.0.0",
|
"jasmine-spec-reporter": "~5.0.0",
|
||||||
@ -40,6 +40,7 @@
|
|||||||
"karma-coverage-istanbul-reporter": "~3.0.2",
|
"karma-coverage-istanbul-reporter": "~3.0.2",
|
||||||
"karma-jasmine": "~4.0.0",
|
"karma-jasmine": "~4.0.0",
|
||||||
"karma-jasmine-html-reporter": "^1.5.0",
|
"karma-jasmine-html-reporter": "^1.5.0",
|
||||||
|
"karma-junit-reporter": "^2.0.1",
|
||||||
"protractor": "~7.0.0",
|
"protractor": "~7.0.0",
|
||||||
"ts-node": "~8.3.0",
|
"ts-node": "~8.3.0",
|
||||||
"tslint": "~6.1.0",
|
"tslint": "~6.1.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user