OpenMediaCenter/.gitlab-ci.yml

97 lines
2.1 KiB
YAML
Raw Normal View History

2020-12-22 16:41:54 +00:00
image: node:latest
2020-06-09 15:49:41 +00:00
stages:
- build
2020-06-20 08:02:03 +00:00
- test
- packaging
- deploy
2020-06-09 15:49:41 +00:00
2020-12-22 16:41:54 +00:00
# Cache modules in between jobs
2020-06-09 15:49:41 +00:00
cache:
2020-12-22 16:41:54 +00:00
key: ${CI_COMMIT_REF_SLUG}
2020-06-09 15:49:41 +00:00
paths:
2020-12-22 16:41:54 +00:00
- .npm/
before_script:
- npm ci --cache .npm --prefer-offline
2020-06-29 19:20:14 +00:00
include:
- template: Code-Quality.gitlab-ci.yml
2020-06-09 15:49:41 +00:00
variables:
SAST_DISABLE_DIND: "true"
Minimize:
2020-06-20 08:02:03 +00:00
stage: build
script:
- npm run build
artifacts:
expire_in: 7 days
paths:
- build/
Frontend_Tests:
2020-06-09 15:49:41 +00:00
stage: test
script:
- npm run test
2020-06-09 19:54:52 +00:00
artifacts:
reports:
junit:
- ./junit.xml
2020-06-09 15:49:41 +00:00
2020-11-12 09:32:46 +00:00
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
2020-12-18 19:19:32 +00:00
needs: ["Minimize"]
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
2020-12-18 19:19:32 +00:00
needs: ["Minimize"]
Test_Server:
stage: deploy
image: luki42/alpineopenssh:latest
needs:
2020-12-18 19:19:32 +00:00
- Frontend_Tests
- Debian_Server
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