From 84fb2f94183986924722a83a6721f9aff213a036 Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Mon, 6 Mar 2023 15:30:59 +0900 Subject: [PATCH 01/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..27d0710 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,41 @@ +# You can copy and paste this template into a new `.gitlab-ci.yml` file. +# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword. +# To contribute improvements to CI/CD templates, please follow the Development guide at: +# https://docs.gitlab.com/ee/development/cicd/templates.html +# This specific template is located at: +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Gradle.gitlab-ci.yml + +# This is the Gradle build system for JVM applications +# https://gradle.org/ +# https://github.com/gradle/gradle + +image: gradle:alpine + +before_script: + - GRADLE_USER_HOME="$(pwd)/.gradle" + - export GRADLE_USER_HOME + +build: + stage: build + script: gradle --build-cache assemble + cache: + key: "$CI_COMMIT_REF_NAME" + policy: push + paths: + - build + - .gradle + +test: + stage: test + script: gradle check + cache: + key: "$CI_COMMIT_REF_NAME" + policy: pull + paths: + - build + - .gradle + +deploy: + stage: deploy + script: echo "Define your deployment script!" + environment: production \ No newline at end of file -- GitLab From adb723335045badbc869a6183823206017859758 Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Mon, 6 Mar 2023 15:34:06 +0900 Subject: [PATCH 02/10] Use gitlab runner as amd64 --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 27d0710..1f26a63 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,8 @@ before_script: - export GRADLE_USER_HOME build: + tags: + - amd64 stage: build script: gradle --build-cache assemble cache: @@ -26,6 +28,8 @@ build: - .gradle test: + tags: + - amd64 stage: test script: gradle check cache: @@ -36,6 +40,8 @@ test: - .gradle deploy: + tags: + - amd64 stage: deploy script: echo "Define your deployment script!" environment: production \ No newline at end of file -- GitLab From a6e244f53434191a7d41ea105e9a1ab270201872 Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Mon, 6 Mar 2023 15:37:32 +0900 Subject: [PATCH 03/10] Change example to `to be continuous` --- .gitlab-ci.yml | 63 +++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 45 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1f26a63..2be09c8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,47 +1,20 @@ -# You can copy and paste this template into a new `.gitlab-ci.yml` file. -# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword. -# To contribute improvements to CI/CD templates, please follow the Development guide at: -# https://docs.gitlab.com/ee/development/cicd/templates.html -# This specific template is located at: -# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Gradle.gitlab-ci.yml +# included templates +include: + # Gradle template + - project: "to-be-continuous/gradle" + ref: "2.2" + file: "templates/gitlab-ci-gradle.yml" -# This is the Gradle build system for JVM applications -# https://gradle.org/ -# https://github.com/gradle/gradle -image: gradle:alpine - -before_script: - - GRADLE_USER_HOME="$(pwd)/.gradle" - - export GRADLE_USER_HOME - -build: - tags: - - amd64 - stage: build - script: gradle --build-cache assemble - cache: - key: "$CI_COMMIT_REF_NAME" - policy: push - paths: - - build - - .gradle - -test: - tags: - - amd64 - stage: test - script: gradle check - cache: - key: "$CI_COMMIT_REF_NAME" - policy: pull - paths: - - build - - .gradle - -deploy: - tags: - - amd64 - stage: deploy - script: echo "Define your deployment script!" - environment: production \ No newline at end of file +# your pipeline stages +stages: + - build + - test + - package-build + - package-test + - infra + - deploy + - acceptance + - publish + - infra-prod + - production \ No newline at end of file -- GitLab From a5895d283daa600779d688bc40517febb8ad25f7 Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Mon, 6 Mar 2023 16:13:05 +0900 Subject: [PATCH 04/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2be09c8..067be81 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,12 @@ include: file: "templates/gitlab-ci-gradle.yml" +# variables +variables: + GRADLE_NO_DEPENDENCY_CHECK: "true" + GRADLE_SBOM_DISABLED: "true" + + # your pipeline stages stages: - build -- GitLab From 36e6b754dd5f0d6d9afd2bfc4103f39e19cdc8ef Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Mon, 6 Mar 2023 16:46:54 +0900 Subject: [PATCH 05/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 067be81..ee929b6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,21 @@ -# included templates -include: - # Gradle template - - project: "to-be-continuous/gradle" - ref: "2.2" - file: "templates/gitlab-ci-gradle.yml" +image: jangrewe/gitlab-ci-android +stages: +- build -# variables -variables: - GRADLE_NO_DEPENDENCY_CHECK: "true" - GRADLE_SBOM_DISABLED: "true" +before_script: +- export GRADLE_USER_HOME=$(pwd)/.gradle +- chmod +x ./gradlew +cache: + key: ${CI_PROJECT_ID} + paths: + - .gradle/ -# your pipeline stages -stages: - - build - - test - - package-build - - package-test - - infra - - deploy - - acceptance - - publish - - infra-prod - - production \ No newline at end of file +build: + stage: build + script: + - ./gradlew assembleDebug + artifacts: + paths: + - app/build/outputs/apk/app-debug.apk \ No newline at end of file -- GitLab From e7d2eb421fd0d9f0516fa2a94d7a5e5673687079 Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Mon, 6 Mar 2023 16:57:19 +0900 Subject: [PATCH 06/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee929b6..e4031b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,4 +18,4 @@ build: - ./gradlew assembleDebug artifacts: paths: - - app/build/outputs/apk/app-debug.apk \ No newline at end of file + - ${CI_PROJECT_DIR}/app/build/outputs/apk/app-debug.apk \ No newline at end of file -- GitLab From cb701204e27d5bb4fa7ee13426c1a887f629b955 Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Wed, 8 Mar 2023 15:01:33 +0900 Subject: [PATCH 07/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 90 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e4031b3..5f3fa8a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,21 +1,87 @@ -image: jangrewe/gitlab-ci-android +# To contribute improvements to CI/CD templates, please follow the Development guide at: +# https://docs.gitlab.com/ee/development/cicd/templates.html +# This specific template is located at: +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Android.gitlab-ci.yml -stages: -- build +# Read more about this script on this blog post https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/, by Jason Lenny +# If you are interested in using Android with FastLane for publishing take a look at the Android-Fastlane template. +image: openjdk:11-jdk + +variables: + + # ANDROID_COMPILE_SDK is the version of Android you're compiling with. + # It should match compileSdkVersion. + ANDROID_COMPILE_SDK: "30" + + # ANDROID_BUILD_TOOLS is the version of the Android build tools you are using. + # It should match buildToolsVersion. + ANDROID_BUILD_TOOLS: "30.0.3" + + # It's what version of the command line tools we're going to download from the official site. + # Official Site-> https://developer.android.com/studio/index.html + # There, look down below at the cli tools only, sdk tools package is of format: + # commandlinetools-os_type-ANDROID_SDK_TOOLS_latest.zip + # when the script was last modified for latest compileSdkVersion, it was which is written down below + ANDROID_SDK_TOOLS: "7583922" + +# Packages installation before running script before_script: -- export GRADLE_USER_HOME=$(pwd)/.gradle -- chmod +x ./gradlew + - apt-get --quiet update --yes + - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 + + # Setup path as ANDROID_HOME for moving/exporting the downloaded sdk into it + - export ANDROID_HOME="${PWD}/android-home" + # Create a new directory at specified location + - install -d $ANDROID_HOME + # Here we are installing androidSDK tools from official source, + # (the key thing here is the url from where you are downloading these sdk tool for command line, so please do note this url pattern there and here as well) + # after that unzipping those tools and + # then running a series of SDK manager commands to install necessary android SDK packages that'll allow the app to build + - wget --output-document=$ANDROID_HOME/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip + # move to the archive at ANDROID_HOME + - pushd $ANDROID_HOME + - unzip -d cmdline-tools cmdline-tools.zip + - pushd cmdline-tools + # since commandline tools version 7583922 the root folder is named "cmdline-tools" so we rename it if necessary + - mv cmdline-tools tools || true + - popd + - popd + - export PATH=$PATH:${ANDROID_HOME}/cmdline-tools/tools/bin/ + + # Nothing fancy here, just checking sdkManager version + - sdkmanager --version -cache: - key: ${CI_PROJECT_ID} - paths: - - .gradle/ + # use yes to accept all licenses + - yes | sdkmanager --licenses || true + - sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" + - sdkmanager "platform-tools" + - sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" -build: + # Not necessary, but just for surity + - chmod +x ./gradlew + +# Basic android and gradle stuff +# Check linting +lintDebug: + interruptible: true + stage: build + script: + - ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint + +# Make Project +assembleDebug: + interruptible: true stage: build script: - - ./gradlew assembleDebug + - ./gradlew assembleDebug artifacts: paths: - - ${CI_PROJECT_DIR}/app/build/outputs/apk/app-debug.apk \ No newline at end of file + - app/build/outputs/ + +# Run all tests, if any fails, interrupt the pipeline(fail it) +debugTests: + interruptible: true + stage: test + script: + - ./gradlew -Pci --console=plain :app:testDebug \ No newline at end of file -- GitLab From e501d3d1d2b6160888fdf2fd3358c6fcf788faa0 Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Wed, 8 Mar 2023 15:16:39 +0900 Subject: [PATCH 08/10] Add gitlab runner tags amd64 --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5f3fa8a..cc4c39b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,6 +64,8 @@ before_script: # Basic android and gradle stuff # Check linting lintDebug: + tags: + - amd64 interruptible: true stage: build script: @@ -71,6 +73,8 @@ lintDebug: # Make Project assembleDebug: + tags: + - amd64 interruptible: true stage: build script: @@ -81,6 +85,8 @@ assembleDebug: # Run all tests, if any fails, interrupt the pipeline(fail it) debugTests: + tags: + - amd64 interruptible: true stage: test script: -- GitLab From 3e242725398ac9327bae9bb4128a75e7af70678e Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Wed, 8 Mar 2023 15:38:25 +0900 Subject: [PATCH 09/10] Update .gitlab-ci.yml file to jangrewe/gitlab-ci-android --- .gitlab-ci.yml | 96 +++++++------------------------------------------- 1 file changed, 12 insertions(+), 84 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc4c39b..4d64233 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,93 +1,21 @@ -# To contribute improvements to CI/CD templates, please follow the Development guide at: -# https://docs.gitlab.com/ee/development/cicd/templates.html -# This specific template is located at: -# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Android.gitlab-ci.yml +image: jangrewe/gitlab-ci-android -# Read more about this script on this blog post https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/, by Jason Lenny -# If you are interested in using Android with FastLane for publishing take a look at the Android-Fastlane template. +stages: +- build -image: openjdk:11-jdk - -variables: - - # ANDROID_COMPILE_SDK is the version of Android you're compiling with. - # It should match compileSdkVersion. - ANDROID_COMPILE_SDK: "30" - - # ANDROID_BUILD_TOOLS is the version of the Android build tools you are using. - # It should match buildToolsVersion. - ANDROID_BUILD_TOOLS: "30.0.3" - - # It's what version of the command line tools we're going to download from the official site. - # Official Site-> https://developer.android.com/studio/index.html - # There, look down below at the cli tools only, sdk tools package is of format: - # commandlinetools-os_type-ANDROID_SDK_TOOLS_latest.zip - # when the script was last modified for latest compileSdkVersion, it was which is written down below - ANDROID_SDK_TOOLS: "7583922" - -# Packages installation before running script before_script: - - apt-get --quiet update --yes - - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 - - # Setup path as ANDROID_HOME for moving/exporting the downloaded sdk into it - - export ANDROID_HOME="${PWD}/android-home" - # Create a new directory at specified location - - install -d $ANDROID_HOME - # Here we are installing androidSDK tools from official source, - # (the key thing here is the url from where you are downloading these sdk tool for command line, so please do note this url pattern there and here as well) - # after that unzipping those tools and - # then running a series of SDK manager commands to install necessary android SDK packages that'll allow the app to build - - wget --output-document=$ANDROID_HOME/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip - # move to the archive at ANDROID_HOME - - pushd $ANDROID_HOME - - unzip -d cmdline-tools cmdline-tools.zip - - pushd cmdline-tools - # since commandline tools version 7583922 the root folder is named "cmdline-tools" so we rename it if necessary - - mv cmdline-tools tools || true - - popd - - popd - - export PATH=$PATH:${ANDROID_HOME}/cmdline-tools/tools/bin/ - - # Nothing fancy here, just checking sdkManager version - - sdkmanager --version +- export GRADLE_USER_HOME=$(pwd)/.gradle +- chmod +x ./gradlew - # use yes to accept all licenses - - yes | sdkmanager --licenses || true - - sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" - - sdkmanager "platform-tools" - - sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" +cache: + key: ${CI_PROJECT_ID} + paths: + - .gradle/ - # Not necessary, but just for surity - - chmod +x ./gradlew - -# Basic android and gradle stuff -# Check linting -lintDebug: - tags: - - amd64 - interruptible: true - stage: build - script: - - ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint - -# Make Project -assembleDebug: - tags: - - amd64 - interruptible: true +build: stage: build script: - - ./gradlew assembleDebug + - ./gradlew assembleDebug artifacts: paths: - - app/build/outputs/ - -# Run all tests, if any fails, interrupt the pipeline(fail it) -debugTests: - tags: - - amd64 - interruptible: true - stage: test - script: - - ./gradlew -Pci --console=plain :app:testDebug \ No newline at end of file + - app/build/outputs/ \ No newline at end of file -- GitLab From eafc887718539335bbe04361f09b00c74cea83b0 Mon Sep 17 00:00:00 2001 From: blackheaven <22-blackheaven@biblio19.net> Date: Wed, 8 Mar 2023 20:45:31 +0900 Subject: [PATCH 10/10] Use amd64 --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d64233..389dc6b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,6 +13,8 @@ cache: - .gradle/ build: + tags: + - amd64 stage: build script: - ./gradlew assembleDebug -- GitLab