forked from ProtonVPN/android-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci-firebase.yml
153 lines (146 loc) · 5.59 KB
/
.gitlab-ci-firebase.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
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
.firebase_authenticate_script: &firebase_authenticate_script
- echo ${ARCHIVES_BASE_NAME}
- echo $CLOUD_PROJECT_ID
- gcloud config set project $CLOUD_PROJECT_ID
- echo "$SERVICE_ACCOUNT" > /tmp/service-account.json
- gcloud auth activate-service-account --key-file /tmp/service-account.json
- APP="$APP_LOCATION"${ARCHIVES_BASE_NAME}-${APP_TYPE}
- TEST_APP="$TEST_APP_LOCATION"${TEST_APP_BASE_NAME}-${TEST_APP_TYPE}
- echo $APP
- echo $TEST_APP
- echo $PWD
.tests_preparation_script:
stage: test
tags:
- shared-small
except:
- schedules
variables:
CHECKOUT_CORE_SUBMODULE: "true"
NUM_SHARDS: 1
TEST_APP_BASE_NAME: ${ARCHIVES_BASE_NAME}
script:
- *firebase_authenticate_script
- date
- gcloud --quiet beta firebase test android
run firebase-device-config.yml:${TESTS_TYPE}
--app "$APP"
--timeout $TIMEOUT
--test "$TEST_APP"
--use-orchestrator
--num-uniform-shards=${NUM_SHARDS}
--num-flaky-test-attempts=2
--environment-variables clearPackageData=true,useTestStorageService=true,coverage=true,coverageFilePath="/coverage/"
--directories-to-pull /sdcard
--test-targets "class $TEST_SUITE" 2>&1 | tee results.txt
- echo gcloud end time
- date
- gcsbucket=$(cat results.txt | grep 'Raw results will be stored' | awk -F/ '{print "gs://" $6 "/" $7}')
- echo $gcsbucket
- if [ ! -z "$COVERAGE_FOLDER" ]; then
gsutil ls $gcsbucket
| grep '/$'
| while read -r line; do
dst=app/build/outputs/coverage/${COVERAGE_FOLDER}/`basename "$line"`;
mkdir -p "$dst";
gsutil -m cp ${line}artifacts/sdcard/googletest/internal_use/coverage/*.ec "$dst";
done;
fi
- date
artifacts:
expire_in: 1 week
paths:
- app/build/outputs/
mobile tests mocked api:
extends: .tests_preparation_script
variables:
TESTS_TYPE: mobileTest
NUM_SHARDS: 2
APP_LOCATION: "app/build/outputs/apk/blackGooglePlayStore/debug/"
APP_TYPE: "black-google-playStore-debug.apk"
TEST_APP_LOCATION: "app/build/outputs/apk/androidTest/blackGooglePlayStore/debug/"
TEST_APP_TYPE: "black-google-playStore-debug-androidTest.apk"
TEST_SUITE: "com.protonvpn.testSuites.MobileMockApiSuite"
TIMEOUT: $TIMEOUT_MOCKED_TESTS
# UI coverage disabled for now due to API 23 devices crashing if running with coverage
# COVERAGE_FOLDER: "mobile_mocked_api"
mobile tests real connection:
extends: .tests_preparation_script
variables:
TESTS_TYPE: smokeTest
NUM_SHARDS: 1
APP_LOCATION: "app/build/outputs/apk/productionGooglePlayStore/debug/"
APP_TYPE: "production-google-playStore-debug.apk"
TEST_APP_LOCATION: "app/build/outputs/apk/androidTest/productionGooglePlayStore/debug/"
TEST_APP_TYPE: "production-google-playStore-debug-androidTest.apk"
TEST_SUITE: "com.protonvpn.testSuites.RealConnectionTestSuite"
TIMEOUT: $TIMEOUT_GENERAL_TESTS
mobile tests test-env:
extends: .tests_preparation_script
variables:
TESTS_TYPE: mobileTest
NUM_SHARDS: 1
APP_LOCATION: "app/build/outputs/apk/blackGooglePlayStore/debug/"
APP_TYPE: "black-google-playStore-debug.apk"
TEST_APP_LOCATION: "app/build/outputs/apk/androidTest/blackGooglePlayStore/debug/"
TEST_APP_TYPE: "black-google-playStore-debug-androidTest.apk"
TEST_SUITE: "com.protonvpn.testSuites.MobileBlackSuite"
TIMEOUT: $TIMEOUT_GENERAL_TESTS
# COVERAGE_FOLDER: "mobile_test_env"
tv tests:
extends: .tests_preparation_script
variables:
TESTS_TYPE: tvTest
APP_LOCATION: "app/build/outputs/apk/blackGooglePlayStore/debug/"
APP_TYPE: "black-google-playStore-debug.apk"
TEST_APP_LOCATION: "app/build/outputs/apk/androidTest/blackGooglePlayStore/debug/"
TEST_APP_TYPE: "black-google-playStore-debug-androidTest.apk"
TEST_SUITE: "com.protonvpn.testSuites.TvSuite"
TIMEOUT: $TIMEOUT_GENERAL_TESTS
# COVERAGE_FOLDER: "tv"
release tests:
extends: .tests_preparation_script
dependencies:
- build google play dev (monitoring release)
- export archive name # For ARCHIVES_BASE_NAME
variables:
TESTS_TYPE: smokeTest
APP_LOCATION: "app/build/outputs/apk/productionGoogleDev/release/"
APP_TYPE: "production-google-dev-release.apk"
TEST_APP_LOCATION: "release_tests/build/outputs/apk/release/"
TEST_APP_BASE_NAME: "release_tests"
TEST_APP_TYPE: "release.apk"
TEST_SUITE: "com.protonvpn.android.release_tests.suites.AllTests"
TIMEOUT: $TIMEOUT_GENERAL_TESTS
robo tests:
stage: test
timeout: 2h
needs:
- build google play dev (monitoring release)
- export archive name # For ARCHIVES_BASE_NAME
tags:
- shared-small
rules:
- if: $ROBO_TEST == "true"
when: always
- when: never
script:
- *firebase_authenticate_script
- gcloud firebase test android run
--type robo
--app "$APP"
--device model=Pixel2,version=30,locale=en,orientation=portrait
--device model=HWMHA,version=24,locale=en,orientation=portrait
--timeout $TIMEOUT
--robo-script=gs://protonvpn-testing-scripts/ProtonVPN_Login_Robo_Script.json
--robo-directives ignore:R.string.settings_sign_out=,ignore:R.string.settings_third_party_licenses=
variables:
TIMEOUT: $TIMEOUT_ROBO_TESTS
APP_LOCATION: "app/build/outputs/apk/productionGoogleDev/release/"
APP_TYPE: "production-google-dev-release.apk"
CHECKOUT_CORE_SUBMODULE: "true"
after_script:
- |
if [ $CI_JOB_STATUS == "failed" ]; then
curl -X POST -H 'Content-type: application/json' --data "{"text":':warn: Scheduled robo tests failed: \n$CI_JOB_URL'}" "$SLACK_QA_HOOK"
fi