Fix first time popup losing focus when selecting paths #862
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🍎 macOS Builds | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
env: | |
GODOT_VERSION: "4.2.1" | |
jobs: | |
extract-sdk: | |
runs-on: "macos-12" | |
name: Extract SDK | |
steps: | |
- name: "Load cache" | |
uses: actions/cache@v4 | |
id: "cache" | |
with: | |
path: cached_builds/sdk | |
key: MacOS-sdk | |
save-always: true | |
lookup-only: true | |
continue-on-error: true | |
- name: "Checkout osxcross" | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/checkout@v3 | |
with: | |
repository: tpoechtrager/osxcross | |
- name: "Extract SDK" | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
XCODEDIR=/Applications/Xcode_14.0.1.app ./tools/gen_sdk_package.sh | |
mkdir -p -v cached_builds/sdk | |
mv MacOSX12.3.sdk.tar.xz cached_builds/sdk | |
build-ffmpeg: | |
needs: extract-sdk | |
runs-on: "ubuntu-20.04" | |
name: Build FFMPEG (${{ matrix.name }}) | |
strategy: | |
matrix: | |
include: | |
- name: Intel CPUs (x86_64) | |
cache_key: x86_64 | |
arch: macos64 | |
- name: ARM CPUs (arm64) | |
cache_key: arm64 | |
arch: macosarm64 | |
steps: | |
- name: "Check cached build" | |
uses: actions/cache@v4 | |
id: "cache_ffmpeg" | |
with: | |
path: cached_builds/ffmpeg/${{ matrix.arch }} | |
key: MacOS-${{ matrix.cache_key }}-ffmpeg-build | |
save-always: true | |
lookup-only: true | |
continue-on-error: true | |
- name: "Load SDK" | |
if: steps.cache_ffmpeg.outputs.cache-hit != 'true' | |
uses: actions/cache@v4 | |
id: "cache-sdk" | |
with: | |
path: cached_builds/sdk | |
key: MacOS-sdk | |
fail-on-cache-miss: true | |
continue-on-error: false | |
- name: "Checkout FFmpeg" | |
if: steps.cache_ffmpeg.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: retrohub-org/FFmpeg-Builds | |
path: "ffmpeg" | |
- name: "Free space" | |
if: steps.cache_ffmpeg.outputs.cache-hit != 'true' | |
run: | | |
df -h | |
sudo apt-get clean | |
docker system prune -a -f | |
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc | |
df -h | |
- name: "Compilation" | |
if: steps.cache_ffmpeg.outputs.cache-hit != 'true' | |
working-directory: ./ffmpeg | |
run: | | |
mv ../cached_builds/sdk/MacOSX12.3.sdk.tar.xz images/base-${{ matrix.arch }} | |
./makeimage.sh ${{ matrix.arch }} lgpl-godot 6.0 | |
./build.sh ${{ matrix.arch }} lgpl-godot 6.0 | |
mkdir -p -v ../cached_builds/ffmpeg/${{ matrix.arch }} | |
tar -xvf artifacts/ffmpeg*${{ matrix.arch }}-lgpl-godot-6.0.tar.xz --directory=../cached_builds/ffmpeg/${{ matrix.arch }} --strip-components=1 | |
ls -la ../cached_builds/ffmpeg/${{ matrix.arch }} | |
build-eirteam_ffmpeg: | |
runs-on: "macos-12" | |
name: Build EIRTeam.FFmpeg | |
needs: [build-ffmpeg] | |
steps: | |
- name: "Check cached build" | |
uses: actions/cache@v4 | |
id: "cache_eirteam_ffmpeg" | |
with: | |
path: cached_builds/eirteam_ffmpeg | |
key: MacOS-eirteam_ffmpeg-build | |
restore-keys: MacOS-eirteam_ffmpeg-build | |
save-always: true | |
lookup-only: true | |
continue-on-error: true | |
- name: "Load FFmpeg build (x86_64)" | |
id: "cache_ffmpeg_x86_64" | |
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: cached_builds/ffmpeg/macos64 | |
key: MacOS-x86_64-ffmpeg-build | |
restore-keys: MacOS-x86_64-ffmpeg-build | |
fail-on-cache-miss: true | |
continue-on-error: false | |
- name: "Load FFmpeg build (arm64)" | |
id: "cache_ffmpeg_arm64" | |
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: cached_builds/ffmpeg/macosarm64 | |
key: MacOS-arm64-ffmpeg-build | |
restore-keys: MacOS-arm64-ffmpeg-build | |
fail-on-cache-miss: true | |
continue-on-error: false | |
- name: "Checkout EIRTeam.FFmpeg" | |
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: retrohub-org/EIRTeam.FFmpeg | |
submodules: recursive | |
path: "eirteam_ffmpeg" | |
- name: "Install dependencies" | |
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true' | |
run: | | |
python -m pip install scons==4.4.0 | |
- name: "Merge FFmpeg builds" | |
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p -v eirteam_ffmpeg/thirdparty/ | |
mv ${{ github.workspace }}/cached_builds/ffmpeg/macos64 eirteam_ffmpeg/thirdparty/ffmpeg | |
cd eirteam_ffmpeg/thirdparty/ffmpeg | |
mv lib lib_work | |
mkdir -p -v lib | |
for f in lib_work/*.dylib; do | |
if [ -h $f ]; then # Symlink | |
cp $f lib | |
else # File | |
lipo -create $f ${{ github.workspace }}/cached_builds/ffmpeg/macosarm64/lib/$(basename $f) -output lib/$(basename $f) | |
fi | |
done | |
file lib/*.dylib | |
- name: "Compilation" | |
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true' | |
working-directory: ./eirteam_ffmpeg | |
run: | | |
cd gdextension_build | |
scons arch=universal verbose=yes target=template_release | |
mkdir -p -v ${{ github.workspace }}/cached_builds/eirteam_ffmpeg | |
ls -R build/addons/ffmpeg/ | |
cp -r -v build/addons/ffmpeg/macos ${{ github.workspace }}/cached_builds/eirteam_ffmpeg | |
build-godot: | |
runs-on: "macos-12" | |
name: Build Godot | |
steps: | |
- name: "Check cached build" | |
uses: actions/cache@v4 | |
id: "cache_godot" | |
with: | |
path: | | |
cached_builds/editor/godot | |
cached_builds/template/macos.zip | |
key: MacOS-godot-build | |
restore-keys: MacOS-godot-build | |
save-always: true | |
lookup-only: true | |
continue-on-error: true | |
- name: "Checkout Custom Godot" | |
if: steps.cache_godot.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: retrohub-org/godot | |
ref: retrohub_patches_4x | |
path: "godot" | |
- name: "Install dependencies" | |
if: steps.cache_godot.outputs.cache-hit != 'true' | |
run: | | |
brew install scons yasm | |
- name: "Setup Godot build cache" | |
if: steps.cache_godot.outputs.cache-hit != 'true' | |
uses: ./godot/.github/actions/godot-cache | |
with: | |
cache-name: macos-template | |
continue-on-error: true | |
- name: "Setup python and scons" | |
if: steps.cache_godot.outputs.cache-hit != 'true' | |
uses: ./godot/.github/actions/godot-deps | |
- name: "Setup Vulkan SDK" | |
if: steps.cache_godot.outputs.cache-hit != 'true' | |
run: | | |
sh godot/misc/scripts/install_vulkan_sdk_macos.sh | |
- name: "Compilation [editor]" | |
if: steps.cache_godot.outputs.cache-hit != 'true' | |
uses: ./godot/.github/actions/godot-build | |
with: | |
root: ./godot | |
sconsflags: verbose=yes werror=no production=yes | |
platform: macos | |
target: editor | |
- name: "Compilation [template] (x86_64)" | |
if: steps.cache_godot.outputs.cache-hit != 'true' | |
uses: ./godot/.github/actions/godot-build | |
with: | |
root: ./godot | |
sconsflags: verbose=yes warnings=all werror=no use_lto=yes optimize=size arch=x86_64 | |
platform: macos | |
target: template_release | |
- name: "Compilation [template] (arm64)" | |
if: steps.cache_godot.outputs.cache-hit != 'true' | |
uses: ./godot/.github/actions/godot-build | |
with: | |
root: ./godot | |
sconsflags: verbose=yes warnings=all werror=no use_lto=yes optimize=size arch=arm64 | |
platform: macos | |
target: template_release | |
- name: "Clean and cache template build" | |
if: steps.cache_godot.outputs.cache-hit != 'true' | |
working-directory: godot | |
run: | | |
mkdir -p -v ${{ github.workspace }}/cached_builds/editor | |
cp bin/godot.macos.editor.* ${{ github.workspace }}/cached_builds/editor/godot | |
cp -r misc/dist/macos_template.app . | |
mkdir -p -v macos_template.app/Contents/MacOS | |
lipo -create bin/godot.macos.template_release.x86_64 bin/godot.macos.template_release.arm64 -output macos_template.app/Contents/MacOS/godot_macos_release.universal | |
chmod +x macos_template.app/Contents/MacOS/godot_macos_release.universal | |
codesign --force -s - \ | |
--options=linker-signed \ | |
-v macos_template.app/Contents/MacOS/* | |
zip -q -9 -r macos.zip macos_template.app | |
mkdir -p -v ${{ github.workspace }}/cached_builds/template | |
mv macos.zip ${{ github.workspace }}/cached_builds/template | |
build-retrohub: | |
runs-on: "macos-12" | |
name: Build RetroHub | |
needs: [build-godot, build-eirteam_ffmpeg] | |
steps: | |
- name: "Load EIRTeam.FFmpeg build" | |
uses: actions/cache@v4 | |
id: "cache_eirteam_ffmpeg" | |
with: | |
path: cached_builds/eirteam_ffmpeg | |
key: MacOS-eirteam_ffmpeg-build | |
restore-keys: MacOS-eirteam_ffmpeg-build | |
fail-on-cache-miss: true | |
continue-on-error: false | |
- name: "Load Godot builds" | |
uses: actions/cache@v4 | |
id: "cache_godot" | |
with: | |
path: | | |
cached_builds/editor/godot | |
cached_builds/template/macos.zip | |
key: MacOS-godot-build | |
restore-keys: MacOS-godot-build | |
fail-on-cache-miss: true | |
continue-on-error: false | |
- name: "Checkout RetroHub" | |
uses: actions/checkout@v4 | |
with: | |
path: "retrohub" | |
- name: "Setup templates and libraries" | |
env: | |
TEMPLATE_PATH: /Users/runner/Library/Application Support/Godot/export_templates/${{ env.GODOT_VERSION }}.retrohub | |
run: | | |
mkdir -p -v "$TEMPLATE_PATH" | |
cp cached_builds/template/macos.zip "$TEMPLATE_PATH" | |
ln -s ${{ github.workspace }}/cached_builds/eirteam_ffmpeg/macos retrohub/addons/ffmpeg/macos | |
mkdir -p -v export/macos | |
ls -R retrohub/addons/ffmpeg | |
# The editor uses the debug versions of addons. To save some work, duplicate EIRTeam.FFmpeg addon to make Godot happy | |
cp -r retrohub/addons/ffmpeg/macos/libgdffmpeg.macos.{template_release,template_debug}.framework | |
- name: "Package default themes" | |
uses: ./retrohub/.github/actions/get-default-themes | |
- name: "Import project" | |
working-directory: retrohub | |
env: | |
GODOT_PATH: ${{ github.workspace }}/cached_builds/editor/godot | |
run: | | |
# The first import loads EIRTeam.FFmpeg, an addon which blocks the editor as it requires a restart | |
brew install coreutils | |
gtimeout 30s $GODOT_PATH --headless --editor || true | |
$GODOT_PATH --headless --import || true | |
- name: "Exporting RetroHub" | |
working-directory: retrohub | |
env: | |
GODOT_PATH: ${{ github.workspace }}/cached_builds/editor/godot | |
run: | | |
# EIRteam.FFmpeg must be signed before exporting, otherwise code signing will silently fail | |
codesign -s - --force --deep addons/ffmpeg/macos/libgdffmpeg.macos.template_release.framework | |
$GODOT_PATH --headless --verbose --export-release "macOS" ../export/macos/RetroHub.app | |
- name: "Sign executable" | |
working-directory: export/macos | |
run: | | |
xattr -dr com.apple.quarantine "RetroHub.app" | |
codesign -s - --force --deep "RetroHub.app" | |
- name: "Upload Artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos | |
path: export/macos |