summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: b61aa3ec092df7893ba245745ea79fea26aca78f (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
image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:latest"

stages:
  - update
  - qa
  - build
  - test

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

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 == "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 test --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"'
      variables:
          MAPBOX_KEY: $MAPBOX_KEY_PROD
          MAPBOX_SECRET_KEY: $MAPBOX_SECRET_KEY_PROD
      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