Переглянути джерело

[godot] Fix compilation error in SpineSprite, add 4.1 GitHub workflow.

Mario Zechner 2 роки тому
батько
коміт
15b61f3101

+ 368 - 0
.github/workflows/spine-godot-v4.1.yml

@@ -0,0 +1,368 @@
+name: Build and Publish Godot 4.1 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: 4.1-stable
+  GODOT_VERSION: 4.1.stable
+
+jobs:
+
+  godot-editor-windows:
+    runs-on: windows-latest
+    steps:
+      - uses: actions/checkout@v3
+        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@v3
+        with:
+          name: godot-editor-windows.zip
+          path: spine-godot/godot/bin/godot.windows.editor.x86_64.exe
+
+  godot-editor-linux:
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v3
+        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@v3
+        with:
+          name: godot-editor-linux.zip
+          path: spine-godot/godot/bin/godot.linuxbsd.editor.x86_64
+
+  godot-editor-macos:
+    runs-on: macos-latest
+    steps:
+      - uses: actions/checkout@v3
+        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/install-macos-vulkan-sdk.sh
+          ./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@v3
+        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@v3
+        with:
+          fetch-depth: 0
+
+      - name: Setup python and scons
+        uses: ./.github/actions/setup-godot-deps
+
+      - name: Build Godot artifact
+        run: |
+          ./spine-godot/build/install-macos-vulkan-sdk.sh
+          ./spine-godot/build/setup.sh $GODOT_TAG false
+          ./spine-godot/build/build-templates-v4.sh ios
+
+      - name: Upload artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: godot-template-ios.zip
+          path: spine-godot/godot/bin/ios.zip
+
+  godot-template-macos:
+    runs-on: macos-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+
+      - name: Setup python and scons
+        uses: ./.github/actions/setup-godot-deps
+
+      - name: Build Godot artifact
+        run: |
+          ./spine-godot/build/install-macos-vulkan-sdk.sh
+          ./spine-godot/build/setup.sh $GODOT_TAG false
+          ./spine-godot/build/build-templates-v4.sh macos
+
+      - name: Upload artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: godot-template-macos.zip
+          path: spine-godot/godot/bin/macos.zip
+
+  godot-template-linux:
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v3
+        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-v4.sh linux
+
+      - name: Upload artifacts debug
+        uses: actions/upload-artifact@v3
+        with:
+          name: godot-template-linux-debug.zip
+          path: spine-godot/godot/bin/linux_x11_64_debug
+
+      - name: Upload artifacts release
+        uses: actions/upload-artifact@v3
+        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@v3
+        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-v4.sh windows
+
+      - name: Upload artifacts debug
+        uses: actions/upload-artifact@v3
+        with:
+          name: godot-template-windows-debug.zip
+          path: spine-godot/godot/bin/windows_debug_x86_64.exe
+
+      - name: Upload artifacts release
+        uses: actions/upload-artifact@v3
+        with:
+          name: godot-template-windows-release.zip
+          path: spine-godot/godot/bin/windows_release_x86_64.exe
+
+  godot-template-android:
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v3
+        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-v4.sh android
+
+      - name: Upload artifacts debug
+        uses: actions/upload-artifact@v3
+        with:
+          name: godot-template-android-debug.zip
+          path: spine-godot/godot/bin/android_debug.apk
+
+      - name: Upload artifacts release
+        uses: actions/upload-artifact@v3
+        with:
+          name: godot-template-android-release.zip
+          path: spine-godot/godot/bin/android_release.apk
+
+      - name: Upload artifacts source
+        uses: actions/upload-artifact@v3
+        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@v3
+        with:
+          fetch-depth: 0
+
+      - name: Set up Emscripten latest
+        uses: mymindstorm/setup-emsdk@v11
+        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-v4.sh web
+
+      - name: Upload artifacts debug
+        uses: actions/upload-artifact@v3
+        with:
+          name: godot-template-web-debug.zip
+          path: spine-godot/godot/bin/web_debug.zip
+
+      - name: Upload artifacts release
+        uses: actions/upload-artifact@v3
+        with:
+          name: godot-template-web-release.zip
+          path: spine-godot/godot/bin/web_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.editor.x86_64.exe godot-$BRANCH-$GODOT_TAG.exe
+          mv godot.linuxbsd.editor.x86_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 ios.zip macos.zip windows_debug_x86_64.exe windows_release_x86_64.exe linux_x11_64_debug linux_x11_64_release web_debug.zip web_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
+
+

+ 20 - 20
.github/workflows/spine-godot.yml

@@ -1,4 +1,4 @@
-name: Build and Publish Godot editor and templates
+name: Build and Publish Godot 3.5 editor and templates
 
 on:
   push:
@@ -30,9 +30,9 @@ jobs:
 
       - name: Build Godot artifact
         shell: bash
-        run: |          
+        run: |
           ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build.sh release_debug          
+          ./spine-godot/build/build.sh release_debug
 
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
@@ -52,11 +52,11 @@ jobs:
 
       - name: Build Godot artifact
         shell: bash
-        run: |          
+        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.sh release_debug          
+          ./spine-godot/build/build.sh release_debug
 
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
@@ -81,7 +81,7 @@ jobs:
           ./spine-godot/build/build.sh release_debug
           pushd spine-godot/godot/bin
           zip -r godot-editor-macos.zip Godot.app
-          popd          
+          popd
 
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
@@ -97,10 +97,10 @@ jobs:
           fetch-depth: 0
 
       - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps   
+        uses: ./.github/actions/setup-godot-deps
 
       - name: Build Godot artifact
-        run: |          
+        run: |
           ./spine-godot/build/setup.sh $GODOT_TAG false
           ./spine-godot/build/build-templates.sh ios
 
@@ -118,10 +118,10 @@ jobs:
           fetch-depth: 0
 
       - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps   
+        uses: ./.github/actions/setup-godot-deps
 
       - name: Build Godot artifact
-        run: |          
+        run: |
           ./spine-godot/build/setup.sh $GODOT_TAG false
           ./spine-godot/build/build-templates.sh macos
 
@@ -139,10 +139,10 @@ jobs:
           fetch-depth: 0
 
       - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps   
+        uses: ./.github/actions/setup-godot-deps
 
       - name: Build Godot artifact
-        run: |          
+        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
@@ -201,7 +201,7 @@ jobs:
           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:
@@ -244,17 +244,17 @@ jobs:
       - name: Set up Emscripten latest
         uses: mymindstorm/setup-emsdk@v11
         with:
-          version: ${{env.EM_VERSION}}          
+          version: ${{env.EM_VERSION}}
 
       - name: Verify Emscripten setup
         run: |
           emcc -v
 
       - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps   
+        uses: ./.github/actions/setup-godot-deps
 
       - name: Build Godot artifact
-        run: |          
+        run: |
           ./spine-godot/build/setup.sh $GODOT_TAG false
           ./spine-godot/build/build-templates.sh web
 
@@ -313,7 +313,7 @@ jobs:
         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:
@@ -323,7 +323,7 @@ jobs:
         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:
@@ -338,7 +338,7 @@ jobs:
         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:
@@ -362,4 +362,4 @@ jobs:
           zip spine-godot-templates-$BRANCH-$GODOT_TAG.zip iphone.zip osx.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
 
-  
+

+ 3 - 0
spine-godot/spine_godot/SpineSprite.cpp

@@ -41,6 +41,9 @@
 #include "core/variant/array.h"
 #include "scene/resources/mesh.h"
 #include "servers/rendering_server.h"
+#if VERSION_MINOR > 0
+#include "editor/editor_interface.h"
+#endif
 #else
 #include "core/engine.h"
 #endif