From 835073a80eb6a85c8d7364a97e403f3da811bbdb Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Sep 2024 16:16:01 +0200 Subject: [PATCH 01/13] feat: Update gitlab-ci to provide json file & .apk to make eDrive able to be updatable through App Lounge This is using code of AccountManager as example --- .gitlab-ci.yml | 84 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee36959f..a2f6631c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,23 +2,52 @@ image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest" variables: SENTRY_DSN: "${SENTRY_DSN}" + APK_PATH: "app/build/outputs/apk/release" + UNSIGNED_APK: "eDrive-*-release-unsigned.apk" # TODO: check if usage of * is working then update or remove this comment + DEV_APK: "eDrive-dev.apk" + STABLE_APK: "eDrive-stable.apk" stages: - build - test - + - release before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew - cache: key: ${CI_PROJECT_ID} paths: - .gradle/ +lint: + stage: build + script: + - ./gradlew lintRelease + - ./gradlew detekt + artifacts: + paths: + - build/reports/detekt/ + +# |===========| +# | Build APK | +# |===========| +build: + stage: build + script: + - ./gradlew assemble + artifacts: + paths: + - app/build/outputs/apk/ + expire_in: 4 weeks + +# |===============| +# | validation | +# | --------------| +# | Automatic test| +# |===============| test: allow_failure: true stage: test @@ -33,23 +62,48 @@ test: reports: junit: app/build/test-results/*/TEST-*.xml - -lint: - stage: build +# |==========================================| +# | Make eDrive updatable through app lounge | +# | ---------------------------------------- | +# | eDrive as a dependency on AccountManager | +# |==========================================| +generate-apks: + stage: release + rules: + - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + when: on_success + needs: + - build + dependencies: + - build + before_script: + - apt update && apt install apksigner -y script: - - ./gradlew lintRelease - - ./gradlew detekt + - | + ./systemAppsUpdateInfo/scripts/generate-apks.sh \ + "$APK_PATH" "$UNSIGNED_APK" "$DEV_APK" "$STABLE_APK" artifacts: paths: - - build/reports/detekt/ - + - $APK_PATH/$UNSIGNED_APK + - $APK_PATH/$DEV_APK + - $APK_PATH/$STABLE_APK -build: - stage: build +create-json-files: + stage: release + dependencies: + - generate-apks + needs: + - generate-apks + rules: + - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + when: manual + before_script: + - apt update && apt install jq aapt -y script: - - ./gradlew assemble + - | + ./systemAppsUpdateInfo/scripts/create-json-files.sh \ + "$APK_PATH" "$UNSIGNED_APK" "$DEV_APK" "$STABLE_APK" artifacts: paths: - - app/build/outputs/apk/ - expire_in: 4 weeks - + - dev.json + - stable.json \ No newline at end of file -- GitLab From 4ff591bc3410ec131685c1f7a18fa344f6e78cc4 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Sep 2024 17:35:03 +0200 Subject: [PATCH 02/13] fix: Add missing dependency --- app/build.gradle | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index db6f91dd..431a29a9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -97,7 +97,13 @@ android { } dependencies { - implementation 'foundation.e:Nextcloud-Android-Library:1.0.9-u2.17-release' + implementation("foundation.e:Nextcloud-Android-Library:1.0.9-u2.17-release") { + exclude group: 'com.gitlab.bitfireAT', module: 'dav4jvm' // Got from AccountManager + exclude group: 'com.github.bitfireAT', module: 'dav4jvm' + exclude group: 'org.ogce', module: 'xpp3' // unused in Android and brings wrong Junit version + exclude group: 'com.squareup.okhttp3' + } + implementation "commons-httpclient:commons-httpclient:3.1@jar" implementation fileTree(include: ['*.jar'], dir: 'libs') api 'androidx.annotation:annotation:1.7.0' @@ -114,6 +120,7 @@ dependencies { implementation 'foundation.e:elib:0.0.1-alpha11' implementation 'foundation.e.lib:telemetry:0.0.11-alpha' + androidTestImplementation 'androidx.test:runner:1.5.2' androidTestImplementation 'androidx.test:rules:1.5.0' androidTestImplementation 'androidx.annotation:annotation:1.7.0' -- GitLab From 0440ead9beb505d830e811485233dead85ace1dd Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Sep 2024 18:00:50 +0200 Subject: [PATCH 03/13] feat: make create-release ci task to be run --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a2f6631c..bf69ffa1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,6 +24,7 @@ cache: lint: stage: build + allow_failure: true # TODO remove before to merge script: - ./gradlew lintRelease - ./gradlew detekt @@ -70,7 +71,7 @@ test: generate-apks: stage: release rules: - - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + - if: '$CI_COMMIT_TAG' # && $CI_COMMIT_REF_PROTECTED == "true"' # TODO <= uncomment once validated when: on_success needs: - build -- GitLab From 953a92f2d216b886333495ef3bdbfba7a0d38809 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Sep 2024 18:00:50 +0200 Subject: [PATCH 04/13] feat: make create-release ci task to be run --- .gitlab-ci.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf69ffa1..879485cf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -68,14 +68,30 @@ test: # | ---------------------------------------- | # | eDrive as a dependency on AccountManager | # |==========================================| + +init_submodules: + stage: release + # rules: + # - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + # when: on_success + script: + - | + git submodule add --force \ + https://gitlab.e.foundation/e/os/system-apps-update-info.git systemAppsUpdateInfo + artifacts: + paths: + - systemAppsUpdateInfo/ + + generate-apks: stage: release - rules: - - if: '$CI_COMMIT_TAG' # && $CI_COMMIT_REF_PROTECTED == "true"' # TODO <= uncomment once validated - when: on_success + # - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + # when: on_success needs: + - init_submodules - build dependencies: + - init_submodules - build before_script: - apt update && apt install apksigner -y -- GitLab From 10783011a55160372301ced23c3e0fe55f918bc8 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Wed, 4 Sep 2024 14:52:46 +0200 Subject: [PATCH 05/13] fix: apply Sayantan's suggestion --- .gitlab-ci.yml | 52 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 879485cf..6a0108e1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,9 +3,9 @@ image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest" variables: SENTRY_DSN: "${SENTRY_DSN}" APK_PATH: "app/build/outputs/apk/release" - UNSIGNED_APK: "eDrive-*-release-unsigned.apk" # TODO: check if usage of * is working then update or remove this comment - DEV_APK: "eDrive-dev.apk" - STABLE_APK: "eDrive-stable.apk" + UNSIGNED_APK: "eDrive-release-unsigned.apk" # TODO: check if usage of * is working then update or remove this comment + COMMUNITY_APK: "eDrive-community.apk" + OFFICIAL_APK: "eDrive-official.apk" stages: - build @@ -39,6 +39,15 @@ build: stage: build script: - ./gradlew assemble + - cd app/build/outputs/apk/ + - | + if [[ ! -d "release" ]]; then + echo "$APK_PATH does not exist." + exit 1 + fi + cd "release" + - unsigned_build=$(ls *.apk | grep "unsigned") + - cp $unsigned_build $UNSIGNED_APK artifacts: paths: - app/build/outputs/apk/ @@ -71,13 +80,11 @@ test: init_submodules: stage: release - # rules: - # - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' - # when: on_success + rules: + - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + when: on_success script: - - | - git submodule add --force \ - https://gitlab.e.foundation/e/os/system-apps-update-info.git systemAppsUpdateInfo + - git clone https://gitlab.e.foundation/e/os/system-apps-update-info.git systemAppsUpdateInfo artifacts: paths: - systemAppsUpdateInfo/ @@ -85,8 +92,9 @@ init_submodules: generate-apks: stage: release - # - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' - # when: on_success + rules: + - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + when: on_success needs: - init_submodules - build @@ -96,14 +104,24 @@ generate-apks: before_script: - apt update && apt install apksigner -y script: + - | + if [[ -z $KEYSTORE ]]; then + echo "KEYSTORE not set" + exit 1 + fi + - | + if [[ -z $KEYSTORE_PASSWORD ]]; then + echo "KEYSTORE_PASSWORD not set" + exit 1 + fi - | ./systemAppsUpdateInfo/scripts/generate-apks.sh \ - "$APK_PATH" "$UNSIGNED_APK" "$DEV_APK" "$STABLE_APK" + "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" artifacts: paths: - $APK_PATH/$UNSIGNED_APK - - $APK_PATH/$DEV_APK - - $APK_PATH/$STABLE_APK + - $APK_PATH/$COMMUNITY_APK + - $APK_PATH/$OFFICIAL_APK create-json-files: stage: release @@ -119,8 +137,8 @@ create-json-files: script: - | ./systemAppsUpdateInfo/scripts/create-json-files.sh \ - "$APK_PATH" "$UNSIGNED_APK" "$DEV_APK" "$STABLE_APK" + "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" artifacts: paths: - - dev.json - - stable.json \ No newline at end of file + - community.json + - official.json \ No newline at end of file -- GitLab From 258952dc61fd3c4ce4db49cadc2db7b509e0a92a Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Thu, 5 Sep 2024 10:38:38 +0200 Subject: [PATCH 06/13] task: debug create-json-file.sh --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a0108e1..01ec6430 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -135,6 +135,9 @@ create-json-files: before_script: - apt update && apt install jq aapt -y script: + - pwd + - ls -la + - chmod +x systemAppsUpdateInfo/scripts/create-json-files.sh - | ./systemAppsUpdateInfo/scripts/create-json-files.sh \ "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" -- GitLab From b8362538b64e72f209d1060e537c248f92f7fd6e Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Thu, 5 Sep 2024 11:01:17 +0200 Subject: [PATCH 07/13] fix: add missing dependencies & needs in job create-json-file --- .gitlab-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 01ec6430..137219a6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -126,8 +126,10 @@ generate-apks: create-json-files: stage: release dependencies: + - init_submodules - generate-apks needs: + - init_submodules - generate-apks rules: - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' @@ -135,9 +137,6 @@ create-json-files: before_script: - apt update && apt install jq aapt -y script: - - pwd - - ls -la - - chmod +x systemAppsUpdateInfo/scripts/create-json-files.sh - | ./systemAppsUpdateInfo/scripts/create-json-files.sh \ "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" -- GitLab From f49888171af72b1cf2e069f0b6012692914a6bbb Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Thu, 5 Sep 2024 11:50:15 +0200 Subject: [PATCH 08/13] feat: add create-release job --- .gitlab-ci.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 137219a6..fed765d5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -143,4 +143,23 @@ create-json-files: artifacts: paths: - community.json - - official.json \ No newline at end of file + - official.json + + +create-release: + stage: release + dependencies: + - init_submodules + needs: + - init_submodules + - create-json-files + - generate-apks + rules: + - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + when: on_success + before_script: + - apt update && apt install jq -y + script: + - | + ./systemAppsUpdateInfo/scripts/create-release.sh \ + "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" \ No newline at end of file -- GitLab From e28118a014304e78f8adeed1ae76dcbc8bc4d050 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Thu, 12 Sep 2024 10:21:03 +0200 Subject: [PATCH 09/13] fix: apply's Sayantan suggestion: Remove useless test in a job & remove a useless comment on a variable --- .gitlab-ci.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fed765d5..d89d2959 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest" variables: SENTRY_DSN: "${SENTRY_DSN}" APK_PATH: "app/build/outputs/apk/release" - UNSIGNED_APK: "eDrive-release-unsigned.apk" # TODO: check if usage of * is working then update or remove this comment + UNSIGNED_APK: "eDrive-release-unsigned.apk" COMMUNITY_APK: "eDrive-community.apk" OFFICIAL_APK: "eDrive-official.apk" @@ -104,16 +104,6 @@ generate-apks: before_script: - apt update && apt install apksigner -y script: - - | - if [[ -z $KEYSTORE ]]; then - echo "KEYSTORE not set" - exit 1 - fi - - | - if [[ -z $KEYSTORE_PASSWORD ]]; then - echo "KEYSTORE_PASSWORD not set" - exit 1 - fi - | ./systemAppsUpdateInfo/scripts/generate-apks.sh \ "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" -- GitLab From 49d4ee52bbc344f8b19989334a1f2818ba49cc01 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Thu, 12 Sep 2024 10:29:53 +0200 Subject: [PATCH 10/13] fix: apply's Sayantan suggestion: Rename release stage in gitlab_release & change artefact path of init_submodule job --- .gitlab-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d89d2959..1f1528e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ variables: stages: - build - test - - release + - gitlab_release before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle @@ -79,7 +79,7 @@ test: # |==========================================| init_submodules: - stage: release + stage: gitlab_release rules: - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' when: on_success @@ -87,11 +87,11 @@ init_submodules: - git clone https://gitlab.e.foundation/e/os/system-apps-update-info.git systemAppsUpdateInfo artifacts: paths: - - systemAppsUpdateInfo/ + - systemAppsUpdateInfo/scripts/ generate-apks: - stage: release + stage: gitlab_release rules: - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' when: on_success @@ -114,7 +114,7 @@ generate-apks: - $APK_PATH/$OFFICIAL_APK create-json-files: - stage: release + stage: gitlab_release dependencies: - init_submodules - generate-apks @@ -137,7 +137,7 @@ create-json-files: create-release: - stage: release + stage: gitlab_release dependencies: - init_submodules needs: -- GitLab From ed05e238cd3dc964b6ab28e065d22ddd154276bc Mon Sep 17 00:00:00 2001 From: Vincent Bourgmayer Date: Thu, 12 Sep 2024 08:46:58 +0000 Subject: [PATCH 11/13] task: remove allow failure in lint job --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1f1528e7..d684a4d4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,6 @@ cache: lint: stage: build - allow_failure: true # TODO remove before to merge script: - ./gradlew lintRelease - ./gradlew detekt -- GitLab From 9732172d78b3ebb47aabf11879f937971e2a0504 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Fri, 13 Sep 2024 09:34:52 +0200 Subject: [PATCH 12/13] task: clean code style in .gitlab-ci.yml --- .gitlab-ci.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d684a4d4..39f5a1bd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,11 +52,6 @@ build: - app/build/outputs/apk/ expire_in: 4 weeks -# |===============| -# | validation | -# | --------------| -# | Automatic test| -# |===============| test: allow_failure: true stage: test @@ -71,11 +66,8 @@ test: reports: junit: app/build/test-results/*/TEST-*.xml -# |==========================================| -# | Make eDrive updatable through app lounge | -# | ---------------------------------------- | -# | eDrive as a dependency on AccountManager | -# |==========================================| + +# Below job makes eDrive updatable through app lounge init_submodules: stage: gitlab_release -- GitLab From 419f7ba62e41f4a38f68ba2594db86e5098a242a Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Fri, 13 Sep 2024 09:35:20 +0200 Subject: [PATCH 13/13] fix: removed unused quantity string that makes the linter to fails --- app/src/main/res/values-es/strings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index f9ff2bd7..efcd3e27 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -36,7 +36,6 @@ Sincronizar el canal de trabajador %d archivo a sincronizar - %d archivos a sincronizar %d archivos a sincronizar Notificación sobre el contenido que está en sincronización -- GitLab