From 7f39dfc41d3217142f94ad70363fd393945094b1 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 25 Jan 2023 12:34:16 +0100 Subject: [PATCH] [godot] Fix macOS editor and templates build for Godot 4.0 --- .github/workflows/spine-godot-v4.yml | 365 ++++++++++++++++++++++++ .github/workflows/spine-godot.yml | 2 +- spine-godot/build/build-templates-v4.sh | 58 ++-- spine-godot/build/build-v4.sh | 20 +- 4 files changed, 402 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/spine-godot-v4.yml diff --git a/.github/workflows/spine-godot-v4.yml b/.github/workflows/spine-godot-v4.yml new file mode 100644 index 000000000..4ba3725e4 --- /dev/null +++ b/.github/workflows/spine-godot-v4.yml @@ -0,0 +1,365 @@ +name: Build and Publish Godot editor and templates + +on: + push: + paths: + - ".github/workflows/spine-godot.yml" + - 'spine-godot/**' + - 'spine-cpp/**' + workflow_dispatch: + +env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_EC2_METADATA_DISABLED: true + EM_VERSION: 3.1.18 + GODOT_TAG: master + GODOT_VERSION: 4.0.beta + +jobs: + + godot-editor-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup python and scons + uses: ./.github/actions/setup-godot-deps + + - name: Build Godot artifact + shell: bash + run: | + ./spine-godot/build/setup.sh $GODOT_TAG false + ./spine-godot/build/build-v4.sh + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: godot-editor-windows.zip + path: spine-godot/godot/bin/godot.windows.editor.x86_64.exe + + godot-editor-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup python and scons + uses: ./.github/actions/setup-godot-deps + + - name: Build Godot artifact + shell: bash + run: | + sudo apt-get update + sudo apt-get install build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev + ./spine-godot/build/setup.sh $GODOT_TAG false + ./spine-godot/build/build-v4.sh + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: godot-editor-linux.zip + path: spine-godot/godot/bin/godot.linux.editor.x86_64 + + godot-editor-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup python and scons + uses: ./.github/actions/setup-godot-deps + + - name: Build Godot artifact + shell: bash + run: | + ./spine-godot/build/setup.sh $GODOT_TAG false + ./spine-godot/build/build-v4.sh + pushd spine-godot/godot/bin + zip -r godot-editor-macos.zip Godot.app + popd + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: godot-editor-macos.zip + path: spine-godot/godot/bin/godot-editor-macos.zip + + godot-template-ios: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup python and scons + uses: ./.github/actions/setup-godot-deps + + - name: Build Godot artifact + run: | + ./spine-godot/build/setup.sh $GODOT_TAG false + ./spine-godot/build/build-templates-v4.sh ios + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: godot-template-ios.zip + path: spine-godot/godot/bin/iphone.zip + + godot-template-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup python and scons + uses: ./.github/actions/setup-godot-deps + + - name: Build Godot artifact + run: | + ./spine-godot/build/setup.sh $GODOT_TAG false + ./spine-godot/build/build-templates-v4.sh macos + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: godot-template-macos.zip + path: spine-godot/godot/bin/macos.zip + + godot-template-linux: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup python and scons + uses: ./.github/actions/setup-godot-deps + + - name: Build Godot artifact + run: | + sudo apt-get update + sudo apt-get install build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev + ./spine-godot/build/setup.sh $GODOT_TAG false + ./spine-godot/build/build-templates.sh linux + + - name: Upload artifacts debug + uses: actions/upload-artifact@v2 + with: + name: godot-template-linux-debug.zip + path: spine-godot/godot/bin/linux_x11_64_debug + + - name: Upload artifacts release + uses: actions/upload-artifact@v2 + with: + name: godot-template-linux-release.zip + path: spine-godot/godot/bin/linux_x11_64_release + + godot-template-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup python and scons + uses: ./.github/actions/setup-godot-deps + + - name: Build Godot artifact + shell: bash + run: | + ./spine-godot/build/setup.sh $GODOT_TAG false + ./spine-godot/build/build-templates.sh windows + + - name: Upload artifacts debug + uses: actions/upload-artifact@v2 + with: + name: godot-template-windows-debug.zip + path: spine-godot/godot/bin/windows_64_debug.exe + + - name: Upload artifacts release + uses: actions/upload-artifact@v2 + with: + name: godot-template-windows-release.zip + path: spine-godot/godot/bin/windows_64_release.exe + + godot-template-android: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + # Azure repositories are not reliable, we need to prevent azure giving us packages. + - name: Make apt sources.list use the default Ubuntu repositories + run: | + sudo rm -f /etc/apt/sources.list.d/* + sudo cp -f spine-godot/build/sources.lst /etc/apt/sources.list + sudo apt-get update + + - name: Set up Java 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Setup python and scons + uses: ./.github/actions/setup-godot-deps + + - name: Build Godot artifact + shell: bash + run: | + ./spine-godot/build/setup.sh $GODOT_TAG false + ./spine-godot/build/build-templates.sh android + + - name: Upload artifacts debug + uses: actions/upload-artifact@v2 + with: + name: godot-template-android-debug.zip + path: spine-godot/godot/bin/android_debug.apk + + - name: Upload artifacts release + uses: actions/upload-artifact@v2 + with: + name: godot-template-android-release.zip + path: spine-godot/godot/bin/android_release.apk + + - name: Upload artifacts source + uses: actions/upload-artifact@v2 + with: + name: godot-template-android-source.zip + path: spine-godot/godot/bin/android_source.zip + + godot-template-web: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Emscripten latest + uses: mymindstorm/setup-emsdk@v10 + with: + version: ${{env.EM_VERSION}} + + - name: Verify Emscripten setup + run: | + emcc -v + + - name: Setup python and scons + uses: ./.github/actions/setup-godot-deps + + - name: Build Godot artifact + run: | + ./spine-godot/build/setup.sh $GODOT_TAG false + ./spine-godot/build/build-templates.sh web + + - name: Upload artifacts debug + uses: actions/upload-artifact@v2 + with: + name: godot-template-web-debug.zip + path: spine-godot/godot/bin/webassembly_debug.zip + + - name: Upload artifacts release + uses: actions/upload-artifact@v2 + with: + name: godot-template-web-release.zip + path: spine-godot/godot/bin/webassembly_release.zip + + upload-to-s3: + needs: [godot-editor-windows, godot-editor-linux, godot-editor-macos, godot-template-ios, godot-template-macos, godot-template-windows, godot-template-linux, godot-template-android, godot-template-web] + runs-on: ubuntu-latest + steps: + - name: Download godot-editor-windows artifact + uses: actions/download-artifact@v2 + with: + name: godot-editor-windows.zip + + - name: Download godot-editor-linux artifact + uses: actions/download-artifact@v2 + with: + name: godot-editor-linux.zip + + - name: Download godot-editor-macos artifact + uses: actions/download-artifact@v2 + with: + name: godot-editor-macos.zip + + - name: Download godot-template-ios artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-ios.zip + + - name: Download godot-template-macos artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-macos.zip + + - name: Download godot-template-windows-release artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-windows-release.zip + + - name: Download godot-template-windows-debug artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-windows-debug.zip + + - name: Download godot-template-linux-release artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-linux-release.zip + + - name: Download godot-template-linux-debug artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-linux-debug.zip + + - name: Download godot-template-android-release artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-android-release.zip + + - name: Download godot-template-android-debug artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-android-debug.zip + + - name: Download godot-template-android-source artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-android-source.zip + + - name: Download godot-template-web-release artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-web-release.zip + + - name: Download godot-template-web-debug artifact + uses: actions/download-artifact@v2 + with: + name: godot-template-web-debug.zip + + - name: Upload artifacts to S3 + shell: bash + if: env.AWS_ACCESS_KEY_ID != null + run: | + BRANCH=${GITHUB_REF#refs/heads/} + echo "branch: $BRANCH" + mv godot.windows.opt.tools.64.exe godot-$BRANCH-$GODOT_TAG.exe + mv godot.x11.opt.tools.64 godot-$BRANCH-$GODOT_TAG + zip godot-editor-windows.zip godot-$BRANCH-$GODOT_TAG.exe + zip godot-editor-linux.zip godot-$BRANCH-$GODOT_TAG + aws s3 cp godot-editor-windows.zip s3://spine-godot/$BRANCH/$GODOT_TAG/ + aws s3 cp godot-editor-linux.zip s3://spine-godot/$BRANCH/$GODOT_TAG/ + aws s3 cp godot-editor-macos.zip s3://spine-godot/$BRANCH/$GODOT_TAG/ + echo "$GODOT_VERSION" > version.txt + ls -lah + zip spine-godot-templates-$BRANCH-$GODOT_TAG.zip iphone.zip macos.zip windows_64_debug.exe windows_64_release.exe linux_x11_64_debug linux_x11_64_release webassembly_debug.zip webassembly_release.zip android_release.apk android_debug.apk android_source.zip version.txt + aws s3 cp spine-godot-templates-$BRANCH-$GODOT_TAG.zip s3://spine-godot/$BRANCH/$GODOT_TAG/spine-godot-templates-$BRANCH-$GODOT_TAG.tpz + + diff --git a/.github/workflows/spine-godot.yml b/.github/workflows/spine-godot.yml index 7ca290323..2f17c61ef 100644 --- a/.github/workflows/spine-godot.yml +++ b/.github/workflows/spine-godot.yml @@ -12,7 +12,7 @@ env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_EC2_METADATA_DISABLED: true - EM_VERSION: 3.1.10 + EM_VERSION: 3.1.14 GODOT_TAG: 3.5.1-stable GODOT_VERSION: 3.5.1.stable diff --git a/spine-godot/build/build-templates-v4.sh b/spine-godot/build/build-templates-v4.sh index 9c36c7fd4..233340fad 100755 --- a/spine-godot/build/build-templates-v4.sh +++ b/spine-godot/build/build-templates-v4.sh @@ -45,35 +45,35 @@ if [ "$platform" = "windows" ]; then elif [ "$platform" = "macos" ]; then # --- macOS --- - # generates osx.zip + # generates macos.zip - scons platform=osx tools=no target=release arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus - scons platform=osx tools=no target=release_debug arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus - scons platform=osx tools=no target=release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus - scons platform=osx tools=no target=release_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus - lipo -create bin/godot.osx.opt.x86_64 bin/godot.osx.opt.arm64 -output bin/godot.osx.opt.universal - lipo -create bin/godot.osx.opt.debug.x86_64 bin/godot.osx.opt.debug.arm64 -output bin/godot.osx.opt.debug.universal - strip -S -x bin/godot.osx.opt.universal + scons platform=macos tools=no target=template_release arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus + scons platform=macos tools=no target=template_debug arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus + scons platform=macos tools=no target=template_release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus + scons platform=macos tools=no target=template_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus + lipo -create bin/godot.macos.template_release.x86_64 bin/godot.macos.template_release.arm64 -output bin/godot.macos.universal + lipo -create bin/godot.macos.template_debug.x86_64 bin/godot.macos.template_debug.arm64 -output bin/godot.macos.debug.universal + strip -S -x bin/godot.macos.universal pushd bin - cp -r ../misc/dist/osx_template.app . - mkdir -p osx_template.app/Contents/MacOS - cp godot.osx.opt.universal osx_template.app/Contents/MacOS/godot_osx_release.64 - cp godot.osx.opt.debug.universal osx_template.app/Contents/MacOS/godot_osx_debug.64 - chmod +x osx_template.app/Contents/MacOS/godot_osx* - rm -rf osx.zip - zip -q -9 -r osx.zip osx_template.app + cp -r ../misc/dist/macos_template.app . + mkdir -p macos_template.app/Contents/MacOS + cp godot.macos.universal macos_template.app/Contents/MacOS/godot_macos_release.64 + cp godot.macos.debug.universal macos_template.app/Contents/MacOS/godot_macos_debug.64 + chmod +x macos_template.app/Contents/MacOS/godot_macos* + rm -rf macos.zip + zip -q -9 -r macos.zip macos_template.app popd elif [ "$platform" = "ios" ]; then # --- iOS -- # generates iphone.zip - scons p=iphone tools=no target=release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus - scons p=iphone tools=no target=release_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus - scons p=iphone tools=no target=release arch=arm64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus - scons p=iphone tools=no target=release arch=x86_64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus - scons p=iphone tools=no target=release_debug arch=arm64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus - scons p=iphone tools=no target=release_debug arch=x86_64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus + scons p=iphone tools=no target=template_release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus + scons p=iphone tools=no target=template_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus + scons p=iphone tools=no target=template_release arch=arm64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus + scons p=iphone tools=no target=template_release arch=x86_64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus + scons p=iphone tools=no target=template_debug arch=arm64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus + scons p=iphone tools=no target=template_debug arch=x86_64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus lipo -create bin/libgodot.iphone.opt.arm64.simulator.a bin/libgodot.iphone.opt.x86_64.simulator.a -output bin/libgodot.iphone.opt.simulator.a lipo -create bin/libgodot.iphone.opt.debug.arm64.simulator.a bin/libgodot.iphone.opt.debug.x86_64.simulator.a -output bin/libgodot.iphone.opt.debug.simulator.a strip -S -x bin/libgodot.iphone.opt.arm64.a @@ -93,17 +93,17 @@ elif [ "$platform" = "ios" ]; then elif [ "$platform" = "web" ]; then # --- WEB --- # generates webassembly_debug.zip, webassembly_release.zip - scons platform=javascript tools=no target=release custom_modules="../spine_godot" --jobs=$cpus - scons platform=javascript tools=no target=release_debug custom_modules="../spine_godot" --jobs=$cpus + scons platform=javascript tools=no target=template_release custom_modules="../spine_godot" --jobs=$cpus + scons platform=javascript tools=no target=template_debug custom_modules="../spine_godot" --jobs=$cpus mv bin/godot.javascript.opt.zip bin/webassembly_release.zip mv bin/godot.javascript.opt.debug.zip bin/webassembly_debug.zip elif [ "$platform" = "android" ]; then # --- ANROID --- # generates android_release.apk, android_debug.apk, android_source.zip - scons platform=android target=release android_arch=armv7 custom_modules="../spine_godot" --jobs=$cpus - scons platform=android target=release_debug android_arch=armv7 custom_modules="../spine_godot" --jobs=$cpus - scons platform=android target=release android_arch=arm64v8 custom_modules="../spine_godot" --jobs=$cpus - scons platform=android target=release_debug android_arch=arm64v8 custom_modules="../spine_godot" --jobs=$cpus + scons platform=android target=template_release android_arch=armv7 custom_modules="../spine_godot" --jobs=$cpus + scons platform=android target=template_debug android_arch=armv7 custom_modules="../spine_godot" --jobs=$cpus + scons platform=android target=template_release android_arch=arm64v8 custom_modules="../spine_godot" --jobs=$cpus + scons platform=android target=template_debug android_arch=arm64v8 custom_modules="../spine_godot" --jobs=$cpus pushd platform/android/java chmod a+x gradlew @@ -112,8 +112,8 @@ elif [ "$platform" = "android" ]; then elif [ "$platform" = "linux" ]; then # --- Linix --- # generates linux_x11_64_release, linux_x11_64_debug - scons platform=x11 tools=no target=release bits=64 custom_modules="../spine_godot" --jobs=$cpus - scons platform=x11 tools=no target=release_debug bits=64 custom_modules="../spine_godot" --jobs=$cpus + scons platform=linuxbsd tools=no target=template_release bits=64 custom_modules="../spine_godot" --jobs=$cpus + scons platform=linuxbsd tools=no target=template_debug bits=64 custom_modules="../spine_godot" --jobs=$cpus strip bin/godot.x11.opt.64 strip bin/godot.x11.opt.debug.64 chmod a+x bin/godot.x11.opt.64 diff --git a/spine-godot/build/build-v4.sh b/spine-godot/build/build-v4.sh index ea7fc50f7..b2f3c703e 100755 --- a/spine-godot/build/build-v4.sh +++ b/spine-godot/build/build-v4.sh @@ -9,7 +9,7 @@ if [ ! -d ../godot ]; then exit 1 fi -target="target=${1%/}" +target="" dev="false" if [ -f "../godot/custom.py" ]; then dev="true" @@ -32,19 +32,13 @@ if [ `uname` == 'Darwin' ] && [ $dev = "false" ]; then scons $target arch=arm64 compiledb=yes custom_modules="../spine_godot" --jobs=$cpus pushd bin - cp -r ../misc/dist/osx_tools.app . - mv osx_tools.app Godot.app + cp -r ../misc/dist/macos_tools.app . + mv macos_tools.app Godot.app mkdir -p Godot.app/Contents/MacOS - if [ "$target" = "debug" ]; then - lipo -create godot.osx.tools.x86_64 godot.osx.tools.arm64 -output godot.osx.tools.universal - strip -S -x godot.osx.tools.universal - cp godot.osx.tools.universal Godot.app/Contents/MacOS/Godot - else - lipo -create godot.osx.opt.tools.x86_64 godot.osx.opt.tools.arm64 -output godot.osx.opt.tools.universal - strip -S -x godot.osx.opt.tools.universal - cp godot.osx.opt.tools.universal Godot.app/Contents/MacOS/Godot - fi - chmod +x Godot.app/Contents/MacOS/Godot + lipo -create godot.macos.editor.arm64 godot.macos.editor.x86_64 -output Godot + strip -S -x Godot + cp Godot Godot.app/Contents/MacOS/Godot + chmod +x Godot.app/Contents/MacOS/Godot popd else if [ "$OSTYPE" = "msys" ]; then