setup-android icon indicating copy to clipboard operation
setup-android copied to clipboard

Expand-Archive Fails

Open AceCoderLaura opened this issue 1 year ago • 9 comments

After updating the action version from 2.0.7 to 2.0.10 I get this error when running my build:

C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner\_work\_temp\728e1df8-2583-4a31-b353-58244a48fb67' -DestinationPath 'C:\actions-runner\_work\_temp\de2e8fc6-b438-4830-8347-350bc9fcbeec' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\actions-runner\_work\_temp\728e1df8-2583-4a31-b353-58244a48fb67', 'C:\actions-runner\_work\_temp\de2e8fc6-b438-4830-8347-350bc9fcbeec', $true) }"
Expand-Archive :  is not a supported archive file format. .zip is the only supported archive file format.
At line:1 char:210
+ ...  Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner\_work\_tem ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:String) [Expand-Archive], IOException
    + FullyQualifiedErrorId : NotSupportedArchiveFileExtension,Expand-Archive
 
C:\actions-runner\_work\_actions\android-actions\setup-android\v2.0.10\dist\index.js:2348
                error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
                        ^

Error: The process 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
    at ExecState._setResult (C:\actions-runner\_work\_actions\android-actions\setup-android\v2.0.10\dist\index.js:2348:25)
    at ExecState.CheckComplete (C:\actions-runner\_work\_actions\android-actions\setup-android\v2.0.10\dist\index.js:2331:18)
    at ChildProcess.<anonymous> (C:\actions-runner\_work\_actions\android-actions\setup-android\v2.0.10\dist\index.js:2225:27)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

The YAML for this step is as follows:

      - name: Setup Android SDK
        uses: android-actions/[email protected]

The runner is self-hosted on Microsoft Windows Server 2019 Datacenter.

AceCoderLaura avatar Nov 30 '22 04:11 AceCoderLaura

I'm also experiencing the same error.

yowpark avatar Dec 13 '22 04:12 yowpark

Hello, sorry for the extra late reply. From the log it seems like the error happens when trying to expand the zip file. Could you please check if it still happens with the current release? A bunch of node dependencies got updated, it might just solve it. If not, we'll have to look into it

ViliusSutkus89 avatar Sep 25 '23 02:09 ViliusSutkus89

Just tried it with 3.0.0 and the problem persists unfortunately.

AceCoderLaura avatar Sep 25 '23 04:09 AceCoderLaura

Could you post the log?

-------- Original Message -------- On Sep 25, 2023, 07:05, Laura wrote:

Just tried it with 3.0.0 and the problem persists unfortunately.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

ViliusSutkus89 avatar Sep 25 '23 04:09 ViliusSutkus89

Run android-actions/[email protected]
  env:
    BUILD_CONFIGURATION: Release
    ANDROID_PROJECT_PATH: src\Adapt.Presentation.Xivic.Android\Adapt.Presentation.Xivic.Android.csproj
    IOS_PROJECT_PATH: src\Adapt.Presentation.Xivic.iOS\Adapt.Presentation.Xivic.iOS.csproj
    UWP_PROJECT_PATH: src\Adapt.Presentation.Xivic.UWP\Adapt.Presentation.Xivic.UWP.csproj
    JAVA_HOME: C:\actions-runner\_work\_tool\Java_Zulu_jdk\8.0.322-6\x64
    JAVA_HOME_8_X64: C:\actions-runner\_work\_tool\Java_Zulu_jdk\8.0.322-6\x64
C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner\_work\_temp\7b936509-c8e0-48fa-80bb-302dc4a0b166' -DestinationPath 'C:\actions-runner\_work\_temp\21f78b1c-5647-4894-acd4-c3d269b7ecd3' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\actions-runner\_work\_temp\7b936509-c8e0-48fa-80bb-302dc4a0b166', 'C:\actions-runner\_work\_temp\21f78b1c-5647-4894-acd4-c3d269b7ecd3', $true) }"
Expand-Archive :  is not a supported archive file format. .zip is the only supported archive file format.
At line:1 char:210
+ ...  Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner\_work\_tem ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:String) [Expand-Archive], IOException
    + FullyQualifiedErrorId : NotSupportedArchiveFileExtension,Expand-Archive
 
C:\actions-runner\_work\_actions\android-actions\setup-android\v3.0.0\dist\index.js:2348
                error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
                        ^

Error: The process 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
    at ExecState._setResult (C:\actions-runner\_work\_actions\android-actions\setup-android\v3.0.0\dist\index.js:2348:25)
    at ExecState.CheckComplete (C:\actions-runner\_work\_actions\android-actions\setup-android\v3.0.0\dist\index.js:2331:18)
    at ChildProcess.<anonymous> (C:\actions-runner\_work\_actions\android-actions\setup-android\v3.0.0\dist\index.js:2225:27)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

Node.js v20.5.0

AceCoderLaura avatar Sep 25 '23 04:09 AceCoderLaura

Which powershell version do you have? I see this is a common issue

https://github.com/actions/runner/issues/1883 https://github.com/actions/setup-go/issues/241

-------- Original Message -------- On Sep 25, 2023, 07:10, Laura wrote:

ViliusSutkus89 avatar Sep 25 '23 04:09 ViliusSutkus89

Also, once we solve this, you are going to run into the JDK 17 requirement. From your log I see you're still on JDK 8. See Readme.md on how to change the JDK

-------- Original Message -------- On Sep 25, 2023, 07:21, Vilius Sutkus wrote:

Which powershell version do you have? I see this is a common issue

https://github.com/actions/runner/issues/1883 https://github.com/actions/setup-go/issues/241

-------- Original Message -------- On Sep 25, 2023, 07:10, Laura wrote:

ViliusSutkus89 avatar Sep 25 '23 04:09 ViliusSutkus89

Looks like it's version 5.1 which seems to ship with most Windows versions. I'll have to find an action to install PowerShell Core if I want my builds to be reproducible on other runner hosts. I'll let you know how it goes.

AceCoderLaura avatar Sep 25 '23 04:09 AceCoderLaura

For those also self-hosting on Windows and want a reproducible build, here's my steps to ensure PowerShell Core is installed before running setup-android. The exit code is ignored because it will return 1 if PowerShell Core is already installed. Since we're already using dotnet in our builds anyway, installing via dotnet was the easiest approach but there are other methods available.

  - name: Setup .NET Core
    uses: actions/setup-dotnet@v3
    with:
      dotnet-version: 6.0.x
    env:
      DOTNET_INSTALL_DIR: ~/.dotnet

  - name: Setup PowerShell Core
    continue-on-error: true
    run: dotnet tool install --global PowerShell

  - name: Setup Android SDK
    uses: android-actions/[email protected]

This solves the issue for me so I hope it helps others as well.

AceCoderLaura avatar Sep 25 '23 07:09 AceCoderLaura