@@ -13,8 +13,60 @@ concurrency:
1313 cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
1414
1515jobs :
16+ changes :
17+ name : Detect instrumented test changes
18+ if : github.event_name == 'pull_request'
19+ runs-on : ubuntu-latest
20+ timeout-minutes : 5
21+ permissions :
22+ contents : read
23+ outputs :
24+ run : ${{ steps.filter.outputs.run }}
25+ steps :
26+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+ with :
28+ fetch-depth : 2 # PR merge commit and both parents
29+ persist-credentials : false
30+
31+ - name : Match changed files
32+ id : filter
33+ shell : bash
34+ env :
35+ PR_HEAD_SHA : ${{ github.event.pull_request.head.sha }}
36+ PATTERNS : |
37+ src/main/*
38+ # Translations: the emulator runs in English.
39+ !src/main/res/values-*/strings.xml
40+ !src/main/assets/help/*
41+ src/main/assets/help/en/*
42+ src/foss/*
43+ src/fossDebug/*
44+ src/androidTest/*
45+ jni/deltachat-core-rust
46+ jni/Android.mk
47+ jni/Application.mk
48+ jni/dc_wrapper.c
49+ scripts/ndk-make.sh
50+ scripts/install-toolchains.sh
51+ scripts/rust-toolchain
52+ scripts/ci-emulator-settle.sh
53+ scripts/ci-changed-files.sh
54+ *.gradle
55+ gradle.properties
56+ gradle/*
57+ .github/workflows/instrumented-tests.yml
58+ run : |
59+ if [ "$(git rev-parse HEAD^2)" != "$PR_HEAD_SHA" ]; then
60+ echo "::error::HEAD is not the expected PR merge commit"
61+ exit 1
62+ fi
63+ run=$(bash scripts/ci-changed-files.sh HEAD^1 HEAD <<< "$PATTERNS")
64+ echo "run=$run" >> "$GITHUB_OUTPUT"
65+
1666 instrumented-tests :
1767 name : Run instrumented tests
68+ needs : changes
69+ if : ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.run == 'true') }}
1870 runs-on : ubuntu-latest
1971 timeout-minutes : 90
2072 permissions :
2476 EMU_TARGET : google_apis
2577 EMU_ARCH : x86_64
2678 EMU_PROFILE : pixel_10
79+ EMU_CORES : ' 4'
2780 outputs :
2881 results-url : ${{ steps.upload-results.outputs.artifact-url }}
2982 steps :
@@ -112,7 +165,7 @@ jobs:
112165 path : |
113166 ~/.android/avd/*
114167 ~/.android/adb*
115- key : avd-${{ env.EMU_API_LEVEL }}-${{ env.EMU_TARGET }}-${{ env.EMU_ARCH }}-${{ env.EMU_PROFILE }}-v1
168+ key : avd-${{ env.EMU_API_LEVEL }}-${{ env.EMU_TARGET }}-${{ env.EMU_ARCH }}-${{ env.EMU_PROFILE }}-v2
116169
117170 - name : Create AVD and generate snapshot
118171 if : steps.avd-cache.outputs.cache-hit != 'true'
@@ -122,10 +175,11 @@ jobs:
122175 target : ${{ env.EMU_TARGET }}
123176 arch : ${{ env.EMU_ARCH }}
124177 profile : ${{ env.EMU_PROFILE }}
178+ cores : ${{ env.EMU_CORES }}
125179 force-avd-creation : false
126180 emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
127181 disable-animations : false
128- script : echo "Generated AVD snapshot for caching."
182+ script : bash scripts/ci-emulator-settle.sh --dexopt
129183
130184 - name : Save AVD snapshot
131185 if : steps.avd-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main'
@@ -143,6 +197,7 @@ jobs:
143197 target : ${{ env.EMU_TARGET }}
144198 arch : ${{ env.EMU_ARCH }}
145199 profile : ${{ env.EMU_PROFILE }}
200+ cores : ${{ env.EMU_CORES }}
146201 force-avd-creation : false
147202 emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
148203 disable-animations : true
0 commit comments