|
1 | 1 | machine:
|
2 | 2 | environment:
|
3 |
| - CLOUDSDK_CORE_DISABLE_PROMPTS: 1 |
4 |
| - CLOUDSDK_PYTHON_SITEPACKAGES: 1 |
5 |
| - CLOUDSDK_INSTALL_DIR: /tmp |
6 | 3 | MAX_RETRY: 4
|
7 | 4 | java:
|
8 | 5 | version: oraclejdk8
|
9 | 6 |
|
10 | 7 | dependencies:
|
11 | 8 | pre:
|
12 | 9 | - echo y | android update sdk --no-ui --all --filter "android-25,build-tools-25.0.0,tools,platform-tools,extra-android-m2repository"
|
13 |
| - # For some reasons, there is an issue with the pre-installed gcloud that |
14 |
| - # PyOpenSSL is not available when trying to activate the service account. |
15 |
| - # Re-installing the gcloud worked as a workaround. |
16 |
| - # See https://discuss.circleci.com/t/deployment-to-appengine-fails-pyopenssl-not-available/2154 |
17 |
| - |
18 |
| - # Suppress the gcloud installation if the PR is from a forked repository |
19 |
| - # Because environment variables configured from the Circle CI UI are not |
20 |
| - # visible for the PRs from forked repositories. |
21 |
| - - > |
22 |
| - if [ -n "$GCLOUD_SERVICE_KEY" ]; then sudo apt-get remove python-virtualenv python-openssl python3-openssl ; |
23 |
| - sudo apt-get update; |
24 |
| - sudo apt-get install python-openssl python3-openssl ; |
25 |
| - sudo rm -rf /opt/google-cloud-sdk/ ; |
26 |
| - curl https://sdk.cloud.google.com | bash ; |
27 |
| - source ~/.bashrc ; |
28 |
| - fi |
29 | 10 | cache_directories:
|
30 | 11 | - ~/.android
|
31 | 12 | override:
|
32 | 13 | - ./gradlew dependencies
|
33 | 14 | post:
|
34 | 15 | - >
|
35 | 16 | if [ -n "$GCLOUD_SERVICE_KEY" ]; then echo ${GCLOUD_SERVICE_KEY} | base64 --decode > ${HOME}/client-secret.json ;
|
36 |
| - /tmp/google-cloud-sdk/bin/gcloud config set project ${GCLOUD_PROJECT} ; |
37 |
| - /tmp/google-cloud-sdk/bin/gcloud --quiet components update ; |
38 |
| - /tmp/google-cloud-sdk/bin/gcloud --quiet components install beta ; |
39 |
| - /tmp/google-cloud-sdk/bin/gcloud auth activate-service-account ${GCLOUD_SERVICE_ACCOUNT} --key-file ${HOME}/client-secret.json ; |
| 17 | + gcloud config set project ${GCLOUD_PROJECT} ; |
| 18 | + sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update ; |
| 19 | + sudo /opt/google-cloud-sdk/bin/gcloud --quiet components install beta ; |
| 20 | + gcloud auth activate-service-account ${GCLOUD_SERVICE_ACCOUNT} --key-file ${HOME}/client-secret.json ; |
40 | 21 | fi
|
41 | 22 |
|
42 | 23 | test:
|
43 | 24 | override:
|
44 | 25 | - ./gradlew build assembleAndroidTest
|
45 | 26 | - >
|
| 27 | + # Suppress running the instrumentation tests if the PR is from a forked repository |
| 28 | + # because environment variables configured from the Circle CI UI are not |
| 29 | + # visible for the PRs from forked repositories that are required to run the tests |
| 30 | + # on the Firebase Test Lab. |
46 | 31 | if [ -n "$GCLOUD_SERVICE_KEY" ]; then set +e ;
|
47 | 32 | counter=0 ;
|
48 | 33 | result=1 ;
|
49 | 34 | while [ $result != 0 -a $counter -lt $MAX_RETRY ]; do
|
50 |
| - /tmp/google-cloud-sdk/bin/gcloud beta test android run --type instrumentation --app app/build/outputs/apk/app-debug.apk --test flexbox/build/outputs/apk/flexbox-debug-androidTest.apk --device-ids hammerhead,flounder,condor_umts --os-version-ids 19,21,23 --locales en --orientations portrait,landscape --results-bucket ${GCLOUD_TEST_BUCKET_LIBRARY} --timeout 180s ; |
| 35 | + gcloud beta test android run --type instrumentation --app app/build/outputs/apk/app-debug.apk --test flexbox/build/outputs/apk/flexbox-debug-androidTest.apk --device-ids hammerhead,flounder,condor_umts --os-version-ids 19,21,23 --locales en --orientations portrait,landscape --results-bucket ${GCLOUD_TEST_BUCKET_LIBRARY} --timeout 180s ; |
51 | 36 | result=$? ;
|
52 | 37 | let counter=counter+1 ;
|
53 | 38 | done
|
54 | 39 | exit $result ;
|
55 | 40 | fi
|
56 | 41 | post:
|
57 |
| - - if [ -n "$GCLOUD_SERVICE_KEY" ]; then /tmp/google-cloud-sdk/bin/gsutil -m cp -r -U `/tmp/google-cloud-sdk/bin/gsutil ls gs://${GCLOUD_TEST_BUCKET_LIBRARY} | tail -1` $CIRCLE_ARTIFACTS/ | true ; fi |
| 42 | + - if [ -n "$GCLOUD_SERVICE_KEY" ]; then gsutil -m cp -r -U `gsutil ls gs://${GCLOUD_TEST_BUCKET_LIBRARY} | tail -1` $CIRCLE_ARTIFACTS/ | true ; fi |
0 commit comments