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

Expand-Archive Fails #369

Open
AceCoderLaura opened this issue Nov 30, 2022 · 9 comments
Open

Expand-Archive Fails #369

AceCoderLaura opened this issue Nov 30, 2022 · 9 comments

Comments

@AceCoderLaura
Copy link
Contributor

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.

@yowpark
Copy link

yowpark commented Dec 13, 2022

I'm also experiencing the same error.

@ViliusSutkus89
Copy link
Collaborator

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

@AceCoderLaura
Copy link
Contributor Author

Just tried it with 3.0.0 and the problem persists unfortunately.

@ViliusSutkus89
Copy link
Collaborator

ViliusSutkus89 commented Sep 25, 2023 via email

@AceCoderLaura
Copy link
Contributor Author

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

@ViliusSutkus89
Copy link
Collaborator

ViliusSutkus89 commented Sep 25, 2023 via email

@ViliusSutkus89
Copy link
Collaborator

ViliusSutkus89 commented Sep 25, 2023 via email

@AceCoderLaura
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

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

3 participants