Open4

actを使用してローカルでAndroid PJのworkflowを動かす

hiraokhiraok

yamlファイル

name: build
run-name: Build 🔄
on:
  pull_request:
    branches: [ main ]
jobs:
  build_jobs:
    runs-on: ubuntu-latest
    steps:
    - name: Check out code
      uses: actions/checkout@v2
    - name: Set up JDK 11
      uses: actions/setup-java@v2
      with:
        java-version: '11'
        distribution: 'zulu'
    - name: Setup Android SDK
      uses: android-actions/setup-android@v2
    - name: Grant execute permissions for gradlew
      run: chmod +x gradlew
    - name: Build with Gradle
      run: ./gradlew build
  1. actを以下のコマンドで実行
    act pull_request --env-file .env

  2. 結果

/run/act/actions/android-actions-setup-android@v2/dist/index.js:3546
|                     throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|                           ^
| 
| Error: Unable to locate executable file: unzip. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
|     at Object.<anonymous> (/run/act/actions/android-actions-setup-android@v2/dist/index.js:3546:27)
|     at Generator.next (<anonymous>)
|     at fulfilled (/run/act/actions/android-actions-setup-android@v2/dist/index.js:3357:58)
hiraokhiraok

結果

actの docker-imageがMicroに設定されていたため最小限のツールしか搭載されていなかったのが原因

解決方法

  1. ~./actrcを削除
  2. 再度 act --container-architecture linux/amd64 コマンドをたたいて実行
  3. mediumを選択

.envの設定は不要でした