game-ci / unity-builder

Build Unity projects for different platforms
https://github.com/marketplace/actions/unity-builder
MIT License
839 stars 239 forks source link

Building on self-hosted Windows 10: Failed to run "sh " #389

Open Carsten-MaD opened 2 years ago

Carsten-MaD commented 2 years ago

Hey!

Bug description I am trying to set up a build pipeline, and since we have a lot of spare Windows 10 workstations around, I felt it would be a good use for them to be part of a build farm.

Unfortunately, it seems that there is a problem, please review the information below:

OS: Windows 10 64bit

Configuration

- uses: game-ci/unity-builder@v2
  env:
    UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
    UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
    UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
  with:
    unityVersion: '2019.2.17f1'
    targetPlatform: StandaloneWindows       

Error Log


##[debug]Evaluating: secrets.UNITY_EMAIL
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'UNITY_EMAIL'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: secrets.UNITY_PASSWORD
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'UNITY_PASSWORD'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: secrets.UNITY_SERIAL
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'UNITY_SERIAL'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating condition for step: 'Run game-ci/unity-builder@v2'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run game-ci/unity-builder@v2
##[debug]Loading inputs
##[debug]Loading env
Run game-ci/unity-builder@v2
  with:
    unityVersion: 2019.2.17f1
    targetPlatform: StandaloneWindows
    versioning: Semantic
    androidAppBundle: false
    awsBaseStackName: game-ci
    cloudRunnerCluster: local
    cloudRunnerCpu: 1.0
    cloudRunnerMemory: 750M
    kubeVolumeSize: 5Gi
  env:
    UNITY_EMAIL: ***
    UNITY_PASSWORD: ***
    UNITY_SERIAL: ***
Warning: 
      Library folder does not exist.
      Consider setting up caching to speed up your workflow,
      if this is not your first build.

##[debug]exec tool: C:\Program Files\Git\cmd\git.exearguments:   rev-parse   --is-shallow-repositoryExit code 0 received from tool 'C:\Program Files\Git\cmd\git.exe'STDIO streams have closed for tool 'C:\Program Files\Git\cmd\git.exe'
true

##[debug]exec tool: C:\Program Files\Git\cmd\git.exearguments:   fetch   --unshallowExit code 0 received from tool 'C:\Program Files\Git\cmd\git.exe'STDIO streams have closed for tool 'C:\Program Files\Git\cmd\git.exe'

Error: Failed to run "sh ".
 In-command error caught: Error: Unable to locate executable file: sh. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Run game-ci/unity-builder@v2```
Carsten-MaD commented 2 years ago

Adding C:\Program Files\Git\bin to $env:GITHUB_PATH solved the problem. I assume these bootstrapping steps are all taken care of in the Docker image?

webbertakken commented 2 years ago

Thanks for reporting this. Indeed this is not expected to happen on a Windows runner.

The windows runner isn't supposed to run sh at all. Someone will need to look into it.

frostebite commented 2 years ago

Same matter as discussed in: https://github.com/game-ci/unity-builder/issues/390

frostebite commented 2 years ago

See my reply: https://github.com/game-ci/unity-builder/issues/390#issuecomment-1105656623

deitry commented 2 years ago

It seems there is still a call to sh somewhere. Adding C:\Program Files\Git\bin to PATH surely helps

GitFlip commented 1 year ago

Seems like this may still be a problem according to this discord thread: https://discord.com/channels/710946343828455455/1088495967067713536

I switched to using a windows self-hosted runner when my GitHub Runner started failing to build because it was running out of memory. I cannot seem to get self-hosted to work as I get this same error.

I've tried adding C:\Program Files\Git\bin to $env:GITHUB_PATH and C:\Program Files\Git\bin to PATH, but still get the error.

Also I've tried using game-ci/unity-builder@v2, game-ci/unity-builder@cloud-runner-develop, and game-ci/unity-builder@main with no luck.

thebeater commented 1 year ago

Seems like this may still be a problem according to this discord thread: https://discord.com/channels/710946343828455455/1088495967067713536

I switched to using a windows self-hosted runner when my GitHub Runner started failing to build because it was running out of memory. I cannot seem to get self-hosted to work as I get this same error.

I've tried adding C:\Program Files\Git\bin to $env:GITHUB_PATH and C:\Program Files\Git\bin to PATH, but still get the error.

Also I've tried using game-ci/unity-builder@v2, game-ci/unity-builder@cloud-runner-develop, and game-ci/unity-builder@main with no luck.

@GitFlip same here. Did you get it working??

GitFlip commented 1 year ago

Seems like this may still be a problem according to this discord thread: https://discord.com/channels/710946343828455455/1088495967067713536 I switched to using a windows self-hosted runner when my GitHub Runner started failing to build because it was running out of memory. I cannot seem to get self-hosted to work as I get this same error. I've tried adding C:\Program Files\Git\bin to $env:GITHUB_PATH and C:\Program Files\Git\bin to PATH, but still get the error. Also I've tried using game-ci/unity-builder@v2, game-ci/unity-builder@cloud-runner-develop, and game-ci/unity-builder@main with no luck.

@GitFlip same here. Did you get it working??

Unfortunately I did not get it working yet.

Hawam commented 1 year ago

i have the same problem on windows 11 any one found a solution i added C:\Program Files\Git\bin to PATH i don't know how to add C:\Program Files\Git\bin to $env:GITHUB_PATH so i don't know if it may help

AntonioCoppe commented 11 months ago

Same Issue here.

wilg commented 10 months ago

I'm getting this error too with the following configuration (sha points to latest commit on main as of this writing, also tried with main):

jobs:
  windows_host:
    if: inputs.build_windows
    name: Windows
    runs-on: [self-hosted, "${{ matrix.platform[0] }}"]
    strategy:
      fail-fast: false
      matrix:
        platform:
          - [Windows, StandaloneWindows64]
    steps:
      - uses: actions/checkout@v3
        name: Git Checkout + LFS
        with:
          lfs: true
          fetch-depth: 0
          clean: false

      # - run: |
      #     "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchWindowsEngine
      #   shell: cmd
      #   name: Switch Docker to Windows Containers

      - run: |
          IF EXIST ${{github.workspace}}\Assets\Editor\UnityBuilderAction RMDIR /s /q ${{github.workspace}}\Assets\Editor\UnityBuilderAction
        shell: cmd
        name: Build Script Cleaning

      - uses: game-ci/unity-builder@7afabe74da5227a9ecd537f5260b398258c3eb3b
        name: Unity build
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
          UNITY_BUILDER_DOCKER_ARGS: "-m 28g --cpus 10 --gpus all"
        with:
          unityVersion: 2022.3.11f1
          targetPlatform: ${{ matrix.platform[1] }}
          buildName: Gumshoe
          allowDirtyBuild: true
Run game-ci/unity-builder@7afabe74da5[2](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:2)27a9ecd5[3](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:3)7f5260b398258c3eb3b
  with:
    unityVersion: 2022.3.11f1
    targetPlatform: StandaloneWindows6[4](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:4)
    buildName: Gumshoe
    allowDirtyBuild: true
    versioning: Semantic
    androidExportType: androidPackage
    androidSymbolType: none
    dockerIsolationMode: default
    awsStackName: game-ci
    providerStrategy: local
    kubeVolumeSize: [5](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:5)Gi
    watchToEnd: true
    cacheUnityInstallationOnMac: false
    dockerWorkspacePath: /github/workspace
  env:
    NODE_TLS_REJECT_UNAUTHORIZED: 0
    UNITY_LICENSE: ***
    UNITY_EMAIL: ***
    UNITY_PASSWORD: ***
    UNITY_BUILDER_DOCKER_ARGS: -m 28g --cpus 10 --gpus all
Warning: 
      Library folder does not exist.
      Consider setting up caching to speed up your workflow,
      if this is not your first build.

(node:44[7](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:7)0[8](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:8)) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in [20](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:20)[23](https://github.com/wilg/spaceshoe/actions/runs/6713154894/job/18244164245#step:4:24).

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
Error: Failed to run "sh ".
 In-command error caught: Error: Unable to locate executable file: sh. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
AndrewKahr commented 9 months ago

The simplest fix is to add git bash's bin directory to your path as it includes an sh executable. Since git is needed for the runners to work regardless this should be a decent workaround

Hawam commented 6 months ago

i have the same problem on windows 11 any one found a solution i added C:\Program Files\Git\bin to PATH i don't know how to add C:\Program Files\Git\bin to $env:GITHUB_PATH so i don't know if it may help

adding C:\Program Files\Git\bin to PATH for the system solved it for me i was adding it for the user PATH previously