Skip to content

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

Closed

Description

@Goooler

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.

Activity

  1. ychescale9 commented on Mar 1, 2022

    @ychescale9
    Member

    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.

  2. Goooler commented on Mar 1, 2022

    @Goooler
    ContributorAuthor

    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
    
  3. Goooler commented on Mar 1, 2022

    @Goooler
    ContributorAuthor

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

  4. ychescale9 commented on Mar 1, 2022

    @ychescale9
    Member

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

  5. Goooler commented on Mar 1, 2022

    @Goooler
    ContributorAuthor

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

  6. ychescale9 commented on Mar 1, 2022

    @ychescale9
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions