From 43e9b964e80045d989b8e5a7dec31067ed57c686 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Wed, 28 Apr 2021 05:58:38 +0000 Subject: Add gitlab-ci configuration --- .gitlab-ci.yml | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ build.gradle | 3 ++ 2 files changed, 98 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..da31bd1 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,95 @@ +image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:latest" + +stages: + - update + - qa + - build + - test + +workflow: + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"' + when: never + - if: '$CI_COMMIT_BRANCH' + +before_script: + - export GRADLE_USER_HOME=$(pwd)/.gradle + - chmod +x ./gradlew + +cache: + key: ${CI_PROJECT_ID} + paths: + - .gradle/ + +nightly-tasks: + stage: update + script: + - ./gradlew dependencyUpdates + rules: + - if: '$CI_PIPELINE_SOURCE == "schedule"' + artifacts: + paths: + - build/dependencyUpdates + +quality-analysis: + stage: qa + script: + - ./gradlew spotlessCheck + rules: + - if: '$CI_PIPELINE_SOURCE == "schedule"' + when: never + - if: '$CI_COMMIT_BRANCH == "master"' + when: never + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never + - when: always + +build-debug: + stage: build + script: + - ./gradlew assembleDebug + rules: + - if: '$CI_PIPELINE_SOURCE == "schedule"' + when: never + - if: '$CI_COMMIT_BRANCH == "master"' + when: never + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never + - when: on_success + artifacts: + paths: + - app/build/outputs/apk + +test-debug: + stage: test + script: + - ./gradlew testDebug --stacktrace + rules: + - if: '$CI_PIPELINE_SOURCE == "schedule"' + when: never + - if: '$CI_COMMIT_BRANCH == "master"' + when: never + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never + - when: on_success + artifacts: + paths: + - ./**/build/reports/tests/testDebugUnitTest + +build-full: + stage: build + script: + - ./gradlew build + rules: + - if: '$CI_PIPELINE_SOURCE == "schedule"' + when: never + - if: '$CI_COMMIT_BRANCH == "master"' + when: always + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"' + when: always + - when: never + artifacts: + paths: + - app/build/outputs/apk + - app/build/reports diff --git a/build.gradle b/build.gradle index 8dba9aa..2a25c70 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,6 @@ +import foundation.e.privacycentral.buildsrc.DependencyUpdates +import foundation.e.privacycentral.buildsrc.ReleaseType + // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.buildConfig = [ -- cgit v1.2.1