dAppServer / wails-build-action

GitHub action to build Wails.io
European Union Public License 1.2
34 stars 29 forks source link

Fails when building executable for windows on a mac #16

Open csikosjanos opened 9 months ago

csikosjanos commented 9 months ago

Thank you for this great tool. It makes life much easier.

I'm having a github actions that runs on a mac (runner.os == 'MacOS') and trying to build a windows executable (inputs.build-platform is 'windows/amd64').

The build works if it run locally although it fails in GHA runner.

Error context:

Run wails build --platform windows/amd64 -webview2 download -o my-project-name
Wails CLI v2.7.1

# Build Options

Platform(s)        | windows/amd64                                                                           
Compiler           | /Users/myuser/.actions-runner/_work/_tool/go/1.21.5/arm64/bin/go                    
Skip Bindings      | false                                                                                   
Build Mode         | ***                                                                              
Devtools           | false                                                                                   
Frontend Directory | /Users/myuser/.actions-runner/_work/my-repo-name/my-repo-name/frontend
Obfuscated         | false                                                                                   
Skip Frontend      | false                                                                                   
Compress           | false                                                                                   
Package            | ***                                                                                    
Clean Bin Dir      | false                                                                                   
LDFlags            |                                                                                         
Tags               | []                                                                                      
Race Detector      | false                                                                                   
Output File        | my-project-name                                                               

# Building target: windows/amd64

  • Generating bindings: Done.
  • Installing frontend dependencies: Done.
  • Compiling frontend: Done.
  • Generating application assets: Done.
  • Compiling application: Done.
 INFO  Wails is now using the new Go WebView2Loader. If you encounter any issues with it, please report them to https://github.com/wailsapp/wails/issues/[200](https://github.com/my-org/my-repo-name/actions/runs/7214038146/job/19655251146#step:4:209)4. You could also use the old legacy loader with `-tags native_webview2loader`, but keep in mind this will be deprecated in the near future.
Built '/Users/myuser/.actions-runner/_work/my-repo-name/my-repo-name/build/bin/my-project-name' in 5.993s.

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
Run chmod +x build/bin/*/Contents/MacOS/*
chmod: build/bin/*/Contents/MacOS/*: No such file or directory
Error: Process completed with exit code 1.

It does make sense. We don't have such a path when building a windows app.

Would it help if the condition in the Add macOS perms checks the inputs.build-platform instead of runner.os, or that would cause even more chaos?

    - name: Add macOS perms
      if: inputs.build == 'true' && runner.os == 'macOS'
      working-directory: ${{ inputs.app-working-directory }}
      run: chmod +x build/bin/*/Contents/MacOS/*
      shell: bash

to

    - name: Add macOS perms
      if: inputs.build == 'true' && startsWith(inputs.build-platform, 'darwin')
      working-directory: ${{ inputs.app-working-directory }}
      run: chmod +x build/bin/*/Contents/MacOS/*
      shell: bash

Many thanks for the insight and the help.