2020-12-22 17:55:45 +00:00
|
|
|
image: node:14
|
2020-06-09 15:49:41 +00:00
|
|
|
|
|
|
|
stages:
|
|
|
|
- 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
|
|
|
|
2021-02-23 16:01:29 +00:00
|
|
|
Minimize_Frontend:
|
|
|
|
stage: build
|
|
|
|
before_script:
|
|
|
|
- yarn install --cache-folder .yarn
|
2020-12-22 17:55:45 +00:00
|
|
|
script:
|
2021-02-23 16:01:29 +00:00
|
|
|
- yarn run build
|
2021-03-22 19:07:32 +00:00
|
|
|
- rm build/*/*/*.map
|
2021-02-23 16:01:29 +00:00
|
|
|
artifacts:
|
|
|
|
expire_in: 2 days
|
|
|
|
paths:
|
|
|
|
- build/
|
|
|
|
cache:
|
|
|
|
key: ${CI_COMMIT_REF_SLUG}
|
|
|
|
paths:
|
|
|
|
- .yarn/
|
|
|
|
- node_modules/
|
2020-12-22 17:55:45 +00:00
|
|
|
|
2021-02-23 16:01:29 +00:00
|
|
|
Build_Backend:
|
|
|
|
image: golang:latest
|
2020-06-20 08:02:03 +00:00
|
|
|
stage: build
|
|
|
|
script:
|
2021-02-23 16:01:29 +00:00
|
|
|
- cd apiGo
|
|
|
|
- go build -v -o openmediacenter
|
|
|
|
- env GOOS=windows GOARCH=amd64 go build -v -o openmediacenter.exe
|
2020-06-20 08:02:03 +00:00
|
|
|
artifacts:
|
2021-02-23 16:01:29 +00:00
|
|
|
expire_in: 2 days
|
2020-06-20 08:02:03 +00:00
|
|
|
paths:
|
2021-02-23 16:01:29 +00:00
|
|
|
- "./apiGo/openmediacenter*"
|
2020-06-20 08:02:03 +00:00
|
|
|
|
2020-12-18 18:55:47 +00:00
|
|
|
Frontend_Tests:
|
2020-06-09 15:49:41 +00:00
|
|
|
stage: test
|
2021-02-23 16:01:29 +00:00
|
|
|
before_script:
|
|
|
|
- yarn install --cache-folder .yarn
|
2020-06-09 15:49:41 +00:00
|
|
|
script:
|
2021-02-23 16:01:29 +00:00
|
|
|
- yarn run test
|
2020-06-09 19:54:52 +00:00
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
junit:
|
|
|
|
- ./junit.xml
|
2021-02-23 16:01:29 +00:00
|
|
|
cache:
|
|
|
|
key: ${CI_COMMIT_REF_SLUG}
|
|
|
|
paths:
|
|
|
|
- .yarn/
|
|
|
|
- node_modules/
|
|
|
|
|
|
|
|
Backend_Tests:
|
|
|
|
image: golang:latest
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- cd apiGo
|
|
|
|
- go get -u github.com/jstemmer/go-junit-report
|
|
|
|
- go test -v ./... 2>&1 | go-junit-report -set-exit-code > report.xml
|
|
|
|
artifacts:
|
|
|
|
when: always
|
|
|
|
reports:
|
|
|
|
junit: ./apiGo/report.xml
|
2020-06-09 15:49:41 +00:00
|
|
|
|
2021-03-14 14:51:53 +00:00
|
|
|
lint:
|
|
|
|
stage: test
|
|
|
|
before_script:
|
|
|
|
- yarn install --cache-folder .yarn
|
|
|
|
script:
|
|
|
|
- yarn run lint
|
|
|
|
cache:
|
|
|
|
key: ${CI_COMMIT_REF_SLUG}
|
|
|
|
paths:
|
|
|
|
- .yarn/
|
|
|
|
- ./node_modules/
|
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
codequality: gl-codequality.json
|
|
|
|
needs: []
|
2020-11-12 09:32:46 +00:00
|
|
|
|
2020-12-18 18:55:47 +00:00
|
|
|
Debian_Server:
|
2020-10-03 20:28:19 +00:00
|
|
|
stage: packaging
|
|
|
|
image: debian
|
|
|
|
script:
|
2020-11-13 22:52:38 +00:00
|
|
|
- vers=$(grep -Po '"version":.*?[^\\]",' package.json | grep -Po '[0-9]+\.[0-9]+\.[0-9]+') # parse the version out of package .json
|
2020-10-03 20:28:19 +00:00
|
|
|
- cd deb
|
|
|
|
- mkdir -p "./OpenMediaCenter/var/www/openmediacenter/videos/"
|
|
|
|
- mkdir -p "./OpenMediaCenter/tmp/"
|
2021-02-23 16:01:29 +00:00
|
|
|
- mkdir -p "./OpenMediaCenter/usr/bin/"
|
2020-10-03 20:28:19 +00:00
|
|
|
- cp -r ../build/* ./OpenMediaCenter/var/www/openmediacenter/
|
2021-02-23 16:01:29 +00:00
|
|
|
- cp ../apiGo/openmediacenter ./OpenMediaCenter/usr/bin/
|
2020-10-03 20:28:19 +00:00
|
|
|
- cp ../database.sql ./OpenMediaCenter/tmp/openmediacenter.sql
|
2020-11-13 22:52:38 +00:00
|
|
|
- 'echo "Version: ${vers}" >> ./OpenMediaCenter/DEBIAN/control'
|
2020-10-03 20:28:19 +00:00
|
|
|
- chmod -R 0775 *
|
|
|
|
- dpkg-deb --build OpenMediaCenter
|
2020-11-13 22:52:38 +00:00
|
|
|
- mv OpenMediaCenter.deb OpenMediaCenter-${vers}_amd64.deb
|
2020-10-03 20:28:19 +00:00
|
|
|
artifacts:
|
2021-02-23 16:01:29 +00:00
|
|
|
expire_in: 7 days
|
2020-10-03 20:28:19 +00:00
|
|
|
paths:
|
2020-11-13 22:52:38 +00:00
|
|
|
- deb/OpenMediaCenter-*.deb
|
2021-02-23 16:01:29 +00:00
|
|
|
needs:
|
|
|
|
- Minimize_Frontend
|
|
|
|
- Build_Backend
|
2020-10-03 20:28:19 +00:00
|
|
|
|
2020-12-18 18:55:47 +00:00
|
|
|
Test_Server:
|
2020-08-05 17:55:51 +00:00
|
|
|
stage: deploy
|
|
|
|
image: luki42/alpineopenssh:latest
|
|
|
|
needs:
|
2020-12-18 19:19:32 +00:00
|
|
|
- Frontend_Tests
|
2021-02-23 16:01:29 +00:00
|
|
|
- Backend_Tests
|
2020-12-18 19:19:32 +00:00
|
|
|
- Debian_Server
|
2020-08-05 17:55:51 +00:00
|
|
|
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-10-22 17:36:29 +00:00
|
|
|
- scp deb/OpenMediaCenter-*.deb root@192.168.0.42:/tmp/
|
2020-10-22 18:06:37 +00:00
|
|
|
- ssh root@192.168.0.42 "DEBIAN_FRONTEND=noninteractive apt-get --reinstall -y -qq install /tmp/OpenMediaCenter-*.deb && rm /tmp/OpenMediaCenter-*.deb"
|
2020-10-27 11:48:26 +00:00
|
|
|
allow_failure: true
|
2020-08-05 17:55:51 +00:00
|
|
|
|