Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How this action be compitable with gradle/gradle-build-action #229

Closed
Goooler opened this issue Mar 1, 2022 · 6 comments · Fixed by #230
Closed

How this action be compitable with gradle/gradle-build-action #229

Goooler opened this issue Mar 1, 2022 · 6 comments · Fixed by #230

Comments

@Goooler
Copy link
Contributor

Goooler commented Mar 1, 2022

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.

@ychescale9
Copy link
Member

ychescale9 commented Mar 1, 2022

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.

@Goooler
Copy link
Contributor Author

Goooler commented Mar 1, 2022

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

@Goooler
Copy link
Contributor Author

Goooler commented Mar 1, 2022

Seems it's not the workable path of Gradle, may need to still use actions/cache?

@ychescale9
Copy link
Member

Yes you still need to use gradle/cache to cache avd. gradle-build-action doesn't know anything about avd.

@Goooler
Copy link
Contributor Author

Goooler commented Mar 1, 2022

Thanks, gradle-build-action is really so fast! Should we note this issue in README?

@ychescale9
Copy link
Member

Yeah we can update the 3rd snippet. Feel free to send a pr:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants