Loading .gitlab-ci.ymldeleted 100644 → 0 +0 −176 Original line number Diff line number Diff line image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:master variables: SENTRY_DSN: $SENTRY_DSN stages: - debug - release - publish before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew # 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 # Debug build related jobs buildDebug: stage: debug script: - ./gradlew assembleDebug artifacts: paths: - app/build/outputs/apk/debug/ # 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/ test: stage: release rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: always script: - ./gradlew test artifacts: when: always paths: - app/build/test-results/*/TEST-*.xml - app/build/reports/tests/* reports: junit: app/build/test-results/*/TEST-*.xml 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/ 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 Loading
.gitlab-ci.ymldeleted 100644 → 0 +0 −176 Original line number Diff line number Diff line image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:master variables: SENTRY_DSN: $SENTRY_DSN stages: - debug - release - publish before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew # 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 # Debug build related jobs buildDebug: stage: debug script: - ./gradlew assembleDebug artifacts: paths: - app/build/outputs/apk/debug/ # 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/ test: stage: release rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: always script: - ./gradlew test artifacts: when: always paths: - app/build/test-results/*/TEST-*.xml - app/build/reports/tests/* reports: junit: app/build/test-results/*/TEST-*.xml 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/ 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