-
Notifications
You must be signed in to change notification settings - Fork 11
/
.gitlab-ci.yml
125 lines (116 loc) · 3.74 KB
/
.gitlab-ci.yml
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
image: registry.gitlab.com/passbolt/passbolt-ci-docker-images/android-app:latest
variables:
ANDROID_HOME: "${PWD}/android-home"
default:
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
- api_failure
- stale_schedule
stages:
- Build
- Instrumented tests
- Deploy
# run all static analysis and reporting tools
Run required verifications:
stage: Build
script:
- >
./gradlew --no-daemon --build-cache
detekt
ktlint
unitTest
rules:
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule"'
artifacts:
when: always
expire_in: 72 hrs
paths:
- "**/reports/ktlint-report.xml"
- "**/reports/detekt-report.xml"
- "**/test-results/**/TEST-*.xml"
reports:
junit: "**/test-results/**/TEST-*.xml"
# run all static analysis and reporting tools
Run extensive verifications:
stage: Build
script:
- >
./gradlew --no-daemon --build-cache
lintRelease
koverMergedHtmlReport
licenseeRelease
dependencyUpdates
buildHealth
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
artifacts:
when: always
expire_in: 72 hrs
paths:
- "**/lint-results-*.html"
- build/reports/kover/html/
- build/dependencyUpdates/dependecyUpdates.txt
- build/reports/build-health-report.txt
# run instrumented tests on Sauce Labs
Run instrumented tests on Sauce Labs:
stage: Instrumented tests
script:
- >
./gradlew --no-daemon --build-cache
assembleDebug assembleAndroidTest
- saucectl configure --username $SAUCELABS_USERNAME --accessKey $SAUCELABS_ACCESS_KEY
- saucectl run --build $CI_PIPELINE_ID
when: manual
artifacts:
when: always
expire_in: 72hrs
paths:
- "**/reports/saucelabs/"
allow_failure: true
# build and upload QA application to Firebase App Distribution
Deploy qa application to Firebase:
stage: Deploy
script:
- echo $QA_KEY | base64 -d > "${HOME}/qa.keystore"
- python3 -m pip install -r gradle/requirements.txt
- export GITLAB_BUILD_NUMBER="$(python3 gradle/gitlabBuildNumber.py "RELEASE_BUILD_NUMBER" ${CI_API_V4_URL} ${CI_PROJECT_ID} ${GITLAB_ACCESS_TOKEN})"
- export FIREBASE_DIR="$HOME/.config/firebase"
- install -d $FIREBASE_DIR
- echo ${FIREBASE_SERVICE_KEY} | base64 --decode > "$FIREBASE_DIR/service_key.json"
- >
./gradlew --no-daemon --build-cache -PwithGitlabReleaseNotes -PserviceKey="$FIREBASE_DIR/service_key.json"
-Pandroid.injected.signing.store.file="${HOME}/qa.keystore"
-Pandroid.injected.signing.store.password=$QA_KEYSTORE_PASSWORD
-Pandroid.injected.signing.key.alias=$QA_KEY_ALIAS
-Pandroid.injected.signing.key.password=$QA_KEY_PASSWORD
assembleQa appDistributionUploadQa
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH =~ /^release/
artifacts:
expire_in: 72 hrs
paths:
- "**/build/outputs/apk/**/*.apk"
# build and upload production application to Google Play Store
Deploy production application to Play Store:
stage: Deploy
script:
- echo $PROD_KEYSTORE | base64 -d > "${HOME}/production.keystore"
- python3 -m pip install -r gradle/requirements.txt
- >
./gradlew --no-daemon
-Pandroid.injected.signing.store.file="${HOME}/production.keystore"
-Pandroid.injected.signing.store.password=$PROD_KEYSTORE_PASSWORD
-Pandroid.injected.signing.key.alias=$PROD_KEY_ALIAS
-Pandroid.injected.signing.key.password=$PROD_KEY_PASSWORD
clean bundleRelease publishReleaseBundle
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
artifacts:
expire_in: 72 hrs
paths:
- "**/build/outputs/bundle/release/*.aab"