From 602a20325c6cff3ba3bde94105f5f31e13b44944 Mon Sep 17 00:00:00 2001 From: Gravit Date: Tue, 17 Mar 2020 03:10:43 +0700 Subject: [PATCH 1/4] [ANY] Try new gitlab ci --- .gitlab-ci.yml | 52 +++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b38f1740..4836650f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,41 +1,41 @@ -image: docker:latest -services: - - docker:dind - -variables: - DOCKER_DRIVER: overlay2 - CI_VERSION: '6.6.$CI_PIPELINE_IID' +image: gradle:jdk11 stages: - build - test + - deploy +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 + - git submodule update --init --recursive build: - image: gradle:jdk11 stage: build - before_script: - - apt-get -y update - - apt-get -y install zip git - - export GRADLE_USER_HOME=`pwd`/.gradle - - chmod +x gradlew - - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules - - git submodule sync - - git submodule update --init --recursive script: - ./gradlew assemble after_script: - mkdir -p artifacts/modules - cd LaunchServer/build/libs/ - zip -r -9 ../../../artifacts/libraries.zip * -x "LaunchServer.jar" -x "LaunchServer-clean.jar" - - mv LaunchServer.jar ../../../artifacts/LaunchServer.jar + - cp LaunchServer.jar ../../../artifacts/LaunchServer.jar - cd ../../../ServerWrapper/build/libs - - mv ServerWrapper.jar ../../../artifacts/ServerWrapper.jar + - cp ServerWrapper.jar ../../../artifacts/ServerWrapper.jar - cd ../../../LauncherAuthlib/build/libs - - mv LauncherAuthlib.jar ../../../artifacts/LauncherAuthlib.jar + - cp LauncherAuthlib.jar ../../../artifacts/LauncherAuthlib.jar - cd ../../../ - - mv modules/*_module/build/libs/*.jar artifacts/modules - - mv modules/*_swmodule/build/libs/*.jar artifacts/modules - - mv modules/*_lmodule/build/libs/*.jar artifacts/modules + - cp modules/*_module/build/libs/*.jar artifacts/modules + - cp modules/*_swmodule/build/libs/*.jar artifacts/modules + - cp modules/*_lmodule/build/libs/*.jar artifacts/modules cache: paths: - .gradle @@ -45,7 +45,11 @@ build: - artifacts test: - image: gradle:jdk11 stage: test script: - - ./gradlew check \ No newline at end of file + - ./gradlew check + +deploy-demo: + stage: deploy + script: + - ssh $SSH_USER@$SSH_HOST 'echo HELLO WORLD' \ No newline at end of file From 747e5fec0c6ca2960a9b77d465b24ab0bdae0179 Mon Sep 17 00:00:00 2001 From: Gravit Date: Tue, 17 Mar 2020 03:46:38 +0700 Subject: [PATCH 2/4] [ANY] Try new gitlab ci --- .gitlab-ci.yml | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4836650f..e4538f66 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,8 @@ stages: - build - test - deploy +variables: + GRADLE_OPTS: "-Dorg.gradle.daemon=false" before_script: - apt-get -y update @@ -18,11 +20,13 @@ before_script: - chmod 700 ~/.ssh - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config - git submodule sync - - git submodule update --init --recursive + - mv modules modules_cache || true + - git submodule update --init --recursive --force + - cp -a modules_cache/* modules/ || true build: stage: build script: - - ./gradlew assemble + - gradle assemble after_script: - mkdir -p artifacts/modules - cd LaunchServer/build/libs/ @@ -39,6 +43,12 @@ build: cache: paths: - .gradle + - LaunchServer/build + - Launcher/build + - LauncherCore/build + - LauncherAPI/build + - LauncherAuthlib/build + - modules/*_*module/build artifacts: expire_in: 6 week paths: @@ -47,9 +57,28 @@ build: test: stage: test script: - - ./gradlew check + - gradle check + cache: + paths: + - .gradle + - LaunchServer/build + - Launcher/build + - LauncherCore/build + - LauncherAPI/build + - LauncherAuthlib/build + - modules/*_*module/build deploy-demo: stage: deploy script: - - ssh $SSH_USER@$SSH_HOST 'echo HELLO WORLD' \ No newline at end of file + - gradle build + - eval $(ssh $SSH_USER@$SSH_HOST 'cd $SSH_DIR && cat deploy.sh') + cache: + paths: + - .gradle + - LaunchServer/build + - Launcher/build + - LauncherCore/build + - LauncherAPI/build + - LauncherAuthlib/build + - modules/*_*module/build \ No newline at end of file From dc97bbb74362d4342f832749028a3ebb5da9e2e9 Mon Sep 17 00:00:00 2001 From: Gravit Date: Tue, 17 Mar 2020 05:15:46 +0700 Subject: [PATCH 3/4] [ANY] Final gitlab ci --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e4538f66..95b726b1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,6 +41,7 @@ build: - cp modules/*_swmodule/build/libs/*.jar artifacts/modules - cp modules/*_lmodule/build/libs/*.jar artifacts/modules cache: + key: "$CI_COMMIT_REF_NAME" paths: - .gradle - LaunchServer/build @@ -59,6 +60,8 @@ test: script: - gradle check cache: + key: "$CI_COMMIT_REF_NAME" + policy: pull paths: - .gradle - LaunchServer/build @@ -74,6 +77,8 @@ deploy-demo: - gradle build - eval $(ssh $SSH_USER@$SSH_HOST 'cd $SSH_DIR && cat deploy.sh') cache: + key: "$CI_COMMIT_REF_NAME" + policy: pull paths: - .gradle - LaunchServer/build From c2154b8a7c6d8c7195e7c5b904be507c674645fb Mon Sep 17 00:00:00 2001 From: Gravit Date: Tue, 17 Mar 2020 05:32:30 +0700 Subject: [PATCH 4/4] [ANY] Final gitlab CI --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 95b726b1..794e62e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -73,6 +73,7 @@ test: deploy-demo: stage: deploy + only: [dev] script: - gradle build - eval $(ssh $SSH_USER@$SSH_HOST 'cd $SSH_DIR && cat deploy.sh')