2020-06-09 15:49:41 +00:00
|
|
|
image: node:latest
|
|
|
|
|
|
|
|
stages:
|
2020-06-20 08:02:03 +00:00
|
|
|
- prepare
|
2020-06-09 15:49:41 +00:00
|
|
|
- build
|
2020-06-20 08:02:03 +00:00
|
|
|
- test
|
2020-10-03 20:28:19 +00:00
|
|
|
- packaging
|
2020-08-05 17:55:51 +00:00
|
|
|
- deploy
|
2020-06-09 15:49:41 +00:00
|
|
|
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- node_modules/
|
2020-06-29 19:54:04 +00:00
|
|
|
|
2020-06-29 19:20:14 +00:00
|
|
|
include:
|
2020-08-05 17:55:51 +00:00
|
|
|
- template: Code-Quality.gitlab-ci.yml
|
2020-06-09 15:49:41 +00:00
|
|
|
|
2020-06-29 19:54:04 +00:00
|
|
|
variables:
|
|
|
|
SAST_DISABLE_DIND: "true"
|
|
|
|
|
2020-06-20 08:02:03 +00:00
|
|
|
prepare:
|
|
|
|
stage: prepare
|
|
|
|
script:
|
|
|
|
- npm install --progress=false
|
2020-10-19 21:12:07 +00:00
|
|
|
- npm update --progress=false
|
2020-06-20 08:02:03 +00:00
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
script:
|
|
|
|
- npm run build
|
|
|
|
artifacts:
|
|
|
|
expire_in: 7 days
|
|
|
|
paths:
|
|
|
|
- build/
|
2020-08-05 17:55:51 +00:00
|
|
|
needs: ["prepare"]
|
2020-06-20 08:02:03 +00:00
|
|
|
|
2020-06-09 15:49:41 +00:00
|
|
|
test:
|
|
|
|
stage: test
|
|
|
|
script:
|
2020-06-09 19:54:52 +00:00
|
|
|
- CI=true npm run test
|
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
junit:
|
|
|
|
- ./junit.xml
|
2020-08-05 17:55:51 +00:00
|
|
|
needs: ["prepare"]
|
2020-06-09 15:49:41 +00:00
|
|
|
|
2020-06-09 18:10:26 +00:00
|
|
|
coverage:
|
2020-06-20 08:02:03 +00:00
|
|
|
stage: test
|
2020-06-09 18:10:26 +00:00
|
|
|
script:
|
2020-06-09 19:54:52 +00:00
|
|
|
- CI=true npm run coverage
|
2020-06-09 18:10:26 +00:00
|
|
|
artifacts:
|
|
|
|
reports:
|
2020-06-09 19:54:52 +00:00
|
|
|
cobertura:
|
|
|
|
- ./coverage/cobertura-coverage.xml
|
2020-08-05 17:55:51 +00:00
|
|
|
needs: ["prepare"]
|
|
|
|
|
2020-10-03 20:28:19 +00:00
|
|
|
package_debian:
|
|
|
|
stage: packaging
|
|
|
|
image: debian
|
|
|
|
script:
|
|
|
|
- cd deb
|
|
|
|
- mkdir -p "./OpenMediaCenter/var/www/openmediacenter/videos/"
|
|
|
|
- mkdir -p "./OpenMediaCenter/tmp/"
|
|
|
|
- cp -r ../build/* ./OpenMediaCenter/var/www/openmediacenter/
|
|
|
|
- cp -r ../api ./OpenMediaCenter/var/www/openmediacenter/
|
|
|
|
- cp ../database.sql ./OpenMediaCenter/tmp/openmediacenter.sql
|
|
|
|
- chmod -R 0775 *
|
|
|
|
- dpkg-deb --build OpenMediaCenter
|
|
|
|
- mv OpenMediaCenter.deb OpenMediaCenter-0.1_amd64.deb
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- deb/OpenMediaCenter-0.1_amd64.deb
|
|
|
|
needs: ["build"]
|
|
|
|
|
2020-08-05 17:55:51 +00:00
|
|
|
deploy_test1:
|
|
|
|
stage: deploy
|
|
|
|
image: luki42/alpineopenssh:latest
|
|
|
|
needs:
|
|
|
|
- test
|
|
|
|
- build
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
script:
|
|
|
|
- eval $(ssh-agent -s)
|
|
|
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
2020-08-05 20:10:14 +00:00
|
|
|
- scp -r build/* root@192.168.0.42:/var/www/html/
|
|
|
|
- scp -r api/ root@192.168.0.42:/var/www/html/
|
2020-08-05 17:55:51 +00:00
|
|
|
|