Skip to content

fix macOS bundle working directory #997

fix macOS bundle working directory

fix macOS bundle working directory #997

Workflow file for this run

name: Automated Test Build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: Parse pull request description for dependency overrides
id: parse-pr-override
env:
PR_BODY: ${{ github.event.pull_request.body }}
shell: python
run: |
# You can override dependencies by specifying a pull request number in the pull request description.
# This is useful when you want to test changes which require modifications in the submodules or dependencies.
# Expected description format:
# > name: NNN
# (leading >, dependency name, followed by a PR number)
# Example:
# > ocgcore: 123
# Supported dependencies:
# ocgcore, irrlicht
import re, os
body = os.environ.get('PR_BODY', '')
# Default: empty means no override
ocgcore_ref = ''
irrlicht_ref = ''
m = re.search(r'(?m)^\s*>\s*ocgcore\s*:\s*(\d+)\s*$', body)
if m:
ocgcore_ref = f'refs/pull/{m.group(1)}/head'
m = re.search(r'(?m)^\s*>\s*irrlicht\s*:\s*(\d+)\s*$', body)
if m:
irrlicht_ref = f'refs/pull/{m.group(1)}/head'
# Output the parsed refs for downstream jobs
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write(f'ocgcore-ref={ocgcore_ref}\n')
f.write(f'irrlicht-ref={irrlicht_ref}\n')
- name: Fetch ocgcore
uses: actions/checkout@v6
with:
repository: Fluorohydride/ygopro-core
path: ocgcore
ref: ${{ steps.parse-pr-override.outputs.ocgcore-ref }}
- name: Fetch Irrlicht
uses: actions/checkout@v6
with:
repository: mercury233/irrlicht
path: irrlicht
ref: ${{ steps.parse-pr-override.outputs.irrlicht-ref }}
- name: Download lua
id: lua
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://www.lua.org/ftp/lua-5.4.8.tar.gz
sha256: 4f18ddae154e793e46eeab727c59ef1c0c0c2b744e7b94219710d76f530629ae
- name: Extract lua
run: |
tar xf ${{ steps.lua.outputs.filepath }}
mv lua-5.4.8 lua
- name: Fetch miniaudio
uses: actions/checkout@v6
with:
repository: mackron/miniaudio
path: miniaudio-source
ref: 9634bedb5b5a2ca38c1ee7108a9358a4e233f14d # tag: 0.11.25
- name: Use miniaudio split & decoders only
run: |
mkdir -p miniaudio/extras
cp miniaudio-source/extras/miniaudio_split/miniaudio.* miniaudio/
cp -r miniaudio-source/extras/decoders miniaudio/extras/
- name: Upload sources
uses: actions/upload-artifact@v6
with:
name: dependencies-sources
path: |
lua/
miniaudio/
irrlicht/include/
irrlicht/source/
!irrlicht/source/Irrlicht/jpeglib/
!irrlicht/source/Irrlicht/libpng/
!irrlicht/source/Irrlicht/zlib/
ocgcore/
prepare-static-dependencies:
runs-on: ubuntu-latest
steps:
- name: Download libevent
id: libevent
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
filename: libevent.tar.gz
sha256: 92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
- name: Extract libevent
run: |
tar xf ${{ steps.libevent.outputs.filepath }}
mv libevent-2.1.12-stable event
- name: Download freetype
id: freetype
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://downloads.sourceforge.net/freetype/freetype-2.14.2.tar.gz
sha256: 752c2671f85c54a84b7f0dd2b5cd26b6b741117033886ffbc5ac89a68464b848
- name: Extract freetype
run: |
tar xf ${{ steps.freetype.outputs.filepath }}
mv freetype-2.14.2 freetype
- name: Download libjpeg-turbo
id: libjpeg-turbo
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.1.4.1/libjpeg-turbo-3.1.4.1.tar.gz
sha256: ecae8008e2cc9ade2f2c1bb9d5e6d4fb73e7c433866a056bd82980741571a022
- name: Extract libjpeg-turbo
run: |
tar xf ${{ steps.libjpeg-turbo.outputs.filepath }}
mv libjpeg-turbo-3.1.4.1 jpeg
cp jpeg/src/jversion.h.in jpeg/src/jversion.h
- name: Download libpng
id: libpng
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://downloads.sourceforge.net/libpng/libpng-1.6.58.tar.gz
sha256: 8c9b05b675ca7301a458df2c2e46f26e1d41ff36b8863f8c33530bc58c2e6225
- name: Extract libpng
run: |
tar xf ${{ steps.libpng.outputs.filepath }}
mv libpng-1.6.58 png
cp png/scripts/pnglibconf.h.prebuilt png/pnglibconf.h
- name: Download zlib
id: zlib
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/madler/zlib/releases/download/v1.3.2/zlib-1.3.2.tar.gz
sha256: bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16
- name: Extract zlib
run: |
tar xf ${{ steps.zlib.outputs.filepath }}
mv zlib-1.3.2 zlib
- name: Download sqlite
id: sqlite
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://www.sqlite.org/2026/sqlite-amalgamation-3510300.zip
sha256: acb1e6f5d832484bf6d32b681e858c38add8b2acdfd42ac5df24b8afb46552b4
- name: Extract sqlite
run: |
7z x ${{ steps.sqlite.outputs.filepath }}
mv sqlite-amalgamation-3510300 sqlite3
- name: Create miniaudio external directory
run: |
mkdir -p miniaudio/external
- name: Download ogg
id: ogg
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/xiph/ogg/releases/download/v1.3.6/libogg-1.3.6.tar.gz
sha256: 83e6704730683d004d20e21b8f7f55dcb3383cdf84c0daedf30bde175f774638
- name: Extract ogg
run: |
tar xf ${{ steps.ogg.outputs.filepath }}
mv libogg-1.3.6 miniaudio/external/ogg
- name: Download opus
id: opus
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
sha256: 65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1
- name: Extract opus
run: |
tar xf ${{ steps.opus.outputs.filepath }}
mv opus-1.5.2 miniaudio/external/opus
- name: Download opusfile
id: opusfile
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/xiph/opusfile/releases/download/v0.12/opusfile-0.12.tar.gz
sha256: 118d8601c12dd6a44f52423e68ca9083cc9f2bfe72da7a8c1acb22a80ae3550b
- name: Extract opusfile
run: |
tar xf ${{ steps.opusfile.outputs.filepath }}
mv opusfile-0.12 miniaudio/external/opusfile
- name: Download vorbis
id: vorbis
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.tar.gz
sha256: 0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab
- name: Extract vorbis
run: |
tar xf ${{ steps.vorbis.outputs.filepath }}
mv libvorbis-1.3.7 miniaudio/external/vorbis
- name: Upload static dependencies
uses: actions/upload-artifact@v6
with:
name: dependencies-sources-static-link
path: |
event/
freetype/
!freetype/docs/
jpeg/
!jpeg/java/
!jpeg/testimages/
png/
zlib/
sqlite3/
miniaudio/
!miniaudio/external/opus/dnn/
build-windows:
needs: [prepare, prepare-static-dependencies]
strategy:
fail-fast: false
matrix:
name:
- windows-x86-sse2
# - windows-no-dxsdk
- windows-x64-avx2
- windows-x64-no-simd
- windows-arm64
- windows-2025
include:
- name: windows-x86-sse2
os: windows-2022
vs: vs2022
platform: Win32
simd: sse2
# - name: windows-no-dxsdk
# os: windows-2022
# vs: vs2022
# platform: x64
# nodxsdk: true
- name: windows-x64-avx2
os: windows-2022
vs: vs2022
platform: x64
simd: avx2
- name: windows-x64-no-simd
os: windows-2022
vs: vs2022
platform: x64
simd: none
- name: windows-arm64
os: windows-2022
vs: vs2022
platform: ARM64
- name: windows-2025
os: windows-2025-vs2026
vs: vs2026
platform: x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: false
# Git submodules are ignored in this CI script. The `prepare` job downloads them.
# For local development, use `git clone --recursive` when cloning the repository,
# and then check out the submodules to the `master` branch.
# (The submodule references recorded in this repository may be outdated).
- name: Download prepare sources
uses: actions/download-artifact@v7
with:
name: dependencies-sources
path: .
- name: Download static dependencies sources
uses: actions/download-artifact@v7
with:
name: dependencies-sources-static-link
path: .
- name: Download NASM
id: nasm
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://www.nasm.us/pub/nasm/releasebuilds/3.01/win64/nasm-3.01-win64.zip
filename: nasm.zip
sha256: e0ba5157007abc7b1a65118a96657a961ddf55f7e3f632ee035366dfce039ca4
- name: Install NASM
shell: pwsh
run: |
New-Item -ItemType Directory -Path nasm | Out-Null
Expand-Archive -Path ${{ steps.nasm.outputs.filepath }} -DestinationPath nasm
Move-Item .\nasm\nasm-3.01\nasm.exe .\nasm
$nasmPath = (Resolve-Path .\nasm).Path
$nasmPath | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Download premake
id: premake
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/premake/premake-core/releases/download/v5.0.0-beta8/premake-5.0.0-beta8-windows.zip
filename: premake5.zip
sha256: e64ce2ed8778e0098f63674cca61fe33941b5f0c8d9a4afd651152bdea3758ab
- name: Extract premake
shell: bash
run: |
7z x ${{ steps.premake.outputs.filepath }}
- name: Check DirectX SDK
if: matrix.nodxsdk != true
id: dxsdk
uses: actions/cache@v5
with:
key: dxsdk
path: DXSDK
- name: Download DirectX SDK
if: matrix.nodxsdk != true && steps.dxsdk.outputs.cache-hit != 'true'
id: dxsdk-download
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://download.microsoft.com/download/a/e/7/ae743f1f-632b-4809-87a9-aa1bb3458e31/DXSDK_Jun10.exe
sha256: 705271dc83bfee54d9b94e028426e288d5f070784b7446d164f48ecfbb2a02cb
- name: Install DirectX SDK
if: matrix.nodxsdk != true && steps.dxsdk.outputs.cache-hit != 'true'
shell: bash
run: |
7z x ${{ steps.dxsdk-download.outputs.filepath }} -aoa
- name: Set DirectX SDK environment variable
if: matrix.nodxsdk != true
shell: pwsh
run: |
$dxsdkPath = Resolve-Path 'DXSDK'
"DXSDK_DIR=$($dxsdkPath.ProviderPath)\" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Configure libevent
shell: bash
run: |
cp premake/event/msvc-event-config.h event/include/event2/event-config.h
cp event/WIN32-Code/nmake/evconfig-private.h event/include/evconfig-private.h
- name: Copy premake files
shell: bash
run: |
cp -pr premake/* .
cp -pr resource/* .
- name: Use premake to generate Visual Studio solution
shell: pwsh
run: |
.\premake5.exe ${{ matrix.vs }} ${{ matrix.simd && format('--use-simd={0}', matrix.simd) || '' }}
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v3
- name: Build solution
shell: pwsh
run: |
MSBuild.exe build\YGOPro.${{ matrix.vs == 'vs2026' && 'slnx' || 'sln' }} /m /p:Configuration=Release /p:Platform=${{ matrix.platform }}
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: YGOPro-${{ matrix.name }}
path: |
bin/release/x86/YGOPro.exe
bin/release/x64/YGOPro.exe
bin/release/arm64/YGOPro.exe
build-linux:
needs: [prepare, prepare-static-dependencies]
strategy:
fail-fast: false
matrix:
name:
- ubuntu-22
- ubuntu-24
- ubuntu-static-link
- ubuntu-arm-static-link
include:
- name: ubuntu-22
os: ubuntu-22.04
- name: ubuntu-24
os: ubuntu-24.04
- name: ubuntu-static-link
os: ubuntu-22.04
static-link: true
- name: ubuntu-arm-static-link
os: ubuntu-24.04-arm
static-link: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: false
- name: Download prepare sources
uses: actions/download-artifact@v7
with:
name: dependencies-sources
path: .
- name: Download static dependencies sources
if: matrix.static-link == true
uses: actions/download-artifact@v7
with:
name: dependencies-sources-static-link
path: .
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev
- name: Install dependencies (dynamic link)
if: matrix.static-link != true
run: |
sudo apt-get install -y libevent-dev libfreetype6-dev libsqlite3-dev libopusfile-dev libvorbis-dev libjpeg-dev libpng-dev zlib1g-dev
- name: Install NASM
if: matrix.static-link == true
run: |
sudo apt-get install -y nasm
- name: Download premake
id: premake
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/premake/premake-core/releases/download/v5.0.0-beta8/premake-5.0.0-beta8-linux.tar.gz
filename: premake5.tar.gz
sha256: 63edd3e7461eebdd45b500a3c7e8ad4e7a67d68f230010f9a97cbb71b4ec59c8
- name: Extract & test premake
id: extract-premake
run: |
tar xf ${{ steps.premake.outputs.filepath }}
chmod +x ./premake5
mkdir premake-test
cp ./premake5 ./premake-test
cd ./premake-test
if ./premake5 --version; then
echo "premake=ok" >> $GITHUB_OUTPUT
else
echo "premake=fail" >> $GITHUB_OUTPUT
fi
cd ..
- name: Fetch premake source (fallback)
if: steps.extract-premake.outputs.premake != 'ok'
uses: actions/checkout@v6
with:
repository: premake/premake-core
path: premake-source
ref: 2ca338a25ed5f6e62d36c9cd70e5f313953c630d # tag: v5.0.0-beta8
- name: Build premake (fallback)
if: steps.extract-premake.outputs.premake != 'ok'
run: |
sudo apt-get install -y uuid-dev
cd premake-source
chmod +x ./Bootstrap.sh
./Bootstrap.sh
cp bin/release/premake5 ../premake5
cd ..
- name: Configure libevent
if: matrix.static-link == true
run: |
cd event
chmod +x configure build-aux/*
./configure --disable-openssl --enable-static=yes --enable-shared=no
sed -f make-event-config.sed < config.h > ./include/event2/event-config.h
cd ..
- name: Configure ogg
if: matrix.static-link == true
run: |
cd miniaudio/external/ogg
chmod +x configure
./configure
cd ../../..
- name: Copy premake files
run: |
cp -pr premake/* .
cp -pr resource/* .
- name: Use premake to generate make files (apt packages)
if: matrix.static-link != true
run: |
./premake5 gmake
- name: Use premake to generate make files (static link)
if: matrix.static-link == true
run: |
./premake5 gmake \
--build-event \
--build-jpeg \
--build-png \
--build-zlib \
--build-freetype \
--build-sqlite \
--build-opus-vorbis
- name: Make
run: |
cd build
make -j 4 config=release
cd ..
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: YGOPro-${{ matrix.name }}
path: |
bin/release/YGOPro
build-macos:
needs: [prepare, prepare-static-dependencies]
strategy:
fail-fast: false
matrix:
name:
- macos-15-intel
- macos-26-arm
- macos-26-intel-cross-compile-static-link
- macos-26-arm-static-link
include:
- name: macos-15-intel
os: macos-15-intel
- name: macos-26-arm
os: macos-26
- name: macos-26-intel-cross-compile-static-link
os: macos-26
cross-build-intel: true
static-link: true
- name: macos-26-arm-static-link
os: macos-26
static-link: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: false
- name: Download prepare sources
uses: actions/download-artifact@v7
with:
name: dependencies-sources
path: .
- name: Download static dependencies sources
if: matrix.static-link == true
uses: actions/download-artifact@v7
with:
name: dependencies-sources-static-link
path: .
- name: Install dependencies
if: matrix.static-link != true
run: |
brew install opus opusfile libvorbis zlib
# brew install sqlite libx11 freetype libevent libjpeg-turbo libpng
- name: Install NASM
if: matrix.static-link == true
run: |
brew install nasm
- name: Download premake
id: premake
uses: mercury233/action-cache-download-file@v1.2.0
with:
url: https://github.com/premake/premake-core/releases/download/v5.0.0-beta8/premake-5.0.0-beta8-macosx.tar.gz
filename: premake5.tar.gz
sha256: fa73a46f093fa6f17494a3d063421aa6cae3ea825a61c62dd59fc2f07a256d03
- name: Extract & test premake
id: extract-premake
run: |
tar xf ${{ steps.premake.outputs.filepath }}
chmod +x ./premake5
mkdir premake-test
cp ./premake5 ./premake-test
cd ./premake-test
if ./premake5 --version; then
echo "premake=ok" >> $GITHUB_OUTPUT
else
echo "premake=fail" >> $GITHUB_OUTPUT
fi
cd ..
- name: Fetch premake source (fallback)
if: steps.extract-premake.outputs.premake != 'ok'
uses: actions/checkout@v6
with:
repository: premake/premake-core
path: premake-source
ref: 9ca696c86d5df6a1f6e674a931eef18e2b1c3b31 # fix: x86_64 architecture detection for macOS in Bootstrap.sh (#2640)
- name: Build premake (fallback)
if: steps.extract-premake.outputs.premake != 'ok'
run: |
cd premake-source
chmod +x ./Bootstrap.sh
./Bootstrap.sh
cp bin/release/premake5 ../premake5
cd ..
- name: Configure libevent
if: matrix.static-link == true
run: |
cd event
chmod +x configure build-aux/*
./configure --disable-openssl --enable-static=yes --enable-shared=no
sed -f make-event-config.sed < config.h > ./include/event2/event-config.h
cd ..
- name: Copy premake files
run: |
cp -pr premake/* .
cp -pr resource/* .
- name: Use premake to generate make files (Homebrew packages)
if: matrix.static-link != true
run: |
DYLD_LIBRARY_PATH=$(brew --prefix)/lib ./premake5 gmake \
--sqlite-include-dir=$(brew --prefix sqlite)/include \
--sqlite-lib-dir=$(brew --prefix sqlite)/lib \
--zlib-include-dir=$(brew --prefix zlib)/include \
--zlib-lib-dir=$(brew --prefix zlib)/lib
- name: Use premake to generate make files (static link)
if: matrix.static-link == true
run: |
./premake5 gmake ${{ matrix.cross-build-intel == true && '--mac-intel' || '' }} ${{ matrix.cross-build-arm == true && '--mac-arm' || '' }} \
--build-event \
--build-jpeg \
--build-png \
--build-zlib \
--build-freetype \
--build-sqlite \
--build-opus-vorbis
- name: Make
run: |
cd build
make -j 3 config=release
cd ..
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: YGOPro-${{ matrix.name }}
path: |
bin/release/YGOPro