From 148ec215fb37bbe285f49772de8d761677d5a36c Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 14 Jul 2023 17:28:00 +0000 Subject: [PATCH 01/50] Update .gitlab-ci.yml file for test purpose. --- .gitlab-ci.yml | 158 ++----------------------------------------------- 1 file changed, 6 insertions(+), 152 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7af9add3..6c193d434 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,31 +3,21 @@ image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-au variables: SENTRY_DSN: $SENTRY_DSN -stages: - - debug - - release - - publish - before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew # Debug build related jobs -buildDebug: - stage: debug - script: - - ./gradlew assembleDebug - artifacts: - paths: - - app/build/outputs/apk/debug/ test: - stage: release + stage: test rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: always script: - - ./gradlew test -PtestAccountName="$testAccountName" -PtestAccountPwd="$testAccountPwd" -PtestServerUrl="$testServerUrl" + - echo "Test run Started!" + - ./gradlew test --stacktrace -PtestAccountName="$testAccountName" -PtestAccountPwd="$testAccountPwd" -PtestServerUrl="$testServerUrl" + - echo "Test running ended!" artifacts: when: always paths: @@ -35,141 +25,5 @@ test: - app/build/reports/tests/* reports: junit: app/build/test-results/*/TEST-*.xml - -# Default lint configuration for debug builds -# Manual as we don't want to run them generally for debug builds -.lintDebugDefault: - stage: debug - when: manual - allow_failure: true - -lintDebug: - extends: .lintDebugDefault - script: - - ./gradlew lintDebug - artifacts: - paths: - - app/build/reports/ - -ktlintDebug: - extends: .lintDebugDefault - script: - - ./gradlew app:ktlintCheck --info - artifacts: - paths: - - app/build/reports/ktlint/ - -# Release build related jobs - -# Default configuration for release builds -# Only on "master", "merge_request_event" and protected branches -buildRelease: - stage: release - allow_failure: false - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: always - - if: '$CI_COMMIT_REF_PROTECTED == "true"' - when: always - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - when: always - - if: '$CI_COMMIT_TAG !~ "/^$/"' - when: always - script: - - ./gradlew assembleRelease - artifacts: - paths: - - app/build/outputs/apk/release/ - -# Release jobs to generate signed artifacts -.releaseSigned: - stage: release - allow_failure: false - before_script: - - export GRADLE_USER_HOME=$(pwd)/.gradle - - chmod +x ./gradlew - - echo "${KEYSTORE}" | base64 -d > keystore/proprietary.keystore - rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - when: always - - if: '$CI_COMMIT_REF_PROTECTED == "true"' - when: always - -buildReleaseDev: - extends: .releaseSigned - script: - - ./gradlew assembleReleaseDev - artifacts: - paths: - - app/build/outputs/apk/releaseDev/ - -buildReleaseStable: - extends: .releaseSigned - script: - - ./gradlew assembleReleaseStable - artifacts: - paths: - - app/build/outputs/apk/releaseStable/ - -# Default lint configuration for release jobs -.lintReleaseDefault: - stage: release - when: always - allow_failure: false - -lintRelease: - extends: .lintReleaseDefault - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: always - script: - - ./gradlew lintRelease - artifacts: - paths: - - app/build/reports/ - -ktlintRelease: - extends: .lintReleaseDefault - script: - - ./gradlew app:ktlintCheck --info - artifacts: - paths: - - app/build/reports/ktlint/ - - -pushToPrebuilt: - stage: publish - needs: ["buildRelease"] - rules: - - if: '$CI_COMMIT_TAG !~ "/^$/"' - when: manual - - when: never - variables: - NEW_APK_PATH: "app/build/outputs/apk/release/" - before_script: - - 'which ssh-agent || ( apt update -y && apt install openssh-client -y )' - - eval $(ssh-agent -s) - - echo "$SSH_E_ROBOT_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - - chmod 644 ~/.ssh/known_hosts - - git config --global user.email "gitlab@e.foundation" - - git config --global user.name "gitlab" - script: - - NEW_APK_NAME=$(basename ${NEW_APK_PATH}*-release.apk) - - NEW_APK_VERSION=$(awk -F '-' '{print $2}' <<< "$NEW_APK_NAME") - - echo $NEW_APK_NAME - - echo $NEW_APK_VERSION - - git lfs clone git@gitlab.e.foundation:e/os/android_prebuilts_prebuiltapks_lfs.git - - cd android_prebuilts_prebuiltapks_lfs - - rm Apps/*-release.apk - - mv ../${NEW_APK_PATH}/${NEW_APK_NAME} Apps/ - # todo: improve to replace sed command, by a new one based on REGEXP (instead of using line number) - - sed -i "6s/.*/LOCAL_SRC_FILES := ${NEW_APK_NAME}/" Apps/Android.mk - - git add Apps - - git status - - git commit -m "App Lounge - ${NEW_APK_VERSION}, ${CI_COMMIT_TAG}" -m "From ${CI_COMMIT_SHA}, pipeline ${CI_PIPELINE_ID}" - - git push - # Sometimes a single push doesn't do all the job, so we have to push twice - - git push +after_script: + - echo "after script is executed" \ No newline at end of file -- GitLab From 17d322078d250311cdf3d1c48bbef0a4f9b9e261 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 14 Jul 2023 18:38:50 +0000 Subject: [PATCH 02/50] Added workflow. --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c193d434..0c9e4059e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,13 @@ image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-au variables: SENTRY_DSN: $SENTRY_DSN +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS + when: never + - if: $CI_COMMIT_BRANCH + before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew -- GitLab From 419d7c3bfae8169ce9945b302668c1c2e781b56b Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sun, 16 Jul 2023 07:23:49 +0000 Subject: [PATCH 03/50] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0c9e4059e..31c77e1d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,13 +3,6 @@ image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-au variables: SENTRY_DSN: $SENTRY_DSN -workflow: - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS - when: never - - if: $CI_COMMIT_BRANCH - before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew @@ -23,7 +16,7 @@ test: when: always script: - echo "Test run Started!" - - ./gradlew test --stacktrace -PtestAccountName="$testAccountName" -PtestAccountPwd="$testAccountPwd" -PtestServerUrl="$testServerUrl" + - ./gradlew test - echo "Test running ended!" artifacts: when: always -- GitLab From 7f5db1d6a10c39bcf084e44baefab2f0dca7dc9a Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sun, 16 Jul 2023 13:01:01 +0000 Subject: [PATCH 04/50] Update .gitlab-ci.yml file with dummy job. --- .gitlab-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 31c77e1d1..1f2626019 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,5 +25,17 @@ test: - app/build/reports/tests/* reports: junit: app/build/test-results/*/TEST-*.xml + +lint: + stage: build + script: + - ./gradlew lintRelease + +dummy: + only: + - /^.*555.*$/ + script: + - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" + after_script: - echo "after script is executed" \ No newline at end of file -- GitLab From be44fc9df8531d72f9d997f0b8f3364b3f80365d Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sun, 16 Jul 2023 13:15:08 +0000 Subject: [PATCH 05/50] cache added for pipeline --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1f2626019..399f64242 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,13 @@ before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew +cache: + key: ${CI_PROJECT_ID} + paths: + - .gradle/ + + + # Debug build related jobs test: -- GitLab From f4e590b200e60e600dd4a876374b6b9316f0aca0 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sun, 16 Jul 2023 13:22:30 +0000 Subject: [PATCH 06/50] disabled cache --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 399f64242..b8e7ba0a6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,10 +7,10 @@ before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew -cache: - key: ${CI_PROJECT_ID} - paths: - - .gradle/ +# cache: +# key: ${CI_PROJECT_ID} +# paths: +# - .gradle/ -- GitLab From ce686f8597b238fd786caba5b428df541a159e4f Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sun, 16 Jul 2023 13:25:43 +0000 Subject: [PATCH 07/50] filter removed from dummy job --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b8e7ba0a6..42be99fcf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,8 +39,6 @@ lint: - ./gradlew lintRelease dummy: - only: - - /^.*555.*$/ script: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" -- GitLab From 033e7469eae262dbb365d1af530f4fc782ac1ebe Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sun, 16 Jul 2023 13:36:21 +0000 Subject: [PATCH 08/50] dummy job updated --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 42be99fcf..c2cdbaffc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,8 +37,10 @@ lint: stage: build script: - ./gradlew lintRelease + - echo "lint fininshed" dummy: + stage: test script: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" -- GitLab From 3a138de03c770c71339867b07602d03b68a10535 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sun, 16 Jul 2023 14:08:53 +0000 Subject: [PATCH 09/50] only case added --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2cdbaffc..36ce0c1b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,6 +41,8 @@ lint: dummy: stage: test + only: + - /^.*ci_playground.*$/ script: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" -- GitLab From 7f62a11720e4ba3cc5e4f31c73cb888cce545ccd Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sun, 16 Jul 2023 14:16:13 +0000 Subject: [PATCH 10/50] job order is changed. --- .gitlab-ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36ce0c1b7..5741b1b5f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,13 @@ before_script: # Debug build related jobs +dummy: + stage: test + only: + - /^.*ci_playground.*$/ + script: + - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" + test: stage: test rules: @@ -39,12 +46,5 @@ lint: - ./gradlew lintRelease - echo "lint fininshed" -dummy: - stage: test - only: - - /^.*ci_playground.*$/ - script: - - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" - after_script: - echo "after script is executed" \ No newline at end of file -- GitLab From 8688c48cada2af65aa7efaeab6ab6b97c10c0435 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sun, 16 Jul 2023 14:41:22 +0000 Subject: [PATCH 11/50] caching is added again. --- .gitlab-ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5741b1b5f..c19cd2da7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,12 +7,11 @@ before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew -# cache: -# key: ${CI_PROJECT_ID} -# paths: -# - .gradle/ - +cache: + key: ${CI_PROJECT_ID} + paths: + - .gradle/ # Debug build related jobs -- GitLab From fc505af73908850578fb06f0ebd53c2fa4430007 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 12:14:38 +0000 Subject: [PATCH 12/50] 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 c19cd2da7..aac7b061d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ cache: dummy: stage: test only: - - /^.*ci_playground.*$/ + - /^.*playground.*$/ script: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" -- GitLab From 44cb70a18d59076a391cc2c888630abf478a4c2e Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 12:46:48 +0000 Subject: [PATCH 13/50] second dummy_job added --- .gitlab-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aac7b061d..d32d076a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,14 @@ dummy: script: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" +dummy_job: + stage: testJob + only: + variables: + - $CI_COMMIT_MESSAGE = /^.*dummy.*$/ + script: + - echo "second dummy job running $CI_COMMIT_MESSAGE" + test: stage: test rules: -- GitLab From f5625e42f24bc19bc464b9e95862d6d0f7a0c127 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 12:48:29 +0000 Subject: [PATCH 14/50] second dummy_job added --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d32d076a5..25a62d072 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,6 @@ dummy: dummy_job: stage: testJob only: - variables: - $CI_COMMIT_MESSAGE = /^.*dummy.*$/ script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From 9d6e6d3ca8df3b6e5da37302e46b2fe137b362cf Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 12:49:15 +0000 Subject: [PATCH 15/50] second dummy_job added --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 25a62d072..bcb05c954 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ dummy: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" dummy_job: - stage: testJob + stage: build only: - $CI_COMMIT_MESSAGE = /^.*dummy.*$/ script: -- GitLab From b10996085c5201a6be6465591cf4095dbfa1fff4 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 13:10:44 +0000 Subject: [PATCH 16/50] second dummy_job updated --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bcb05c954..86301a699 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,8 +24,8 @@ dummy: dummy_job: stage: build - only: - - $CI_COMMIT_MESSAGE = /^.*dummy.*$/ + rules: + - if: $CI_COMMIT_MESSAGE == /^.*dummy.*$/ script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From 2c06c1f974a90aaaeef900cc56d7e3647b15a51e Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 13:16:37 +0000 Subject: [PATCH 17/50] second dummy_job updated --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 86301a699..6142f511b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,8 +24,6 @@ dummy: dummy_job: stage: build - rules: - - if: $CI_COMMIT_MESSAGE == /^.*dummy.*$/ script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From fcb6f30b22780038679395779fd673fb97d81ce3 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 13:22:00 +0000 Subject: [PATCH 18/50] second dummy_job condition updated --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6142f511b..042245a55 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,13 +24,15 @@ dummy: dummy_job: stage: build + rules: + - if: $CI_COMMIT_MESSAGE =~ /^.*dummy_job.*$/ script: - echo "second dummy job running $CI_COMMIT_MESSAGE" test: stage: test rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_PIPELINE_SOURCE = "merge_request_event"' when: always script: - echo "Test run Started!" -- GitLab From c1292ce9173cb72736d70785afca9223e519c70b Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 13:22:24 +0000 Subject: [PATCH 19/50] second dummy_job condition fixed --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 042245a55..2b7f4f2e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ dummy: dummy_job: stage: build rules: - - if: $CI_COMMIT_MESSAGE =~ /^.*dummy_job.*$/ + - if: $CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/" script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From b6a52b0d59d0ae736a29be240ca61826f6d84c05 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 13:37:13 +0000 Subject: [PATCH 20/50] second dummy_job condition fixed --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b7f4f2e5..ed7a09a43 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ dummy: dummy_job: stage: build rules: - - if: $CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/" + - if: '$CI_COMMIT_MESSAGE =~ /^.*dummy_job.*$/' script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From 876dd7dc0665155ae61742e4a6ce1d45698fc75f Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 13:38:38 +0000 Subject: [PATCH 21/50] second dummy_job condition fixed --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed7a09a43..98041bbbf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,6 +26,7 @@ dummy_job: stage: build rules: - if: '$CI_COMMIT_MESSAGE =~ /^.*dummy_job.*$/' + when: always script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From 4d8e152a8f8b8d7cb222d86a16a28f8691271297 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 13:54:37 +0000 Subject: [PATCH 22/50] second dummy_job condition fixed --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98041bbbf..56f0cdadb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,6 +30,7 @@ dummy_job: script: - echo "second dummy job running $CI_COMMIT_MESSAGE" + test: stage: test rules: -- GitLab From 5c4cf3fcdde917394d73f0ad953f3a235e8d8eae Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 13:54:54 +0000 Subject: [PATCH 23/50] second dummy_job condition fixed --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 56f0cdadb..98041bbbf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,6 @@ dummy_job: script: - echo "second dummy job running $CI_COMMIT_MESSAGE" - test: stage: test rules: -- GitLab From 3f0e599bebec9ad0cef5ebe7df6e85052482a25f Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 14:18:53 +0000 Subject: [PATCH 24/50] second dummy_job condition fixed --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98041bbbf..8aae014a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ dummy: dummy_job: stage: build rules: - - if: '$CI_COMMIT_MESSAGE =~ /^.*dummy_job.*$/' + - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' when: always script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From 8f8c22f7acfa57edcb799cd06d7138963180b547 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 14:22:51 +0000 Subject: [PATCH 25/50] second dummy_job condition fixed --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8aae014a5..1287213c3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ dummy: dummy_job: stage: build rules: - - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' + - if: '$CI_COMMIT_MESSAGE == "/^.*dummy_job.*$/"' when: always script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From 5a60411e19036a5dca437a3e2e5bba3e0cf7f740 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 16:03:21 +0000 Subject: [PATCH 26/50] removed stage --- .gitlab-ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1287213c3..374367b88 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,10 +23,6 @@ dummy: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" dummy_job: - stage: build - rules: - - if: '$CI_COMMIT_MESSAGE == "/^.*dummy_job.*$/"' - when: always script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From 40a527cabd2043bf4f97801399b651a0edee4d64 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 16:03:50 +0000 Subject: [PATCH 27/50] added stage --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 374367b88..9af2f72b8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,6 +23,7 @@ dummy: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" dummy_job: + stage: build script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From 6ba987483a16cc537b052dfe1a6620c1c86b8129 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 16:07:05 +0000 Subject: [PATCH 28/50] 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 9af2f72b8..7f5185ad7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ dummy: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" dummy_job: - stage: build + stage: test script: - echo "second dummy job running $CI_COMMIT_MESSAGE" -- GitLab From dd12cf6782a2052e579e46377a84ec6e1efc0d31 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 16:10:31 +0000 Subject: [PATCH 29/50] removed dummy job --- .gitlab-ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7f5185ad7..15c8303f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,11 +22,6 @@ dummy: script: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" -dummy_job: - stage: test - script: - - echo "second dummy job running $CI_COMMIT_MESSAGE" - test: stage: test rules: -- GitLab From fb7221d1d2b7d1109268d087509bf269b79eb147 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 16:16:19 +0000 Subject: [PATCH 30/50] fixed syntax error --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15c8303f9..aac7b061d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ dummy: test: stage: test rules: - - if: '$CI_PIPELINE_SOURCE = "merge_request_event"' + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: always script: - echo "Test run Started!" -- GitLab From 87121bd44155d72e2dcdb04d881f1768cff7a4c3 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 16:17:39 +0000 Subject: [PATCH 31/50] added dummy_job --- .gitlab-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aac7b061d..b5fa9b2af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,15 @@ dummy: script: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" +dummy_job: + stage: build + rules: + - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' + when: always + script: + - echo "second dummy job running $CI_COMMIT_MESSAGE" + + test: stage: test rules: -- GitLab From 81c4dfa337122159b81bca06e5f954d05073f9e7 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 17:05:19 +0000 Subject: [PATCH 32/50] commit msg chngd. --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b5fa9b2af..b09a6f525 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,7 @@ dummy_job: when: always script: - echo "second dummy job running $CI_COMMIT_MESSAGE" + - echo "commit message changed $CI_COMMIT_MESSAGE" test: -- GitLab From 2f8c200f349671ea507390fe177e900c6b07963d Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 17:10:45 +0000 Subject: [PATCH 33/50] removed stage dummy_job from --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b09a6f525..ea02eb8d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,13 +23,11 @@ dummy: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" dummy_job: - stage: build rules: - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' when: always script: - echo "second dummy job running $CI_COMMIT_MESSAGE" - - echo "commit message changed $CI_COMMIT_MESSAGE" test: -- GitLab From dcc2b996ef57027687140fa07044d8de7de6e381 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 21 Jul 2023 17:26:15 +0000 Subject: [PATCH 34/50] order of dummy_job is changed --- .gitlab-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ea02eb8d3..7cbdba19a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,12 @@ dummy: script: - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" +lint: + stage: build + script: + - ./gradlew lintRelease + - echo "lint fininshed" + dummy_job: rules: - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' @@ -47,11 +53,5 @@ test: reports: junit: app/build/test-results/*/TEST-*.xml -lint: - stage: build - script: - - ./gradlew lintRelease - - echo "lint fininshed" - after_script: - echo "after script is executed" \ No newline at end of file -- GitLab From 8dc906954f6d9efaa3503e26d298446574a675ab Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 28 Jul 2023 11:12:45 +0000 Subject: [PATCH 35/50] Custom stage is added. --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7cbdba19a..db49f9bd6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,9 @@ image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-au variables: SENTRY_DSN: $SENTRY_DSN +stages: + - customStage + before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew @@ -29,6 +32,7 @@ lint: - echo "lint fininshed" dummy_job: + stage: customStage rules: - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' when: always -- GitLab From c767a337fb20815945e0285e30645e3fd88cf039 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 28 Jul 2023 11:14:49 +0000 Subject: [PATCH 36/50] fixed: Custom stage list --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index db49f9bd6..6b2068735 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,9 @@ variables: SENTRY_DSN: $SENTRY_DSN stages: - - customStage + - build + - test + - mycustomstage before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle @@ -32,7 +34,7 @@ lint: - echo "lint fininshed" dummy_job: - stage: customStage + stage: mycustomstage rules: - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' when: always -- GitLab From ca56538e2a31007cf6709edb0698640ef42a45a3 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 28 Jul 2023 13:07:15 +0000 Subject: [PATCH 37/50] $CI_PIPELINE_SOURCE is added in dummy_job echo --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6b2068735..db7354fa9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,11 +39,12 @@ dummy_job: - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' when: always script: - - echo "second dummy job running $CI_COMMIT_MESSAGE" + - echo "second dummy job running $CI_COMMIT_MESSAGE $CI_PIPELINE_SOURCE" test: stage: test + allow_failure: false rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: always -- GitLab From ce01880470e35af871869b698c4fb504dc77c5ac Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 28 Jul 2023 16:39:41 +0000 Subject: [PATCH 38/50] updated pipeline source logic, dummy job --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index db7354fa9..ecb923022 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,7 +46,7 @@ test: stage: test allow_failure: false rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_PIPELINE_SOURCE == "push"' when: always script: - echo "Test run Started!" -- GitLab From 10e0478fde642a1b30a961fe9978ffb434c460a9 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sat, 29 Jul 2023 01:44:09 +0000 Subject: [PATCH 39/50] branch name is added, dummy_job --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ecb923022..20f2aa440 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,7 +39,7 @@ dummy_job: - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' when: always script: - - echo "second dummy job running $CI_COMMIT_MESSAGE $CI_PIPELINE_SOURCE" + - echo "second dummy job running $CI_COMMIT_MESSAGE $CI_COMMIT_BRANCH $CI_PIPELINE_SOURCE" test: -- GitLab From a9dec7e20552f6fa00b6778de844282974b0d9cb Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 4 Aug 2023 12:54:00 +0000 Subject: [PATCH 40/50] dummy_job is turned into manual --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 20f2aa440..f63a65cd3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,7 +37,7 @@ dummy_job: stage: mycustomstage rules: - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' - when: always + when: manual script: - echo "second dummy job running $CI_COMMIT_MESSAGE $CI_COMMIT_BRANCH $CI_PIPELINE_SOURCE" -- GitLab From ed0fab1400604d15faf78790764840a00d9206c1 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 4 Aug 2023 14:35:18 +0000 Subject: [PATCH 41/50] dummy_job is, push prebuilt is added --- .gitlab-ci.yml | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f63a65cd3..310bb6d1b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,8 @@ stages: - build - test - mycustomstage + - release + - publish before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle @@ -60,5 +62,64 @@ test: reports: junit: app/build/test-results/*/TEST-*.xml +# Release build related jobs + +# Default configuration for release builds +# Only on "master", "merge_request_event" and protected branches +buildRelease: + stage: release + allow_failure: false + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: always + - if: '$CI_COMMIT_REF_PROTECTED == "true"' + when: always + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + when: always + - if: '$CI_COMMIT_TAG !~ "/^$/"' + when: always + script: + - ./gradlew assembleRelease + artifacts: + paths: + - app/build/outputs/apk/release/ + +pushToPrebuilt: + stage: publish + needs: ["buildRelease"] + rules: + - if: '$CI_COMMIT_TAG !~ "/^$/"' + when: manual + - when: never + variables: + NEW_APK_PATH: "app/build/outputs/apk/release/" + before_script: + - 'which ssh-agent || ( apt update -y && apt install openssh-client -y )' + - eval $(ssh-agent -s) + - echo "$SSH_E_ROBOT_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + - git config --global user.email "gitlab@e.foundation" + - git config --global user.name "gitlab" + script: + - NEW_APK_NAME=$(basename ${NEW_APK_PATH}*-release.apk) + - NEW_APK_VERSION=$(awk -F '-' '{print $2}' <<< "$NEW_APK_NAME") + - echo $NEW_APK_NAME + - echo $NEW_APK_VERSION + - git lfs clone git@gitlab.e.foundation:hasibprince/applounge_git_lfs.git + - cd applounge_git_lfs + - rm *-release.apk + - mv ../${NEW_APK_PATH}/${NEW_APK_NAME} / + # todo: improve to replace sed command, by a new one based on REGEXP (instead of using line number) + - sed -i "6s/.*/LOCAL_SRC_FILES := ${NEW_APK_NAME}/" Apps/Android.mk + - git add Apps + - git status + - git commit -m "App Lounge - ${NEW_APK_VERSION}, ${CI_COMMIT_TAG}" -m "From ${CI_COMMIT_SHA}, pipeline ${CI_PIPELINE_ID}" + - git push + # Sometimes a single push doesn't do all the job, so we have to push twice + - git push + after_script: - echo "after script is executed" \ No newline at end of file -- GitLab From 09d39ec656d829c6a562322f3a1084294f4cc582 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 4 Aug 2023 15:16:18 +0000 Subject: [PATCH 42/50] dummy_job, prebuilit rules are updated --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 310bb6d1b..40a801f20 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -88,7 +88,7 @@ pushToPrebuilt: stage: publish needs: ["buildRelease"] rules: - - if: '$CI_COMMIT_TAG !~ "/^$/"' + - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' when: manual - when: never variables: -- GitLab From b6dddd19a20606df782c72c97fa00ffb77256db5 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 4 Aug 2023 15:42:55 +0000 Subject: [PATCH 43/50] dummy_job, buildRelease rules are updated --- .gitlab-ci.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 40a801f20..916ce6e1c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -70,13 +70,7 @@ buildRelease: stage: release allow_failure: false rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: always - - if: '$CI_COMMIT_REF_PROTECTED == "true"' - when: always - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - when: always - - if: '$CI_COMMIT_TAG !~ "/^$/"' + - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' when: always script: - ./gradlew assembleRelease -- GitLab From 5954bf074d04b139b340061c991d7b4cc0dc3ab4 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 11 Aug 2023 17:06:12 +0000 Subject: [PATCH 44/50] dummy_job, removed an echo command --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 916ce6e1c..5b5967988 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -90,7 +90,6 @@ pushToPrebuilt: before_script: - 'which ssh-agent || ( apt update -y && apt install openssh-client -y )' - eval $(ssh-agent -s) - - echo "$SSH_E_ROBOT_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts -- GitLab From 4e2bde8e157ce6a1f81a7fd1f93e736ad5164fd7 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Thu, 14 Sep 2023 04:27:08 +0000 Subject: [PATCH 45/50] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 122 ++----------------------------------------------- 1 file changed, 4 insertions(+), 118 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b5967988..d15c06877 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,118 +1,4 @@ -image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-auto-release - -variables: - SENTRY_DSN: $SENTRY_DSN - -stages: - - build - - test - - mycustomstage - - release - - publish - -before_script: - - export GRADLE_USER_HOME=$(pwd)/.gradle - - chmod +x ./gradlew - - -cache: - key: ${CI_PROJECT_ID} - paths: - - .gradle/ - -# Debug build related jobs - -dummy: - stage: test - only: - - /^.*playground.*$/ - script: - - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" - -lint: - stage: build - script: - - ./gradlew lintRelease - - echo "lint fininshed" - -dummy_job: - stage: mycustomstage - rules: - - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' - when: manual - script: - - echo "second dummy job running $CI_COMMIT_MESSAGE $CI_COMMIT_BRANCH $CI_PIPELINE_SOURCE" - - -test: - stage: test - allow_failure: false - rules: - - if: '$CI_PIPELINE_SOURCE == "push"' - when: always - script: - - echo "Test run Started!" - - ./gradlew test - - echo "Test running ended!" - artifacts: - when: always - paths: - - app/build/test-results/*/TEST-*.xml - - app/build/reports/tests/* - reports: - junit: app/build/test-results/*/TEST-*.xml - -# Release build related jobs - -# Default configuration for release builds -# Only on "master", "merge_request_event" and protected branches -buildRelease: - stage: release - allow_failure: false - rules: - - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' - when: always - script: - - ./gradlew assembleRelease - artifacts: - paths: - - app/build/outputs/apk/release/ - -pushToPrebuilt: - stage: publish - needs: ["buildRelease"] - rules: - - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' - when: manual - - when: never - variables: - NEW_APK_PATH: "app/build/outputs/apk/release/" - before_script: - - 'which ssh-agent || ( apt update -y && apt install openssh-client -y )' - - eval $(ssh-agent -s) - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - - chmod 644 ~/.ssh/known_hosts - - git config --global user.email "gitlab@e.foundation" - - git config --global user.name "gitlab" - script: - - NEW_APK_NAME=$(basename ${NEW_APK_PATH}*-release.apk) - - NEW_APK_VERSION=$(awk -F '-' '{print $2}' <<< "$NEW_APK_NAME") - - echo $NEW_APK_NAME - - echo $NEW_APK_VERSION - - git lfs clone git@gitlab.e.foundation:hasibprince/applounge_git_lfs.git - - cd applounge_git_lfs - - rm *-release.apk - - mv ../${NEW_APK_PATH}/${NEW_APK_NAME} / - # todo: improve to replace sed command, by a new one based on REGEXP (instead of using line number) - - sed -i "6s/.*/LOCAL_SRC_FILES := ${NEW_APK_NAME}/" Apps/Android.mk - - git add Apps - - git status - - git commit -m "App Lounge - ${NEW_APK_VERSION}, ${CI_COMMIT_TAG}" -m "From ${CI_COMMIT_SHA}, pipeline ${CI_PIPELINE_ID}" - - git push - # Sometimes a single push doesn't do all the job, so we have to push twice - - git push - -after_script: - - echo "after script is executed" \ No newline at end of file +include: + - project: 'e/templates' + ref: gitlab-ci-apps + file: '/gitlab-ci/.ci-apps.yml' -- GitLab From 55bf43de7524983c5b50277865181f665cc3e308 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Thu, 14 Sep 2023 05:27:23 +0000 Subject: [PATCH 46/50] Updated stages --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d15c06877..d1dfbd09b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,10 @@ +stages: + - build + - test + - mycustomstage + - release + - publish + include: - project: 'e/templates' ref: gitlab-ci-apps -- GitLab From ead64a9abcfad821e995a687ae25b8008e3b658b Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Thu, 14 Sep 2023 06:16:40 +0000 Subject: [PATCH 47/50] reverted to old script --- .gitlab-ci.yml | 115 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 111 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d1dfbd09b..ee88e8791 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,8 @@ +image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-auto-release + +variables: + SENTRY_DSN: $SENTRY_DSN + stages: - build - test @@ -5,7 +10,109 @@ stages: - release - publish -include: - - project: 'e/templates' - ref: gitlab-ci-apps - file: '/gitlab-ci/.ci-apps.yml' +before_script: + - export GRADLE_USER_HOME=$(pwd)/.gradle + - chmod +x ./gradlew + + +cache: + key: ${CI_PROJECT_ID} + paths: + - .gradle/ + +# Debug build related jobs + +dummy: + stage: test + only: + - /^.*playground.*$/ + script: + - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" + +lint: + stage: build + script: + - ./gradlew lintRelease + - echo "lint fininshed" + +dummy_job: + stage: mycustomstage + rules: + - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' + when: manual + script: + - echo "second dummy job running $CI_COMMIT_MESSAGE $CI_COMMIT_BRANCH $CI_PIPELINE_SOURCE" + + +test: + stage: test + allow_failure: false + rules: + - if: '$CI_PIPELINE_SOURCE == "push"' + when: always + script: + - echo "Test run Started!" + - ./gradlew test + - echo "Test running ended!" + artifacts: + when: always + paths: + - app/build/test-results/*/TEST-*.xml + - app/build/reports/tests/* + reports: + junit: app/build/test-results/*/TEST-*.xml + +# Release build related jobs + +# Default configuration for release builds +# Only on "master", "merge_request_event" and protected branches +buildRelease: + stage: release + allow_failure: false + rules: + - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' + when: always + script: + - ./gradlew assembleRelease + artifacts: + paths: + - app/build/outputs/apk/release/ + +pushToPrebuilt: + stage: publish + needs: ["buildRelease"] + rules: + - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' + when: manual + - when: never + variables: + NEW_APK_PATH: "app/build/outputs/apk/release/" + before_script: + - 'which ssh-agent || ( apt update -y && apt install openssh-client -y )' + - eval $(ssh-agent -s) + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + - git config --global user.email "gitlab@e.foundation" + - git config --global user.name "gitlab" + script: + - NEW_APK_NAME=$(basename ${NEW_APK_PATH}*-release.apk) + - NEW_APK_VERSION=$(awk -F '-' '{print $2}' <<< "$NEW_APK_NAME") + - echo $NEW_APK_NAME + - echo $NEW_APK_VERSION + - git lfs clone git@gitlab.e.foundation:hasibprince/applounge_git_lfs.git + - cd applounge_git_lfs + - rm *-release.apk + - mv ../${NEW_APK_PATH}/${NEW_APK_NAME} / + # todo: improve to replace sed command, by a new one based on REGEXP (instead of using line number) + - sed -i "6s/.*/LOCAL_SRC_FILES := ${NEW_APK_NAME}/" Apps/Android.mk + - git add Apps + - git status + - git commit -m "App Lounge - ${NEW_APK_VERSION}, ${CI_COMMIT_TAG}" -m "From ${CI_COMMIT_SHA}, pipeline ${CI_PIPELINE_ID}" + - git push + # Sometimes a single push doesn't do all the job, so we have to push twice + - git push + +after_script: + - echo "after script is executed" -- GitLab From a24a7bc37079dca53bfbb3d60482784b8caa486c Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Thu, 14 Sep 2023 06:35:33 +0000 Subject: [PATCH 48/50] playground reverted, dummy_job to old script --- .gitlab-ci.yml | 122 ++----------------------------------------------- 1 file changed, 4 insertions(+), 118 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee88e8791..d15c06877 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,118 +1,4 @@ -image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-auto-release - -variables: - SENTRY_DSN: $SENTRY_DSN - -stages: - - build - - test - - mycustomstage - - release - - publish - -before_script: - - export GRADLE_USER_HOME=$(pwd)/.gradle - - chmod +x ./gradlew - - -cache: - key: ${CI_PROJECT_ID} - paths: - - .gradle/ - -# Debug build related jobs - -dummy: - stage: test - only: - - /^.*playground.*$/ - script: - - echo "dummy job running $CI_COMMIT_REF_NAME! $CI_COMMIT_BRANCH" - -lint: - stage: build - script: - - ./gradlew lintRelease - - echo "lint fininshed" - -dummy_job: - stage: mycustomstage - rules: - - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' - when: manual - script: - - echo "second dummy job running $CI_COMMIT_MESSAGE $CI_COMMIT_BRANCH $CI_PIPELINE_SOURCE" - - -test: - stage: test - allow_failure: false - rules: - - if: '$CI_PIPELINE_SOURCE == "push"' - when: always - script: - - echo "Test run Started!" - - ./gradlew test - - echo "Test running ended!" - artifacts: - when: always - paths: - - app/build/test-results/*/TEST-*.xml - - app/build/reports/tests/* - reports: - junit: app/build/test-results/*/TEST-*.xml - -# Release build related jobs - -# Default configuration for release builds -# Only on "master", "merge_request_event" and protected branches -buildRelease: - stage: release - allow_failure: false - rules: - - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' - when: always - script: - - ./gradlew assembleRelease - artifacts: - paths: - - app/build/outputs/apk/release/ - -pushToPrebuilt: - stage: publish - needs: ["buildRelease"] - rules: - - if: '$CI_COMMIT_MESSAGE =~ "/^.*dummy_job.*$/"' - when: manual - - when: never - variables: - NEW_APK_PATH: "app/build/outputs/apk/release/" - before_script: - - 'which ssh-agent || ( apt update -y && apt install openssh-client -y )' - - eval $(ssh-agent -s) - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - - chmod 644 ~/.ssh/known_hosts - - git config --global user.email "gitlab@e.foundation" - - git config --global user.name "gitlab" - script: - - NEW_APK_NAME=$(basename ${NEW_APK_PATH}*-release.apk) - - NEW_APK_VERSION=$(awk -F '-' '{print $2}' <<< "$NEW_APK_NAME") - - echo $NEW_APK_NAME - - echo $NEW_APK_VERSION - - git lfs clone git@gitlab.e.foundation:hasibprince/applounge_git_lfs.git - - cd applounge_git_lfs - - rm *-release.apk - - mv ../${NEW_APK_PATH}/${NEW_APK_NAME} / - # todo: improve to replace sed command, by a new one based on REGEXP (instead of using line number) - - sed -i "6s/.*/LOCAL_SRC_FILES := ${NEW_APK_NAME}/" Apps/Android.mk - - git add Apps - - git status - - git commit -m "App Lounge - ${NEW_APK_VERSION}, ${CI_COMMIT_TAG}" -m "From ${CI_COMMIT_SHA}, pipeline ${CI_PIPELINE_ID}" - - git push - # Sometimes a single push doesn't do all the job, so we have to push twice - - git push - -after_script: - - echo "after script is executed" +include: + - project: 'e/templates' + ref: gitlab-ci-apps + file: '/gitlab-ci/.ci-apps.yml' -- GitLab From e6535af23b99abe41ecda52a1e8eadea74b56d02 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sat, 30 Sep 2023 05:32:33 +0000 Subject: [PATCH 49/50] comment added --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d15c06877..831cc619b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,3 +2,5 @@ include: - project: 'e/templates' ref: gitlab-ci-apps file: '/gitlab-ci/.ci-apps.yml' + +# finish script -- GitLab From 4d22b1c7b620dcab46947400e6be1fd287b1098b Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Sat, 30 Sep 2023 05:46:04 +0000 Subject: [PATCH 50/50] comment modified --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 831cc619b..233c587dd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,4 +3,4 @@ include: ref: gitlab-ci-apps file: '/gitlab-ci/.ci-apps.yml' -# finish script +# finishing the script -- GitLab