diff options
-rw-r--r-- | .gitlab-ci.yml | 95 | ||||
-rw-r--r-- | build.gradle | 3 |
2 files changed, 98 insertions, 0 deletions
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 = [ |