Skip to content
Snippets Groups Projects
Commit ad95f2c5 authored by Simon Reis's avatar Simon Reis
Browse files

changes to successfully run fe untitests and publish results to sonarcloud

parent 70261d03
No related branches found
No related tags found
1 merge request!1changes to successfully run fe untitests and publish results to sonarcloud
...@@ -5,10 +5,10 @@ variables: ...@@ -5,10 +5,10 @@ variables:
TRANSFER_METER_FREQUENCY: 5s # will display transfer progress every 5 seconds for artifacts and remote caches. TRANSFER_METER_FREQUENCY: 5s # will display transfer progress every 5 seconds for artifacts and remote caches.
SONAR_USER_HOME: ${CI_PROJECT_DIR}/.sonar # Defines the location of the analysis task cache SONAR_USER_HOME: ${CI_PROJECT_DIR}/.sonar # Defines the location of the analysis task cache
GIT_DEPTH: 0 # Tells git to fetch all the branches of the project, required by the analysis task GIT_DEPTH: 0 # Tells git to fetch all the branches of the project, required by the analysis task
CLI_VERSION: latest CLI_VERSION: 6.0.3
DOCKER_BUILDKIT: 1 # With BuildKit, you don't need to pull the remote images before building since it caches each build layer in your image registry. Then, when you build the image, each layer is downloaded as needed during the build. DOCKER_BUILDKIT: 1 # With BuildKit, you don't need to pull the remote images before building since it caches each build layer in your image registry. Then, when you build the image, each layer is downloaded as needed during the build.
image: node:10 image: node:8.9.4
#----------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------
stages: stages:
...@@ -47,7 +47,7 @@ stages: ...@@ -47,7 +47,7 @@ stages:
- test -d "node_modules" && echo "Found/Exists" || echo "Does not exist" - test -d "node_modules" && echo "Found/Exists" || echo "Does not exist"
- | - |
if [[ ! -d node_modules ]]; then if [[ ! -d node_modules ]]; then
npm ci --cache .npm --prefer-offline npm install --cache .npm --prefer-offline
fi fi
...@@ -64,21 +64,21 @@ stage-build: ...@@ -64,21 +64,21 @@ stage-build:
#----------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------
.stage-test: stage-test:
#----------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------
stage: Test stage: Test
extends: .cache extends: .cache
image: trion/ng-cli-karma:${CLI_VERSION} image: trion/ng-cli-karma:${CLI_VERSION}
allow_failure: false allow_failure: false
script: script:
- ./node_modules/@angular/cli/bin/ng test --code-coverage --progress false --watch false - ./node_modules/@angular/cli/bin/ng test --browsers=HeadlessChrome --progress false --watch false --code-coverage
artifacts: artifacts:
paths: paths:
- coverage/ - coverage/
#----------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------
.sonarqube: sonarqube:
#----------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------
stage: Sonarqube stage: Sonarqube
image: image:
...@@ -90,6 +90,8 @@ stage-build: ...@@ -90,6 +90,8 @@ stage-build:
- .sonar/cache - .sonar/cache
script: script:
- echo ${CI_PROJECT_DIR} - echo ${CI_PROJECT_DIR}
- ls -la
- ls coverage -la
- sonar-scanner -Dsonar.qualitygate.wait=true -Dsonar.branch.name="${CI_COMMIT_REF_NAME}" - sonar-scanner -Dsonar.qualitygate.wait=true -Dsonar.branch.name="${CI_COMMIT_REF_NAME}"
allow_failure: true allow_failure: true
dependencies: dependencies:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"build": "ng build --prod --base-href /spfe/ --output-path ./dist --no-progress", "build": "ng build --prod --base-href /spfe/ --output-path ./dist --no-progress",
"test": "ng test --browsers=ChromeHeadless --watch=false --code-coverage", "test": "ng test --browsers=HeadlessChrome --watch=false --code-coverage",
"build:QA": "ng build --prod --configuration qa --base-href /spfe/ --output-path ./dist --no-progress", "build:QA": "ng build --prod --configuration qa --base-href /spfe/ --output-path ./dist --no-progress",
"testAndBuild": "npm run test && npm run build", "testAndBuild": "npm run test && npm run build",
"testAndBuild:QA": "npm run test && npm run build:QA", "testAndBuild:QA": "npm run test && npm run build:QA",
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
"core-js": "2.5.4", "core-js": "2.5.4",
"file-saver": "^2.0.0", "file-saver": "^2.0.0",
"font-awesome": "4.7.0", "font-awesome": "4.7.0",
"node-sass": "4.5.3",
"primeicons": "1.0.0-beta.9", "primeicons": "1.0.0-beta.9",
"primeng": "6.1.3", "primeng": "6.1.3",
"rxjs": "6.2.2", "rxjs": "6.2.2",
...@@ -56,6 +57,7 @@ ...@@ -56,6 +57,7 @@
"karma-jasmine": "1.1.1", "karma-jasmine": "1.1.1",
"karma-jasmine-html-reporter": "1.2.0", "karma-jasmine-html-reporter": "1.2.0",
"protractor": "5.3.0", "protractor": "5.3.0",
"puppeteer": "0.13.0",
"ts-node": "7.0.0", "ts-node": "7.0.0",
"tslint": "5.10.0" "tslint": "5.10.0"
} }
......
...@@ -2,18 +2,15 @@ ...@@ -2,18 +2,15 @@
sonar.organization=openkonsequenz sonar.organization=openkonsequenz
sonar.projectKey=openkonsequenz_standbyplanning.frontend sonar.projectKey=openkonsequenz_standbyplanning.frontend
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1. # this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=sonar.projectName=standbyplanning.frontend sonar.projectName=standbyplanning.frontend
sonar.projectVersion=0.0.1_Snapshot sonar.projectVersion=0.0.1_Snapshot
# Language # Language
sonar.language=ts sonar.language=ts,css
sonar.sourceEncoding=UTF-8 sonar.sourceEncoding=UTF-8
sonar.sources=src sonar.sources=src
sonar.exclusions=**/node_modules/**,src/environments/**,e2e/*.ts,**/*.spec.ts,**/test-data/*.ts,**/testing/*.ts,**/assets/js/*.js,**/*.model.*,**/*.action.*,**/*.module.*,**/*column-definition*,**/*animation*,**/*api-client.*,**/styles.scss,src/assets/userDocumentation/** sonar.exclusions=**/node_modules/**
sonar.tests=src sonar.tests=src
sonar.test.inclusions=**/*.spec.ts sonar.test.inclusions=**/*.spec.ts
sonar.test.exclusions=
sonar.ts.tslintconfigpath=tslint.json sonar.ts.tslintconfigpath=tslint.json
sonar.typescript.lcov.reportPaths=coverage/lcov.info sonar.javascript.lcov.reportPaths=coverage/lcov.info
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
// Karma configuration file, see link for more information // Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html // https://karma-runner.github.io/1.0/config/configuration-file.html
const process = require('process');
process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
basePath: '', basePath: '',
...@@ -31,7 +34,13 @@ module.exports = function (config) { ...@@ -31,7 +34,13 @@ module.exports = function (config) {
}, },
reporters: ['progress', 'kjhtml'], reporters: ['progress', 'kjhtml'],
port: 9876, port: 9876,
browsers:['ChromeHeadless'], browsers: ['HeadlessChrome'],
customLaunchers:{
HeadlessChrome:{
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
colors: true, colors: true,
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,
autoWatch: true, autoWatch: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment