PrivacyCenter/.gitlab-ci.yml

94 lines
2.0 KiB
YAML
Raw Permalink Normal View History

2024-10-24 12:58:52 +02:00
stages:
- lint
- test
- build
# By default load dev keys.
variables:
MAPBOX_KEY: $MAPBOX_KEY_DEV
SENTRY_DSN: $SENTRY_DSN
default:
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest"
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
#tags:
# - android
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/
lint:
stage: lint
script:
- ./gradlew spotlessCheck
- ./gradlew detekt
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: on_success
- if: $CI_COMMIT_BRANCH == "main"
when: on_success
artifacts:
paths:
- build/reports/detekt/
# No unit tests yet.
#unit-test:
# stage: test
# script:
# - ./gradlew :testDebugUnitTest
# rules:
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# when: on_success
# - if: $CI_COMMIT_BRANCH == "main"
# when: on_success
# artifacts:
# paths:
# - ./**/build/reports/tests/testDebugUnitTest
build-debug:
stage: build
script:
- ./gradlew :app:assembleEosDebug
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: on_success
artifacts:
paths:
- app/build/outputs/apk
# Check that the release build works, but don't keep the artifacts.
build-release-test:
stage: test
script:
- ./gradlew :app:assembleEosRelease
rules:
- if: $CI_COMMIT_BRANCH == "main"
variables:
MAPBOX_KEY: $MAPBOX_KEY_PROD
when: on_success
build-e-release:
stage: build
script:
- ./gradlew :app:assembleEosRelease
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_TAG =~ /^eOS-v\d+\.\d+(\.\d+)$/
variables:
MAPBOX_KEY: $MAPBOX_KEY_PROD
when: on_success
- if: $CI_COMMIT_REF_PROTECTED == "true"
variables:
MAPBOX_KEY: $MAPBOX_KEY_PROD
when: manual
artifacts:
paths:
- app/build/outputs/apk
- app/build/reports