101 lines
2.2 KiB
YAML
101 lines
2.2 KiB
YAML
image: node:14
|
|
|
|
stages:
|
|
- prepare
|
|
- build
|
|
- test
|
|
- packaging
|
|
- deploy
|
|
|
|
cache:
|
|
key: "$CI_COMMIT_REF_SLUG" # use per branch caching
|
|
paths:
|
|
- node_modules/
|
|
|
|
include:
|
|
- template: Code-Quality.gitlab-ci.yml
|
|
|
|
variables:
|
|
SAST_DISABLE_DIND: "true"
|
|
|
|
Node_dependencies:
|
|
stage: prepare
|
|
script:
|
|
- npm install --progress=false
|
|
|
|
Minimize:
|
|
stage: build
|
|
script:
|
|
- npm run build
|
|
artifacts:
|
|
expire_in: 7 days
|
|
paths:
|
|
- build/
|
|
needs: ["prepare"]
|
|
|
|
Frontend_Tests:
|
|
stage: test
|
|
script:
|
|
- npm run test
|
|
artifacts:
|
|
reports:
|
|
junit:
|
|
- ./junit.xml
|
|
needs: ["prepare"]
|
|
|
|
code_quality:
|
|
tags:
|
|
- dind
|
|
|
|
Debian_Server:
|
|
stage: packaging
|
|
image: debian
|
|
script:
|
|
- vers=$(grep -Po '"version":.*?[^\\]",' package.json | grep -Po '[0-9]+\.[0-9]+\.[0-9]+') # parse the version out of package .json
|
|
- 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
|
|
- 'echo "Version: ${vers}" >> ./OpenMediaCenter/DEBIAN/control'
|
|
- chmod -R 0775 *
|
|
- dpkg-deb --build OpenMediaCenter
|
|
- mv OpenMediaCenter.deb OpenMediaCenter-${vers}_amd64.deb
|
|
artifacts:
|
|
paths:
|
|
- deb/OpenMediaCenter-*.deb
|
|
needs: ["build"]
|
|
|
|
Electron_Client:
|
|
stage: packaging
|
|
image: electronuserland/builder:wine
|
|
script:
|
|
- npm run buildlinux
|
|
- npm run buildwin
|
|
artifacts:
|
|
expire_in: 2 days
|
|
paths:
|
|
- dist/*.rpm
|
|
- dist/*.deb
|
|
- dist/*.exe
|
|
needs: ["build"]
|
|
|
|
Test_Server:
|
|
stage: deploy
|
|
image: luki42/alpineopenssh:latest
|
|
needs:
|
|
- test
|
|
- package_debian
|
|
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'
|
|
- scp deb/OpenMediaCenter-*.deb root@192.168.0.42:/tmp/
|
|
- ssh root@192.168.0.42 "DEBIAN_FRONTEND=noninteractive apt-get --reinstall -y -qq install /tmp/OpenMediaCenter-*.deb && rm /tmp/OpenMediaCenter-*.deb"
|
|
allow_failure: true
|
|
|