summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: e888f49b4c442081583f5032d07c6f87e1d3bbe8 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
---
stages:
  - docker_image_sdk
  - docker_image_other
  - build
  - test

# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
  DOCKER_DRIVER: overlay

.job_template: &build_docker_image
  image: 0xacab.org:4567/leap/docker/debian:bullseye_amd64
  tags:
    - docker-in-docker
  services:
    - docker:dind

  before_script:
    - >
      export LAST_COMMIT=$(curl -s --header "PRIVATE-TOKEN: ${LEAP_CODE_O_MATIC_PRIVATE_TOKEN}" https://0xacab.org/api/v4/projects/578/pipelines |
      python -c "import sys, json; print json.load(sys.stdin)[1]['sha']")

  script:
    - docker --version
    - docker info
    - if ! .gitlab/build.sh ${DOCKER_IMAGE} >> dockerbuild.log 2>&1; then echo "Image build failed. Please check dockerbuild.log."; echo "tail -n 200 dockerbuild.log:"; tail -n 200 dockerbuild.log; echo "disk space:"; df -h; sleep 800; exit 1; fi;
  allow_failure: false
  artifacts:
    expire_in: 3d
    paths:
    - dockerbuild.log

docker_image:sdk:
  stage: docker_image_sdk
  variables:
    DOCKER_IMAGE: android-sdk
  <<: *build_docker_image

docker_image:ndk:
  stage: docker_image_other
  variables:
    DOCKER_IMAGE: android-ndk
  <<: *build_docker_image

docker_image:emulator:
  stage: docker_image_other
  variables:
    DOCKER_IMAGE: android-emulator
  allow_failure: true
  <<: *build_docker_image

docker_image:fastlane:
  stage: docker_image_other
  variables:
    DOCKER_IMAGE: android-fastlane
#    DEFAULT_IMAGE: "registry.0xacab.org/leap/bitmask_android/android-emulator"
  when: manual
  <<: *build_docker_image
  allow_failure: true

unit_test:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: test
  script:
    - ./scripts/prepareForTests.sh
    - ./gradlew testCustomProductionFatReleaseUnitTest testNormalProductionFatReleaseUnitTest
  artifacts:
    paths:
      - app/build/reports/tests
    when: on_failure
    expire_in: 3 days

screenshot:
  image: "0xacab.org:4567/leap/bitmask_android/android-fastlane:latest"
  stage: test
  when: always
  tags:
    - birch
  variables:
    LC_ALL: "en_US.UTF-8"
    LANG: "en_US.UTF-8"
    ANDROID_EMULATOR_USE_SYSTEM_LIBS: 1
    DEBIAN_FRONTEN: "noninteractive"
# try to re-use the build artifcats from before, lib building is slow
  dependencies:
    - build
  script:
    - ./scripts/installFastlane.sh
    - ./scripts/startEmulators.sh
    - ./scripts/fastlane.sh
    - ./scripts/fastlane.sh custom
  artifacts:
    paths:
      - src/custom/
      - src/normal/
    when: always
    expire_in: 3 days
  allow_failure: true

#ui_test:
#  image: "0xacab.org:4567/leap/bitmask_android/android-emulator:latest"
#  stage: test
#  script:
#    - emulator -avd testApi27 -no-audio -no-window &
#    - .gitlab/wait-for-emulator.sh
#    - adb devices
#    - adb shell settings put global window_animation_scale 0 &
#    - adb shell settings put global transition_animation_scale 0 &
#    - adb shell settings put global animator_duration_scale 0 &
#    - adb shell input keyevent 82 &
#    - ./gradlew connectedAndroidTest
#    - adb -s testApi27 emu kill

#expanded_test:
#  image: "0xacab.org:4567/leap/bitmask_android/android-emulator:latest"
#  stage: test
#  script:
#    - emulator -avd testApi27 -no-audio -no-window &
#    - .gitlab/wait-for-emulator.sh
#    - adb devices
#    - adb shell settings put global window_animation_scale 0 &
#    - adb shell settings put global transition_animation_scale 0 &
#    - adb shell settings put global animator_duration_scale 0 &
#    - adb shell input keyevent 82 &
#    - ./gradlew connectedAndroidTest
#    - ./gradlew createProductionDebugCoverageReport
#    - adb -s testApi27 emu kill
#    - ./gradlew test
#  artifacts:
#    expire_in: 3 days
#    paths:
#      - app/build/reports/androidTests/connected/
#      - app/build/reports/coverage/production/
#      - app/build/tests/
#  when: manual

build:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
    - ./scripts/cleanProject.sh
    - ./scripts/build_deps.sh >> build_deps.log 2>&1
    - ./gradlew clean assembleNormalProductionFatDebug -debug >> build.log 2>&1
  artifacts:
    untracked: true
    paths:
    - app/build/outputs/
    # it's required to pass tor builds to screenshot step
    - tor-android/tor-android-binary/build/
    - build_deps.log
    - build.log
    when: always
    expire_in: 3 days

build_double_release:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
    - ./scripts/prepareForDistribution.sh build -allflavors -aab -apk web -no-tag >> normalRelease.log 2>&1
  artifacts:
    paths:
      - app/build/outputs/
      - currentReleases/
      - normalRelease.log
    when: always
    expire_in: 1 week
  when: manual

build_double_beta_releases:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
    - ./scripts/prepareForDistribution.sh build -allflavors -apk fat -no-tag -beta >> webBetaRelease.log 2>&1
    - ./scripts/prepareForDistribution.sh build -allflavors -aab -no-tag >> gplayBetaRelease.log 2>&1
  artifacts:
    paths:
      - app/build/outputs/
      - currentReleases/
      - webBetaRelease.log
      - gplayBetaRelease.log
    when: always
    expire_in: 1 week
  when: manual


build_release:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
    - ./scripts/prepareForDistribution.sh build -aab -apk web -no-tag >> normalRelease.log 2>&1
  artifacts:
    paths:
      - app/build/outputs/
      - currentReleases/
      - normalRelease.log
    when: always
    expire_in: 1 week
  when: manual

build_fdroid_beta_release:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
    - ./scripts/prepareForDistribution.sh build -no-tag -beta >> normalBeta.log 2>&1
  artifacts:
    paths:
      - app/build/outputs/
      - currentReleases/
      - normalBeta.log
    when: always
    expire_in: 1 week
  when: manual

build_custom_release:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
    - ./scripts/prepareForDistribution.sh build -aab -apk web -no-tag -custom >> customRelease.log 2>&1
  artifacts:
    paths:
    - app/build/outputs/
    - currentReleases/
    - customRelease.log
    when: always
    expire_in: 1 week
  when: manual

build_fdroid_custom_beta_release:
  image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
  stage: build
  script:
    - ./scripts/prepareForDistribution.sh build -no-tag -beta -custom >> customBeta.log 2>&1
  artifacts:
    paths:
      - app/build/outputs/
      - currentReleases/
      - customBeta.log
    when: always
    expire_in: 1 week
  when: manual