firebelley / godot-export

Automatically exports your Godot games.
MIT License
460 stars 53 forks source link

Mac build failing on ubuntu-latest #103

Closed sinnom closed 1 year ago

sinnom commented 1 year ago

My action builds the linux and windows files just fine, but the MacOS zip file produced is always empty. I am getting the following error during the export game step:

/home/runner/.local/share/godot/godot_executable/godot /home/runner/work/stream-captions/stream-captions/project.godot --headless --export-release mac /home/runner/.local/share/godot/builds/mac/stream-captions.zip
  Godot Engine v4.0.stable.official.92bee43ad - https://godotengine.org/

  WARNING: Custom cursor shape not supported by this display server.
       at: cursor_set_custom_image (servers/display_server.cpp:480)
  WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
       at: _editor_init (modules/gltf/register_types.cpp:70)
  ERROR: Cannot export project with preset "mac" due to configuration errors:
  Warning: Notarization is disabled. The exported project will be blocked by Gatekeeper if it's downloaded from an unknown source.
  Code signing: Xcode command line tools are not installed.

     at: _fs_changed (editor/editor_node.cpp:967)
  ERROR: Project export for preset "mac" failed.
     at: _fs_changed (editor/editor_node.cpp:983)

Full log at https://github.com/sinnom/stream-captions/actions/runs/4380350505/jobs/7667316410

Below is my github action workflow yaml:

# Whenever a tag push matching pattern "v*" then run the job
on: 
  push:
    tags:
      - "v*"

jobs:
  # job id, can be anything
  export_game:
    # Always use ubuntu-latest for this action
    runs-on: ubuntu-latest
    # Add permission for release creation. Can be made narrower according to your needs
    permissions: 
      contents: write
    # Job name, can be anything
    name: Export Game
    steps:
      # Always include the checkout step so that 
      # your project is available for Godot to export
    - name: checkout
      uses: actions/checkout@v3.0.2

    - name: export game
      id: export
      # Use latest version (see releases for all versions)
      uses: firebelley/godot-export@v4.7.0
      with:
        # Defining all the required inputs
        godot_executable_download_url: https://github.com/godotengine/godot/releases/download/4.0-stable/Godot_v4.0-stable_linux.x86_64.zip
        godot_export_templates_download_url: https://github.com/godotengine/godot/releases/download/4.0-stable/Godot_v4.0-stable_export_templates.tpz
        relative_project_path: ./
        archive_output: true
        use_godot_4: true

      # This release action has worked well for me. However, you can most likely use any release action of your choosing.
      # https://github.com/ncipollo/release-action
    - name: create release
      uses: ncipollo/release-action@v1.12.0
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        generateReleaseNotes: true
        draft: true
        tag: ${{ github.ref_name }}
        artifacts: ${{ steps.export.outputs.archive_directory }}/*

I don't think the cursor shape or blend file import warnings are relevant to the failed build, as I get those for the linux and windows builds which succeed both on my macbook and in the github action.

I don't think the notarization and code signing warnings are relevant to the failed build, as I get those when I build locally on my macbook too.

My MacOS export profile is the default one with the following changes:

firebelley commented 1 year ago

This error seems to indicate a problem with your export configuration. Please see if you can export for mac from your machine. If that doesn't work, then it is a configuration issue as indicated.

Based on the information provided, I do not think this issue is caused by this action. Please let me know if you think otherwise.

sinnom commented 1 year ago

Sorry, I could have been clearer. The export does work fine on my macbook. I think its possible Godot 4 has an issue exporting to mac from linux, however I wasn't having much luck finding anything about that, and I don't have a linux computer to test it on outside of the github action, so I came here next.

firebelley commented 1 year ago

This appears to be a configuration error related to Godot, and not specifically caused by this action.

I am also unable to find any good information about exporting from Linux to Mac. One suggestion I have for you is to run this action in a MacOS runner instead. It will cost you more Github Actions minutes, but it will be built in an environment that's known to work in your case. To do so, you can replace ubuntu-latest in your workflow with macos-latest.

I'd suggest giving that a try. Please feel free to reopen if you're still experiencing issues. Also note that if you're installing Wine in your workflow for the purposes of updating the windows icon, you will need to update your workflow to install Wine in a manner appropriate for Mac.

I hope that helps!

sinnom commented 1 year ago

Thanks for your time and suggestions!

Have just tried changing runs-on to macos-latest and set it to use the macos godot download. Received an error saying

  Error: ENOTDIR: not a directory, scandir '/Users/runner/.local/share/godot/godot_executable/Godot.app/Contents/CodeResources'

Should I create a new issue for this, or is it fine to continue in this thread?

The full export game error:

Run firebelley/godot-export@v4.7.0
  with:
    godot_executable_download_url: https://github.com/godotengine/godot/releases/download/4.0-stable/Godot_v4.0-stable_macos.universal.zip
    godot_export_templates_download_url: https://github.com/godotengine/godot/releases/download/4.0-stable/Godot_v4.0-stable_export_templates.tpz
    relative_project_path: ./
    archive_output: true
    use_godot_4: true
    archive_root_folder: false
    use_preset_export_path: false
    export_debug: false
    verbose: false
    export_as_pack: false
🕹️ Download Godot
  Working path created /Users/runner/.local/share/godot
  Downloading Godot export templates from https://github.com/godotengine/godot/releases/download/4.0-stable/Godot_v4.0-stable_export_templates.tpz
  Downloading Godot executable from https://github.com/godotengine/godot/releases/download/4.0-stable/Godot_v4.0-stable_macos.universal.zip
  /usr/local/bin/wget -nv https://github.com/godotengine/godot/releases/download/4.0-stable/Godot_v4.0-stable_export_templates.tpz -O /Users/runner/.local/share/godot/godot_templates.tpz
  /usr/local/bin/wget -nv https://github.com/godotengine/godot/releases/download/4.0-stable/Godot_v4.0-stable_macos.universal.zip -O /Users/runner/.local/share/godot/godot.zip
  2023-03-11 19:57:17 URL:https://objects.githubusercontent.com/github-production-release-asset-2e65be/15634981/383b3d5a-0102-41bf-b6e5-c491fdda61c3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230311%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230311T195715Z&X-Amz-Expires=300&X-Amz-Signature=b998077ec1417ebd7b1fa1cb87a76ab0a3c8150a51f58cc7a6c2e764c6d9e7cb&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=15634981&response-content-disposition=attachment%3B%20filename%3DGodot_v4.0-stable_macos.universal.zip&response-content-type=application%2Foctet-stream [99622882/99622882] -> "/Users/runner/.local/share/godot/godot.zip" [1]
  2023-03-11 19:57:42 URL:https://objects.githubusercontent.com/github-production-release-asset-2e65be/15634981/8d72a89e-e929-4865-b594-c01fae109bfc?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230311%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230311T195715Z&X-Amz-Expires=300&X-Amz-Signature=26aa3d079a2bab97d39d0904ea20f19dc6721a07d321428205e454a5763e93b8&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=15634981&response-content-disposition=attachment%3B%20filename%3DGodot_v4.0-stable_export_templates.tpz&response-content-type=application%2Foctet-stream [793224714/793224714] -> "/Users/runner/.local/share/godot/godot_templates.tpz" [1]
  /usr/local/bin/7z x /Users/runner/.local/share/godot/godot.zip -o/Users/runner/.local/share/godot/godot_executable -y

  7-Zip [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
  p7zip Version 17.04 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,3 CPUs x64)

  Scanning the drive for archives:
  1 file, 99622882 bytes (96 MiB)

  Extracting archive: /Users/runner/.local/share/godot/godot.zip
  --
  Path = /Users/runner/.local/share/godot/godot.zip
  Type = zip
  Physical Size = 99622882

  Everything is Ok

  Folders: 73
  Files: 79
  Size:       225969541
  Compressed: 99622882
  Error: ENOTDIR: not a directory, scandir '/Users/runner/.local/share/godot/godot_executable/Godot.app/Contents/CodeResources'
firebelley commented 1 year ago

Thanks for giving that a try, unfortunately it looks like this action is not quite supportive of building on a mac runner. I found this documentation which indicates that the executable path needs to be slightly changed on mac runners. I will address that.

In the meantime, I was able to verify on my end that exporting to Mac from Linux works using this action. The way I got it to work was to modify the export configuration and set "Codesign" to "Built-in" and turn "Notarization" to "disabled". I also needed to supply a "Bundle Identifier". Can you confirm that yours is configured this way?

firebelley commented 1 year ago

Also if you want, you can try running your action with macos-latest and using firebelley/godot-export@develop. On that develop branch I have mac runner support working. I do still think your original error indicates an issue with the export configuration but you are welcome to try out the develop branch to see if that gets everything building correctly!

sinnom commented 1 year ago

Thanks for giving that a try, unfortunately it looks like this action is not quite supportive of building on a mac runner. I found this documentation which indicates that the executable path needs to be slightly changed on mac runners. I will address that.

In the meantime, I was able to verify on my end that exporting to Mac from Linux works using this action. The way I got it to work was to modify the export configuration and set "Codesign" to "Built-in" and turn "Notarization" to "disabled". I also needed to supply a "Bundle Identifier". Can you confirm that yours is configured this way?

These changes got it working on ubuntu-latest! Thank you for all your help!

firebelley commented 1 year ago

You're welcome!

chtzvt commented 11 months ago

For others encountering this issue-- It seems some macOS build config options were changed slightly between Godot 3.5 and 4.1. Make sure you're using a build config generated with v4.

In particular, the notarization/enable and codesign/enable options from earlier Godot versions appear to be deprecated and replaced with notarization/notarization and codesign/codesign.