-
Nils Mittler authored
This reverts commit 9824887c.
42ccd0a6
This GitLab CI configuration is valid.
Learn more
Forked from an inaccessible project.
variables:
BUILD_DIR: dist
stages:
- test
- codestyle
- build
- deploy
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
eslint:
stage: codestyle
tags:
- nodejs
allow_failure: true
dependencies: []
script:
- npm install
- node_modules/eslint/bin/eslint.js -c .eslintrc.json --ext .ts ./src
unit_tests:
stage: test
tags:
- nodejs
allow_failure: false
dependencies: []
artifacts:
paths:
- coverage
script:
- npm i
- npm test
sonar:
stage: codestyle
only:
- staging
tags:
- sonar-cli
allow_failure: true
dependencies:
- unit_tests
script:
- npm i
- sonar-scanner -Dsonar.login=$SONAR_TOKEN -Dsonar.host.url=https://scm.thm.de/sonar/
ngbuild:
stage: build
tags:
- angular
allow_failure: false
dependencies: []
script:
- npm install -g @angular/cli
- npm install
- ng build --prod --aot
artifacts:
paths:
- "$BUILD_DIR"
deploy_staging:
stage: deploy
only:
- staging
tags:
- ssh
dependencies:
- eslint
- ngbuild
script:
- eval $(ssh-agent -s)
- mkdir ~/.ssh
- ssh-keyscan "$STAGING_SERVER_URL" >> ~/.ssh/known_hosts
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- scp -r "$BUILD_DIR"* "$STAGING_SSH_URL"
deploy_production:
stage: deploy
only:
- master
tags:
- ssh
dependencies:
- eslint
- ngbuild
script:
- eval $(ssh-agent -s)
- mkdir ~/.ssh
- ssh-keyscan "$SERVER_URL" >> ~/.ssh/known_hosts
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- scp -r "$BUILD_DIR"* "$SSH_URL"