Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 835073a8 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

feat: Update gitlab-ci to provide json file & .apk to make eDrive able to be...

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
parent a7c94cce
Loading
Loading
Loading
Loading
Loading
+69 −15
Original line number Diff line number Diff line
@@ -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