summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 8aa50067333a02aabf4e2e9ae78c888edd40e418 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest"

stages:
  - update
  - qa
  - build
  - test

# By default load dev keys.
variables:
  MAPBOX_KEY: $MAPBOX_KEY_DEV
  SENTRY_DSN: $SENTRY_DSN

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 lint
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: never
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: never
    - if: '$CI_COMMIT_REF_PROTECTED == "true"'
      when: never
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: never
    - when: always

build-debug:
  stage: build
  script:
    - ./gradlew :app:assembleDebug
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: never
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: never
    - if: '$CI_COMMIT_REF_PROTECTED == "true"'
      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 test --stacktrace
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: never
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
      when: always
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: never
    - if: '$CI_COMMIT_REF_PROTECTED == "true"'
      when: never
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: never
    - when: on_success
  artifacts:
    paths:
      - ./**/build/reports/tests/testDebugUnitTest

build-e-release:
  stage: build
  script:
    - ./gradlew :app:assembleERelease
  rules:
    - if: '$CI_COMMIT_REF_PROTECTED == "true" && $CI_BUILD_TAG =~ /^eOS-/'
      variables:
        MAPBOX_KEY: $MAPBOX_KEY_PROD
      when: always
    - if: '$CI_COMMIT_REF_PROTECTED == "true"'
      variables:
        MAPBOX_KEY: $MAPBOX_KEY_PROD
      when: manual

  artifacts:
    paths:
      - app/build/outputs/apk
      - app/build/reports