@@ -7,11 +7,11 @@ defaults: &defaults
77 GRADLE_OPTS : ' -Dorg.gradle.jvmargs="-Xmx4g -XX:+HeapDumpOnOutOfMemoryError"'
88
99cache_key : &cache_key
10- key : jars-{{ checksum "build.gradle.kts" }}-{{ checksum "plugin/android-junit5/build.gradle.kts" }}-{{ checksum "plugin/android-junit5-tests/build.gradle.kts" }}-{{ checksum "instrumentation/api/build.gradle.kts" }}-{{ checksum "instrumentation/runner/build.gradle.kts" }}-{{ checksum "instrumentation/sample/build.gradle.kts" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
10+ key : jars-{{ checksum "build.gradle.kts" }}-{{ checksum "plugin/android-junit5/build.gradle.kts" }}-{{ checksum "plugin/android-junit5-tests/build.gradle.kts" }}-{{ checksum "instrumentation/api/build.gradle.kts" }}-{{ checksum "instrumentation/runner/build.gradle.kts" }}-{{ checksum "instrumentation/sample/build.gradle.kts" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "buildSrc/src/main/kotlin/Artifacts.kt" }}-{{ checksum "buildSrc/src/main/kotlin/Libs.kt" }}-{{ checksum "buildSrc/src/main/kotlin/Versions.kt" }}
1111
1212version : 2
1313jobs :
14- build :
14+ build_plugin :
1515 << : *defaults
1616 steps :
1717 - checkout
@@ -25,39 +25,84 @@ jobs:
2525 name : (Plugin) Test
2626 command : cd plugin && ./gradlew :android-junit5-tests:check --stacktrace --no-daemon
2727
28+ - persist_to_workspace :
29+ root : ~/root
30+ paths :
31+ - project
32+ - store_artifacts :
33+ path : plugin/android-junit5-tests/build/reports/tests/test
34+ destination : plugin
35+
36+ build_instrumentation :
37+ << : *defaults
38+ steps :
39+ - checkout
40+ - restore_cache :
41+ << : *cache_key
2842 - run :
2943 name : (Instrumentation) Download Dependencies
3044 command : cd instrumentation && ./gradlew androidDependencies --no-daemon
45+ - save_cache :
46+ << : *cache_key
47+ paths :
48+ - ~/.gradle/caches
49+ - ~/.gradle/wrapper
3150 - run :
3251 name : (Instrumentation) Build
33- command : cd instrumentation && ./gradlew :api:assemble :core:assemble :runner:assemble --stacktrace --no-daemon
52+ command : |
53+ cd instrumentation
54+ ./gradlew :api:assembleDebug \
55+ :core:assembleDebug :core:assembleDebugAndroidTest \
56+ :runner:assembleDebug \
57+ :sample:assembleDebug --stacktrace --no-daemon
3458 - run :
3559 name : (Instrumentation) Test
3660 command : cd instrumentation && ./gradlew :api:check :core:check :runner:check --stacktrace --no-daemon
61+ - run :
62+ name : Store Google Service Account
63+ command : echo $GCLOUD_SERVICE_KEY > ${HOME}/gcloud-service-key.json
64+ - run :
65+ name : Authorize gcloud and set config defaults
66+ command : |
67+ sudo gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json
68+ sudo gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
69+ - run :
70+ name : Test with Firebase Test Lab
71+ command : >
72+ sudo gcloud firebase test android run \
73+ --type instrumentation \
74+ --app instrumentation/sample/build/outputs/apk/debug/sample-debug.apk \
75+ --test instrumentation/core/build/outputs/apk/androidTest/debug/android-test-core-debug-androidTest.apk \
76+ --environment-variables runnerBuilder=de.mannodermaus.junit5.AndroidJUnit5Builder \
77+ --test-runner-class androidx.test.runner.AndroidJUnitRunner \
78+ --device model=sailfish,version=28,locale=en_US,orientation=portrait \
79+ --results-bucket cloud-test-${GOOGLE_PROJECT_ID} \
80+ --timeout 15m
81+ - run :
82+ name : Install gsutil dependency and copy test results data
83+ command : |
84+ sudo pip install -U crcmod
85+ mkdir test-lab-results
86+ sudo gsutil -m cp -r -U `sudo gsutil ls gs://cloud-test-${GOOGLE_PROJECT_ID} | tail -1` test-lab-results/ | true
3787
38- - save_cache :
39- << : *cache_key
40- paths :
41- - ~/.gradle/caches
42- - ~/.gradle/wrapper
4388 - persist_to_workspace :
4489 root : ~/root
4590 paths :
4691 - project
47- - store_artifacts :
48- path : plugin/android-junit5-tests/build/reports/tests/test
49- destination : plugin
5092 - store_artifacts :
5193 path : instrumentation/api/build/reports
5294 destination : instrumentation-api
5395 - store_artifacts :
5496 path : instrumentation/core/build/reports
5597 destination : instrumentation-core
98+ - store_artifacts :
99+ path : test-lab-results
100+ destination : instrumentation-core/test-lab-results
56101 - store_artifacts :
57102 path : instrumentation/runner/build/reports
58103 destination : instrumentation-runner
59104
60- deploy_snapshots :
105+ deploy_plugin_snapshots :
61106 << : *defaults
62107 steps :
63108 - attach_workspace :
@@ -67,6 +112,14 @@ jobs:
67112 - run :
68113 name : (Plugin) Deploy SNAPSHOTs
69114 command : cd plugin && ./gradlew publishLibraryPublicationToSnapshotRepository --stacktrace --no-daemon
115+
116+ deploy_instrumentation_snapshots :
117+ << : *defaults
118+ steps :
119+ - attach_workspace :
120+ at : ~/root
121+ - restore_cache :
122+ << : *cache_key
70123 - run :
71124 name : (Instrumentation) Deploy SNAPSHOTs
72125 command : cd instrumentation && ./gradlew publishLibraryPublicationToSnapshotRepository --stacktrace --no-daemon
@@ -98,24 +151,31 @@ workflows:
98151
99152 build_deploy :
100153 jobs :
101- - build
102- - deploy_snapshots :
154+ - build_plugin
155+ - build_instrumentation
156+ - deploy_plugin_snapshots :
157+ requires :
158+ - build_plugin
159+ filters :
160+ branches :
161+ only : master
162+ - deploy_instrumentation_snapshots :
103163 requires :
104- - build
164+ - build_instrumentation
105165 filters :
106166 branches :
107167 only : master
108168 - deploy_plugin_release :
109169 requires :
110- - build
170+ - build_plugin
111171 filters :
112172 branches :
113173 only : master
114174 tags :
115175 only : plugin-*
116176 - deploy_instrumentation_release :
117177 requires :
118- - build
178+ - build_instrumentation
119179 filters :
120180 branches :
121181 only : master
0 commit comments