From bd8bf17d79df8b9f50bb483b283a0753e26981af Mon Sep 17 00:00:00 2001 From: vamsee Date: Fri, 10 Jan 2020 16:50:26 +0530 Subject: [PATCH] removed unneeded packages and updated ci --- .eslintignore | 8 +++++++- .gitlab-ci.yml | 55 ++++++++++++++++++++++++++++++++++++-------------- package.json | 2 +- 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/.eslintignore b/.eslintignore index 4ebc8ae..9c8d714 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,7 @@ -coverage +build/ +client/ +coverage/ +node_modules/ +test/ +drop.js +Gruntfile.js diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed19db0..5562992 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,8 @@ stages: - pre-build - pre-build-test + - push-artifacts + - performance variables: DOMAIN_NAME: oecloud.local @@ -15,47 +17,70 @@ before_script: - export project=${CI_PROJECT_NAME//[^[:alnum:]]/} - export group=${CI_PROJECT_NAMESPACE//[^[:alnum:]]/} - export branch=${CI_BUILD_REF_NAME//[^[:alnum:]]/} + - if [ ${group} == "oecloudio" ]; then export APP_IMAGE_NAME=$project; else export APP_IMAGE_NAME=$group"-"$project; fi + - export APP_IMAGE_NAME=$(echo $APP_IMAGE_NAME | tr '[:upper:]' '[:lower:]') + - if [ ${branch} == "master" ]; then export APP_TAG=latest; else export APP_TAG=${branch}; fi + - export APP_TAG=$(echo $APP_TAG | tr '[:upper:]' '[:lower:]') + + - npm config set unsafe-perm true + - npm config set progress false + - npm config set registry ${NPM_REGISTRY} + # - npm config set registry https://registry.npmjs.org/ npminstall: stage: pre-build script: - echo "Performing code style check..." - - status_eslint=0 - - exit_status=0 - - npm set progress=false - - npm config set registry ${NPM_REGISTRY} - - time npm install eslint babel-eslint eslint-config-loopback --no-optional + - export status_eslint=0 + - export exit_status=0 + - time npm install eslint babel-eslint --no-optional - if npm run lint; then status_eslint=0; else status_eslint=1; fi - - if [ $status_eslint == 1 ]; then exit_status=1 && echo "esLint errors exist"; fi + - if [ $status_eslint == 1 ]; then export exit_status=1 && echo "esLint errors exist"; fi - if [ $exit_status == 1 ]; then exit $exit_status; fi - echo "Code style check done successfully" - time npm install --no-optional - echo "Node Modules Installed" - - mkdir -p ./artifacts/${CI_PROJECT_NAME}/ - - npm audit --json > ./artifacts/${CI_PROJECT_NAME}/vulnerabilities.json || true + - npm config rm registry + - npm audit --json > vulnerabilities.json || true - if npm audit; then status_vulnerabilities=0; else status_vulnerabilities=1; fi - - if [ $status_vulnerabilities == 1 ]; then export exit_status=1; echo "Dependency vulnerabilities exist"; fi + - if [ $status_vulnerabilities == 1 ]; then echo "Dependency vulnerabilities exist"; fi - if [ $exit_status == 1 ]; then exit $exit_status; fi artifacts: expire_in: 2h paths: - node_modules/ + - vulnerabilities.json tags: - CEP_RUNNER -test: +mongotest: + coverage: /Statements.*?(\d+(?:\.\d+)?)%/ stage: pre-build-test + variables: + MONGODB_HOST: 10.73.53.144 + MONGODB_PORT: '27017' + MONGODB_DATABASE: ${CI_JOB_ID}_mongo script: - echo 'Performing MongoDB Test' - - export MONGODB_HOST="10.73.53.144" - - export MONGODB_PORT=27018 - - export MONGODB_DATABASE=${CI_JOB_ID}_mongo - - npm config set registry ${NPM_REGISTRY} - time npm install --no-optional - - npm run test + - npm test artifacts: expire_in: 2h paths: - coverage/ tags: - CEP_RUNNER + +pushartifacts: + stage: push-artifacts + script: + - echo "Copying all artifacts" + - mkdir -p ./artifacts/${CI_PROJECT_NAME}/${CI_BUILD_REF_NAME}/ + - cp vulnerabilities.json ./artifacts/${CI_PROJECT_NAME}/${CI_BUILD_REF_NAME}/ + - cp -r coverage/ ./artifacts/${CI_PROJECT_NAME}/${CI_BUILD_REF_NAME}/ + - git clone http://10.73.97.24/oecloud.io/build-tools.git + - sh ./build-tools/push_artifacts.sh + tags: + - CEP_RUNNER + only: + - /^.*/@oecloud.io/oe-connector-mongodb diff --git a/package.json b/package.json index 90334ba..3e438aa 100644 --- a/package.json +++ b/package.json @@ -31,10 +31,10 @@ "strong-globalize": "4.1.2" }, "devDependencies": { - "mocha": "5.2.0", "eslint": "5.15.1", "eslint-config-loopback": "10.0.0", "loopback-datasource-juggler": "3.28.1", + "mocha": "5.2.0", "rc": "1.2.8", "semver": "5.6.0", "should": "13.2.3",