From 835073a80eb6a85c8d7364a97e403f3da811bbdb Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Sep 2024 16:16:01 +0200 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 b57f6ccf9a927961f50183833cde92e232c5216e Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Sep 2024 18:00:50 +0200 Subject: [PATCH 4/5] feat: make create-release ci task to be run --- .gitlab-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf69ffa1..dc9188ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -70,9 +70,8 @@ test: # |==========================================| 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: - build dependencies: -- GitLab From 42b0e3419befe0cca008f8ee06308f0cc482fb9f Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 3 Sep 2024 15:55:52 +0200 Subject: [PATCH 5/5] feat: try to use gitlab CI/CD catalog to gather job for releasing update of eDrive for app lounge --- .gitlab-ci.yml | 61 +++++++++++++++++--------------------------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc9188ba..81d5b71c 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 + DEV_APK: "eDrive-community.apk" + STABLE_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/ @@ -68,42 +77,12 @@ test: # | ---------------------------------------- | # | eDrive as a dependency on AccountManager | # |==========================================| -generate-apks: - stage: release - # - 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: - - | - ./systemAppsUpdateInfo/scripts/generate-apks.sh \ - "$APK_PATH" "$UNSIGNED_APK" "$DEV_APK" "$STABLE_APK" - artifacts: - paths: - - $APK_PATH/$UNSIGNED_APK - - $APK_PATH/$DEV_APK - - $APK_PATH/$STABLE_APK -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: - - | - ./systemAppsUpdateInfo/scripts/create-json-files.sh \ - "$APK_PATH" "$UNSIGNED_APK" "$DEV_APK" "$STABLE_APK" - artifacts: - paths: - - dev.json - - stable.json \ No newline at end of file +include: + - component: $CI_SERVER_FQDN/vincent/paperboy-ci/sign-apks@1.0.5-beta + inputs: + stage: release + unsignedApk: "eDrive-*-release-unsigned.apk" + apk_dir_path: "app/build/outputs/apk/release" + official_apk: "eDrive-community.apk" + community_apk: "eDrive-official.apk" \ No newline at end of file -- GitLab