Commit b1f9cef0 authored by Björn Bartels's avatar Björn Bartels

update ci config, add release job & script

parent f3ff889c
Pipeline #170 passed with stages
in 8 minutes and 27 seconds
# global variables
variables:
BUILD_TARGET: httpdocs
BUILD_LABEL_TMPFILE: build.txt
# pipeline stages
stages:
- setup
- build
- test
- deploy
# Cache modules in between jobs
# pipeline project cache
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
......@@ -15,13 +21,11 @@ cache:
# cache package/project stuff, non-artifacts
- dist/
variables:
BUILD_TARGET: httpdocs
BUILD_LABEL_TMPFILE: build.txt
# check for possible build label file
before_script:
- if [ -f ${BUILD_LABEL_TMPFILE} ]; then export BUILD_LABEL=`cat ${BUILD_LABEL_TMPFILE}`; fi
# pipeline project setup/install
init:
stage: setup
tags:
......@@ -51,6 +55,7 @@ init:
paths:
- ${BUILD_LABEL_TMPFILE}
# pipeline project build
app-build:
stage: build
tags:
......@@ -82,6 +87,7 @@ app-build:
- ${BUILD_TARGET}
# pipeline project SASS unit-tests
app-test-sass:
stage: test
tags:
......@@ -95,10 +101,8 @@ app-test-sass:
#
# run SASS tests
- npm run test:sass
artifacts:
paths:
- ${BUILD_TARGET}
# pipeline project JavaScript unit-tests
app-test-javascript:
stage: test
tags:
......@@ -112,10 +116,8 @@ app-test-javascript:
#
# run SASS tests
- npm run test:javascript
artifacts:
paths:
- ${BUILD_TARGET}
# pipeline project headless browser tests
app-test-browser:
stage: test
tags:
......@@ -129,10 +131,8 @@ app-test-browser:
#
# run browser/headless tests
- npm run test:browser
artifacts:
paths:
- ${BUILD_TARGET}
# pipeline project SASS source linting
src-lint-sass:
stage: test
tags:
......@@ -146,10 +146,8 @@ src-lint-sass:
#
# run SASS linting
- npm run lint:sass
artifacts:
paths:
- ${BUILD_TARGET}
# pipeline project JavaScript source linting
src-lint-javascript:
stage: test
tags:
......@@ -163,9 +161,6 @@ src-lint-javascript:
#
# run SASS linting
- npm run lint:javascript
artifacts:
paths:
- ${BUILD_TARGET}
# ftp to dev host
deploy-dev:
......@@ -176,7 +171,7 @@ deploy-dev:
- app-build
environment:
name: development
url: https://$FTP_HOST_DEV
url: https://$HOST_DEV
before_script:
#- no action for now...
script:
......@@ -184,15 +179,12 @@ deploy-dev:
- npm run deploy
# ftp to host
- 'which lftp || ( apt-get update -qq && apt-get install -y -qq lftp )'
- lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME_DEV,$FTP_PASSWORD_DEV $FTP_HOST_DEV; mirror -Rev ${BUILD_TARGET}/ ./$FTP_PATH_DEV/${BUILD_TARGET} --parallel=10 --exclude-glob .git* --exclude .git/"
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME_DEV,$PASSWORD_DEV $HOST_DEV; mirror -Rev ${BUILD_TARGET}/ ./$PATH_DEV/${BUILD_TARGET} --parallel=10 --exclude-glob .git* --exclude .git/"
except:
refs:
- master
- tags
- release
artifacts:
paths:
- ${BUILD_TARGET}
# ftp to production/live host
deploy-staging:
......@@ -203,7 +195,7 @@ deploy-staging:
- app-build
environment:
name: staging
url: https://$FTP_HOST_TEST
url: https://$HOST_TEST
before_script:
#- no action for now...
script:
......@@ -211,7 +203,7 @@ deploy-staging:
- npm run deploy
# ftp to host
- 'which lftp || ( apt-get update -qq && apt-get install -y -qq lftp )'
- lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME_TEST,$FTP_PASSWORD_TEST $FTP_HOST_TEST; mirror -Rev ${BUILD_TARGET}/ ./$FTP_PATH_TEST/${BUILD_TARGET} --parallel=10 --exclude-glob .git* --exclude .git/"
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME_TEST,$PASSWORD_TEST $HOST_TEST; mirror -Rev ${BUILD_TARGET}/ ./$PATH_TEST/${BUILD_TARGET} --parallel=10 --exclude-glob .git* --exclude .git/"
only:
refs:
- master
......@@ -225,7 +217,7 @@ deploy-prod:
- app-build
environment:
name: production
url: https://$FTP_HOST_PROD
url: https://$HOST_PROD
before_script:
#- no action for now...
script:
......@@ -233,12 +225,28 @@ deploy-prod:
- npm run deploy
# ftp to host
- 'which lftp || ( apt-get update -qq && apt-get install -y -qq lftp )'
- lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME_PROD,$FTP_PASSWORD_PROD $FTP_HOST_PROD; mirror -Rev ${BUILD_TARGET}/ ./$FTP_PATH_PROD/${BUILD_TARGET} --parallel=10 --exclude-glob .git* --exclude .git/"
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME_PROD,$PASSWORD_PROD $HOST_PROD; mirror -Rev ${BUILD_TARGET}/ ./$PATH_PROD/${BUILD_TARGET} --parallel=10 --exclude-glob .git* --exclude .git/"
only:
refs:
- tags
- release
when: manual
artifacts:
paths:
- ${BUILD_TARGET}
# changelog, version update & git tag
# (!) remember: variable INCVER must be set when starting pipeline (!)
pkg-release:
stage: deploy
tags:
- web-ftp-runner
environment:
name: package
url: https://gitlab.p-ad.de/pad-intern/ops/web-base/tags
before_script:
#- no action for now...
script:
# apply release script
- npm run release
only:
refs:
- master
when: manual
......@@ -4,6 +4,7 @@
"description": "",
"author": "coding@bjoernbartels.earth",
"license": "MIT",
"homepage": "git@gitlab.bjoernbartels.earth/devops/web-base",
"repository": {
"type": "git",
"url": "git@gitlab.bjoernbartels.earth/devops/web-base.git"
......@@ -20,13 +21,16 @@
"build:dev": "gulp build",
"lint": "npm run lint:sass && npm run lint:javascript",
"lint:sass": "sass-lint './src/assets/scss/**/*.scss'",
"lint:javascript": "./node_modules/.bin/eslint ./src/assets/js/**/*.js",
"lint:javascript": "eslint ./src/assets/js/**/*.js",
"test": "npm run test:sass && npm run test:javascript && npm run test:browser",
"test:sass": "mocha ./test/sass/*.js",
"test:javascript": "nyc mocha --require '@babel/register' ./test/js/*.js;",
"test:browser": "mocha-headless-chrome -a no-sandbox -f ./test/headless/*.html -c ./dist/coverage.json",
"deploy": "gulp deploy",
"reinstall": "rm -rf node_modules package-lock.json; npm install;"
"reinstall": "rm -rf node_modules package-lock.json; npm install;",
"changelog": "changelog-generator; cat ./CHANGELOG.md | more;",
"version": "version-updater",
"release": "levels=\"^major|minor|patch|premajor|preminor|prepatch|prerelease\"; if ! [[ \"$INCVER\" =~ $levels ]]; then echo \"\\x1b[31mError: Set (environment) variable INCVER to match '$levels'!\\x1b[0m\"; exit 1; fi; if [ \"$(git rev-parse --abbrev-ref HEAD)\" != \"master\" ]; then echo \"\\x1b[31mError: We are not on MASTER branch!\\x1b[0m\"; exit 1; fi; RELEASE_MSG=\"releasing new $INCVER version...\"; echo \"$RELEASE_MSG\"; echo \"generating new changelog...\"; changelog-generator; version-updater $INCVER; CURRENT_VER=$(version-updater current); RELEASE_MSG=\"release version: $CURRENT_VER\"; git add -A .; git commit -m \"$RELEASE_MSG\"; git tag $CURRENT_VER; git push --follow-tags; echo $RELEASE_MSG; exit 0;"
},
"dependencies": {
"aos": "^2.2.0",
......@@ -37,48 +41,53 @@
"what-input": "^5.1.2"
},
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"@babel/register": "^7.0.0",
"autoprefixer": "^9.1.5",
"babel-loader": "^8.0.4",
"browser-sync": "^2.10.0",
"chai": "^4",
"chai-jquery": "^2",
"changelog-generator": "git+https://gitlab.bjoernbartels.earth/devops/changelog-generator.git",
"compare-versions": "^3.4.0",
"eslint": "^5.8.0",
"gulp": "^4.0.0",
"gulp-babel": "^8.0.0",
"gulp-clean-css": "^3.3.1",
"gulp-eslint": "^3.0.1",
"gulp-sass-lint": "^1.3.2",
"gulp-cli": "^2.0.1",
"gulp-concat": "^2.5.2",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-eslint": "^3.0.1",
"gulp-extname": "^0.2.0",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^4.1.0",
"gulp-load-plugins": "^1.1.0",
"gulp-postcss": "^8.0.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-sass": "^4.0.1",
"gulp-sass-lint": "^1.3.2",
"gulp-sourcemaps": "^2.6.4",
"gulp-uglify": "^3.0.1",
"js-yaml": "^3.4.6",
"mocha": "^5",
"mocha-headless-chrome": "^2",
"mocha-lcov-reporter": "^1",
"nyc": "^13",
"panini": "^1.3.0",
"path": "^0.12.7",
"rimraf": "^2.4.3",
"sass-lint": "^1.12.1",
"sass-true": "^2.2.2",
"semver": "^5.6.0",
"sinon": "^7",
"style-sherpa": "^1.0.0",
"uncss": "^0.16.2",
"version-updater": "git+https://gitlab.bjoernbartels.earth/devops/version-updater.git",
"vinyl-named": "^1.1.0",
"webpack": "^4.20.2",
"webpack-stream": "^5.1.1",
"yargs": "^12.0.2",
"chai": "^4",
"chai-jquery": "^2",
"mocha": "^5",
"mocha-headless-chrome": "^2",
"mocha-lcov-reporter": "^1",
"nyc": "^13",
"sinon": "^7",
"sass-true": "^2.2.2",
"sass-lint": "^1.12.1",
"eslint": "^5.8.0"
"yargs": "^12.0.2"
},
"browserify": {
"transform": [
......@@ -111,5 +120,11 @@
"report-dir": "./dist/coverage",
"instrument": true,
"sourceMap": true
},
"changelog": {
"file": "./CHANGELOG.md",
"page": "./src/pages/changelog.html",
"jira": "https://jira.bjoernbartels.earth/jira/browse/",
"verbose": true
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment