From 92af5624dc582c83d60e73876cc2901e0fe1afd3 Mon Sep 17 00:00:00 2001 From: Marvin Ewald Date: Sun, 5 Nov 2023 15:17:31 +0100 Subject: [PATCH] Update Github build scripts --- .github/workflows/build.yml | 137 ++++++++++++++++++++++++++++++++++++ .github/workflows/c-cpp.yml | 91 ------------------------ 2 files changed, 137 insertions(+), 91 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/c-cpp.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..31697d9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,137 @@ +# Adapted from https://github.com/nathanfranke/gdextension/blob/main/.github/workflows/build.yml +name: Builds +on: + push: + branches: [ "master", "godot_4.2" ] + pull_request: + branches: [ "master", "godot_4.2" ] + +jobs: + build: + runs-on: ${{ matrix.runner }} + name: ${{ matrix.name }} + strategy: + fail-fast: false + matrix: + include: + - identifier: linux-debug + name: Linux Debug + runner: ubuntu-20.04 + target: template_debug + platform: linux + arch: x86_64 + - identifier: linux-release + name: Linux Release + runner: ubuntu-20.04 + target: template_release + platform: linux + arch: x86_64 + - identifier: windows-debug + name: Windows Debug + runner: ubuntu-20.04 + target: template_debug + platform: windows + arch: x86_64 + - identifier: windows-release + name: Windows Release + runner: ubuntu-20.04 + target: template_release + platform: windows + arch: x86_64 + - identifier: android-release + name: Android Release + runner: ubuntu-20.04 + target: template_release + platform: android + arch: arm64 + # Untested + - identifier: macos-debug + name: MacOS Debug + runner: macos-latest + target: template_debug + platform: macos + arch: x86_64 + - identifier: macos-release + name: MacOS Release + runner: macos-latest + target: template_release + platform: macos + arch: x86_64 + + steps: + - name: (Windows) Install mingw64 + if: ${{ startsWith(matrix.identifier, 'windows-') }} + shell: sh + run: | + sudo apt-get install mingw-w64 + sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix + sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix + + - name: (Android) Set up Java 11 + if: ${{ startsWith(matrix.identifier, 'android-') }} + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: (Android) Set up Android SDK + if: ${{ startsWith(matrix.identifier, 'android-') }} + uses: android-actions/setup-android@v2 + + - name: (Android) Install Android Tools + if: ${{ startsWith(matrix.identifier, 'android-') }} + shell: sh + run: | + "$ANDROID_SDK_ROOT"/cmdline-tools/latest/bin/sdkmanager --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" "build-tools;30.0.3" "platforms;android-29" "cmdline-tools;latest" "cmake;3.10.2.4988404" "ndk;21.4.7075529" + + - name: Set up Python + uses: actions/setup-python@v2 + + - name: Set up SCons + shell: bash + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons + scons --version + + - name: Checkout project + uses: actions/checkout@v2 + with: + submodules: recursive + +# TODO: Cache doesn't work yet. SCons rebuilds the objects even if they already exist. Could be caused by modification dates or extension_api.json. +# fetch-depth: 0 May be needed for cache. See: . +# - name: Set up SCons cache +# uses: actions/cache@v3 +# with: +# path: | +# ${{ github.workspace }}/.scons-cache/ +# ${{ github.workspace }}/**/.sconsign.dblite +# ${{ github.workspace }}/godot-cpp/gen/ +# key: ${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }} +# restore-keys: | +# ${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }} +# ${{ matrix.identifier }}-${{ github.ref }} +# ${{ matrix.identifier }} + + - name: Compile extension + shell: sh +# env: +# SCONS_CACHE: '${{ github.workspace }}/.scons-cache/' +# SCONS_CACHE_LIMIT: 8192 + run: | + scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' -j2 + ls -l demo/addons/*/bin/ + + - name: Copy extra files to addon + shell: sh + run: | + for addon in ${{ github.workspace }}/demo/addons/*/; do + cp -n '${{ github.workspace }}/README.md' '${{ github.workspace }}/LICENSE' "$addon" + done + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ github.event.repository.name }} + path: | + ${{ github.workspace }}/demo/ diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml deleted file mode 100644 index a2d3484..0000000 --- a/.github/workflows/c-cpp.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: C/C++ CI - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build_windows: - runs-on: windows-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Install dependencies - run: python -m pip install scons - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.1 - - name: Enable Developer Command Prompt - uses: ilammy/msvc-dev-cmd@v1 - - name: Cache Godot-CPP - id: cache-godot-cpp - uses: actions/cache@v3 - with: - path: godot-cpp - key: windows-godot-cpp - - name: Build Godot-CPP - if: steps.cache-godot-cpp.outputs.cache-hit != 'true' - run: scons platform=windows bits=64 target=template_release - working-directory: ./godot-cpp - - name: Build Plugin - run: scons platform=windows bits=64 target=template_release - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: build - path: demo/addons/ropesim/bin/libropesim.windows.release.64.dll - build_linux: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y 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 yasm - - name: Cache Godot-CPP - id: cache-godot-cpp - uses: actions/cache@v3 - with: - path: godot-cpp - key: linux-godot-cpp - - name: Build Godot-CPP - if: steps.cache-godot-cpp.outputs.cache-hit != 'true' - run: scons platform=linux bits=64 target=template_release - working-directory: ./godot-cpp - - name: Build Plugin - run: scons platform=linux bits=64 target=template_release - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: build - path: demo/addons/ropesim/bin/libropesim.linux.release.64.so - build_osx: - runs-on: macos-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Install dependencies - run: brew install scons yasm - - name: Cache Godot-CPP - id: cache-godot-cpp - uses: actions/cache@v3 - with: - path: godot-cpp - key: osx-godot-cpp - - name: Build Godot-CPP - if: steps.cache-godot-cpp.outputs.cache-hit != 'true' - run: scons platform=macos bits=64 target=template_release - working-directory: ./godot-cpp - - name: Build Plugin - run: scons platform=macos bits=64 target=template_release - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: build - path: demo/addons/ropesim/bin/libropesim.macos.release.64.dylib