How this action be compitable with gradle/gradle-build-action
Goooler opened this issue · 6 comments
My current config:
- name: Prepare instrumentation
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
- name: Instrumentation tests
uses: gradle/gradle-build-action@v2
with:
arguments: connectedDebugAndroidTest
Replaced script: ./gradlew connectedDebugAndroidTest
with executing connectedDebugAndroidTest
by gradle/gradle-build-action, but error thrown:
Error: Input required and not supplied: script
How can I use this action with gradle/gradle-build-action
?
Can reproduce this issue in Goooler/DemoApp/pull/39.
The emulator process is only available when the action is running, so you have to run your tests in the script
block.
You can try to add uses: gradle/gradle-build-action@v2
without any arguments before reactivecircus/android-emulator-runner@v2
.
If no arguments are provided, the action will not execute Gradle, but will still cache Gradle state and configure build-scan capture for all subsequent Gradle executions.
I've also cached the AVD as your recommendation in README, change the config to below can make AVD cache work?
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- uses: gradle/gradle-build-action@v2
id: avd-cache
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew connectedDebugAndroidTest
Seems it's not the workable path of Gradle, may need to still use actions/cache
?
Yes you still need to use gradle/cache to cache avd. gradle-build-action
doesn't know anything about avd.
Thanks, gradle-build-action
is really so fast! Should we note this issue in README?
Yeah we can update the 3rd snippet. Feel free to send a pr:)