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

Running emulator with cache on multiple jobs causes the jobs to hang. #362

Open
syedahmedjamil opened this issue Dec 26, 2023 · 3 comments

Comments

@syedahmedjamil
Copy link

I want to run the emulator with cache on two jobs in parallel but the jobs seems to just hang at the end when its time to terminate the emulator. Instead the step keeps running and workflow doesn't ends.

Note: If I remove the step "AVD cache" and "create AVD and generate snapshot for caching" from both jobs then it works fine.

Why does it hang with cache ?

my-workflow.yml file

name: My Workflow

on:
  pull_request:
    branches: [ "dev" ]

jobs:
  job1:
    runs-on: macos-latest
    strategy:
      matrix:
        api-level: [29]
    steps:
      - name: checkout
        uses: actions/checkout@v3

      - name: Gradle cache
        uses: gradle/gradle-build-action@v2
        
      - name: AVD cache
        uses: actions/cache@v3
        id: avd-cache
        with:
          path: |
            ~/.android/avd/*
            ~/.android/adb*
          key: avd-${{ matrix.api-level }}

      - 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: run 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: echo "Done"

  job2:
    runs-on: macos-latest
    strategy:
      matrix:
        api-level: [29]
    steps:
      - name: checkout
        uses: actions/checkout@v3

      - name: Gradle cache
        uses: gradle/gradle-build-action@v2
        
      - name: AVD cache
        uses: actions/cache@v3
        id: avd-cache
        with:
          path: |
            ~/.android/avd/*
            ~/.android/adb*
          key: avd-${{ matrix.api-level }}

      - 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: run 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: echo "Done"

job1 state
image

job2 state
image

@fillobotto
Copy link

I'm experiencing the same problem

@ericswpark
Copy link

Same issue here. CI gets stuck if AVD is cached: https://github.com/Purdue-CS307-tsundoku/tsundoku/actions/runs/8320789292/job/22766040436 I had to manually cancel the workflow run.

ericswpark added a commit to Purdue-CS307-tsundoku/tsundoku that referenced this issue Mar 18, 2024
Caching AVD causes the emulator action step to hang, see the following
URL for more info:
ReactiveCircus/android-emulator-runner#362
amberin added a commit to amberin/orgzly-android-revived that referenced this issue Apr 24, 2024
@MohitMaliFtechiz
Copy link

MohitMaliFtechiz commented Apr 26, 2024

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

No branches or pull requests

4 participants