Launcher/.gitlab-ci.yml

90 lines
2.4 KiB
YAML
Raw Normal View History

2020-03-16 23:10:43 +03:00
image: gradle:jdk11
2019-05-14 15:11:55 +03:00
2019-09-19 23:30:43 +03:00
stages:
2019-10-19 19:46:04 +03:00
- build
- test
2020-03-16 23:10:43 +03:00
- deploy
2020-03-16 23:46:38 +03:00
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
2019-05-14 15:11:55 +03:00
2020-03-16 23:10:43 +03:00
before_script:
- apt-get -y update
- 'which zip || ( apt-get -y install zip )'
- 'which git || ( apt-get -y install git )'
- export GRADLE_USER_HOME=`pwd`/.gradle
- chmod +x gradlew
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | base64 -d | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- git submodule sync
2020-03-16 23:46:38 +03:00
- mv modules modules_cache || true
- git submodule update --init --recursive --force
- cp -a modules_cache/* modules/ || true
2019-05-14 15:11:55 +03:00
build:
stage: build
script:
2020-03-16 23:46:38 +03:00
- gradle assemble
2019-09-19 23:30:43 +03:00
after_script:
2019-10-19 19:46:04 +03:00
- mkdir -p artifacts/modules
- cd LaunchServer/build/libs/
- zip -r -9 ../../../artifacts/libraries.zip * -x "LaunchServer.jar" -x "LaunchServer-clean.jar"
2020-03-16 23:10:43 +03:00
- cp LaunchServer.jar ../../../artifacts/LaunchServer.jar
2019-10-19 19:46:04 +03:00
- cd ../../../ServerWrapper/build/libs
2020-03-16 23:10:43 +03:00
- cp ServerWrapper.jar ../../../artifacts/ServerWrapper.jar
2019-12-23 07:13:50 +03:00
- cd ../../../LauncherAuthlib/build/libs
2020-03-16 23:10:43 +03:00
- cp LauncherAuthlib.jar ../../../artifacts/LauncherAuthlib.jar
2019-10-19 19:46:04 +03:00
- cd ../../../
2020-03-16 23:10:43 +03:00
- cp modules/*_module/build/libs/*.jar artifacts/modules
- cp modules/*_swmodule/build/libs/*.jar artifacts/modules
- cp modules/*_lmodule/build/libs/*.jar artifacts/modules
2019-09-19 23:30:43 +03:00
cache:
2020-03-17 01:15:46 +03:00
key: "$CI_COMMIT_REF_NAME"
2019-09-19 23:30:43 +03:00
paths:
2019-10-19 19:46:04 +03:00
- .gradle
2020-03-16 23:46:38 +03:00
- LaunchServer/build
- Launcher/build
- LauncherCore/build
- LauncherAPI/build
- LauncherAuthlib/build
- modules/*_*module/build
2019-05-14 15:11:55 +03:00
artifacts:
2019-09-19 23:30:43 +03:00
expire_in: 6 week
2019-05-14 15:11:55 +03:00
paths:
2019-10-19 19:46:04 +03:00
- artifacts
test:
stage: test
script:
2020-03-16 23:46:38 +03:00
- gradle check
cache:
2020-03-17 01:15:46 +03:00
key: "$CI_COMMIT_REF_NAME"
policy: pull
2020-03-16 23:46:38 +03:00
paths:
- .gradle
- LaunchServer/build
- Launcher/build
- LauncherCore/build
- LauncherAPI/build
- LauncherAuthlib/build
- modules/*_*module/build
2020-03-16 23:10:43 +03:00
deploy-demo:
stage: deploy
2020-03-17 01:32:30 +03:00
only: [dev]
2020-03-16 23:10:43 +03:00
script:
2020-03-16 23:46:38 +03:00
- gradle build
- eval $(ssh $SSH_USER@$SSH_HOST 'cd $SSH_DIR && cat deploy.sh')
cache:
2020-03-17 01:15:46 +03:00
key: "$CI_COMMIT_REF_NAME"
policy: pull
2020-03-16 23:46:38 +03:00
paths:
- .gradle
- LaunchServer/build
- Launcher/build
- LauncherCore/build
- LauncherAPI/build
- LauncherAuthlib/build
- modules/*_*module/build