Skip to content

Fix godot-cpp submodule #273

Fix godot-cpp submodule

Fix godot-cpp submodule #273

Workflow file for this run

name: Build Process
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
workflow_dispatch:
jobs:
data:
runs-on: ubuntu-latest
outputs:
lib_debug_linux_x86_64: libglecs.linux.template_debug.x86_64.so
lib_release_linux_x86_64: libglecs.linux.template_release.x86_64.so
lib_debug_macos_x86_64: libglecs.macos.template_debug.x86_64.dylib
lib_release_macos_x86_64: libglecs.macos.template_release.x86_64.dylib
lib_debug_windows_x86_64: libglecs.windows.template_debug.x86_64.dll
lib_release_windows_x86_64: libglecs.windows.template_release.x86_64.dll
steps:
- name: Pass
run: echo Pass
compile_glecs:
needs: [data]
strategy:
matrix:
include:
# Linux
- platform: linux
arch: x86_64
glecs_lib: ${{ needs.data.outputs.lib_debug_linux_x86_64 }}
os: ubuntu-latest
# - platform: linux
# arc: arm64
# target: i686-unknown-linux-gnu
# glecs_lib: libglecs.linux.template_debug.arm64.so
# os: ubuntu-latest
# Mac
- platform: macos
arch: x86_64
glecs_lib: ${{ needs.data.outputs.lib_debug_macos_x86_64 }}
os: macos-13
# - target: aarch64-apple-darwin
# os: macos-latest
# glecs_lib: libglecs.dylib
# Windows
- platform: windows
release plreleasem: windows
arch: x86_64
glecs_lib: ${{ needs.data.outputs.lib_debug_windows_x86_64 }}
os: windows-latest
runs-on: ${{ matrix.os }}
outputs:
# Linux
bin_key_linux_x86_64: ${{ steps.set_cache_key.outputs.bin_key_linux_x86_64 }}
# i686-linux_bin_key: ${{ steps.set_cache_key.outputs.i686-unknown-linux-gnu_bin_key }}
# Mac
bin_key_macos_x86_64: ${{ steps.set_cache_key.outputs.bin_key_macos_x86_64 }}
# bin_key_macos_i686: ${{ steps.set_cache_key.outputs.bin_key_macos_i686 }}
# Windows
bin_key_windows_x86_64: ${{ steps.set_cache_key.outputs.bin_key_windows_x86_64 }}
steps:
- name: πŸ™ Setup git environment
uses: actions/checkout@v4
- name: πŸ—³οΈ Initialize git submodules
run: git submodule update --init --recursive
- name: 🐍 Python install
uses: actions/setup-python@v5
with:
python-version: '3.10'
# --- Define keys ---
- name: πŸ”οΈ Define library cache key in env Linux
shell: bash
run: echo "bin_key=lib.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('addons/glecs/bin') }}" >> $GITHUB_ENV
- name: πŸ”οΈ Define cpp cache key Linux
shell: bash
run: echo "cpp_key=cpp.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('addons/glecs/cpp/') }}" >> $GITHUB_ENV
- name: πŸ”οΈ Define includes cache key Linux
shell: bash
run: echo "include_key=include.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('addons/glecs/cpp/include') }}.${{ hashFiles('addons/glecs/cpp/SConstruct') }}" >> $GITHUB_ENV
# --- Restore caches ---
- name: πŸ’Ύ Restore cached cpp files
uses: actions/cache/[email protected]
with:
path: addons/glecs/cpp
key: ${{ env.cpp_key }}
- name: πŸ’Ύ Restore cached include files
uses: actions/cache/[email protected]
with:
path: addons/glecs/cpp/include
key: ${{ env.include_key }}
# --- Platform specific setup ---
# - name: 🐧 Install GCC multilib for Linux i686 build
# if: ${{ matrix.platform == 'linux' && matrix.arch == 'i686' && runner.os == 'Linux'}}
# run: sudo apt-get install gcc-multilib
- name: πŸͺŸ Install mingw for cross compiling from Linux to Windows
if: ${{ matrix.platform == 'windows' && runner.os == 'Linux' }}
run: |
sudo apt install g++-mingw-w64-x86-64
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
# --- Compile Glecs ---
- name: πŸ”¨ Install scons
run: |
pip install scons
- name: πŸ› οΈ Build C++ code
run: |
scons --directory=addons/glecs/cpp platform=${{ matrix.platform }} arch=${{ matrix.arch }}
printf *** ls addons/glecs/bin/ ***
ls addons/glecs/bin
#target=template_release
# --- Define bin key ---
- name: πŸ”οΈ Define library cache key in env
shell: bash
run: |
printf "*** Setting key in env***"
echo "bin_key=bin.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('addons/glecs/bin') }}" >> $GITHUB_ENV
- name: πŸ”οΈ Define library cache key in output
id: set_cache_key
shell: bash
run: |
printf "*** Setting key ***"
echo "bin_key_${{ matrix.platform }}_${{ matrix.arch }}=${{env.bin_key}}" >> $GITHUB_OUTPUT
# --- Save caches ---
- name: πŸ’Ύ Cache cpp source build files
uses: actions/cache/save@v4
with:
path: addons/glecs/cpp
key: ${{ env.cpp_key }}
- name: πŸ’Ύ Cache cpp include build files
uses: actions/cache/save@v4
with:
path: addons/glecs/cpp/include
key: ${{ env.include_key }}
- name: πŸ’Ύ Cache bin
uses: actions/cache/[email protected]
with:
path: ./addons/glecs/bin/${{ matrix.glecs_lib }}
key: ${{ env.bin_key }}
enableCrossOsArchive: true
run_test_suite:
needs: [data, compile_glecs]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
bin_key: ${{ needs.compile_glecs.outputs.bin_key_linux_x86_64 }}
lib_debug: ${{ needs.data.outputs.lib_debug_linux_x86_64 }}
lib_release: ${{ needs.data.outputs.lib_release_linux_x86_64 }}
- os: macos-13
bin_key: ${{ needs.compile_glecs.outputs.bin_key_macos_x86_64 }}
lib_debug: ${{ needs.data.outputs.lib_debug_macos_x86_64 }}
lib_release: ${{ needs.data.outputs.lib_release_macos_x86_64 }}
- os: windows-latest
bin_key: ${{ needs.compile_glecs.outputs.bin_key_windows_x86_64 }}
lib_debug: ${{ needs.data.outputs.lib_debug_windows_x86_64 }}
lib_release: ${{ needs.data.outputs.lib_release_windows_x86_64 }}
runs-on: ${{ matrix.os }}
steps:
- name: πŸ™ Setup git environment
uses: actions/checkout@v4
- name: πŸ’Ύ Load cached library as debug
uses: actions/cache/[email protected]
with:
path: ./addons/glecs/bin/${{ matrix.lib_debug }}
key: ${{ matrix.bin_key }}
enableCrossOsArchive: true
- name: πŸ’Ύ Load cached library as release
uses: actions/cache/[email protected]
with:
path: ./addons/glecs/bin/${{ matrix.lib_release }}
key: ${{ matrix.bin_key }}
enableCrossOsArchive: true
- name: πŸ€– Setup Godot binary
uses: lihop/setup-godot@v2
with:
version: 4.3-stable
bits: 64
mono: false
- name: πŸ€– Run Godot import
shell: bash
run: godot --headless --import
- name: πŸ“ Run Glecs tests
id: run-godot-tests
shell: bash
run: godot --script unittests.gd --headless --verbose
- name: πŸ“„ Debug print when tests error
shell: bash
if: failure() && steps.run-godot-tests.outcome != 'success'
run: |
echo ""
echo "***"
echo "LS"
echo "***"
ls -g -A
echo ""
echo "***"
echo "LS glecs/bin/"
echo "***"
ls addons/glecs/bin
update_nightly:
if: ${{ github.event_name == 'push' || github.event_name == 'closed' }}
needs: ["compile_glecs", "run_test_suite"]
runs-on: windows-latest
steps:
- name: πŸ™ Setup git environment
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: 🐧 Load compiled library, Linux x86_64
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/x86_64-unknown-linux-gnu/release/libglecs.so
# An explicit key for restoring and saving the cache
key: ${{ needs.compile_glecs.outputs.bin_key_linux_x86_64 }}
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
enableCrossOsArchive: true
- name: 🍎 Load compiled library, Mac x86_64
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/x86_64-apple-darwin/release/libglecs.dylib
# An explicit key for restoring and saving the cache
key: ${{ needs.compile_glecs.outputs.bin_key_macos_x86_64 }}
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
enableCrossOsArchive: true
- name: πŸͺŸ Load compiled library, Windows x86_64
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/x86_64-pc-windows-gnu/release/glecs.dll
# An explicit key for restoring and saving the cache
key: ${{ needs.compile_glecs.outputs.bin_key_windows_x86_64 }}
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
enableCrossOsArchive: true
- name: 🐍 Setup Python
uses: actions/[email protected]
with:
python-version: 3.11.2
cache: pip
# - name: πŸš£β€β™‚οΈ Convert dev plugin to nightly format
# run: |
# cd addons/glecs
# pip install regex
# python _build_for_nightly.py
- name: πŸŒ™ Clone nightly branch
run: |
git clone https://github.com/${{ github.repository }} ../nightly_tmp -b nightly
mkdir ../nightly
mkdir ../nightly/.git
cp -r ../nightly_tmp/.git/* ../nightly/.git/
- name: πŸ–¨οΈ Copy dev branch plugin to nightly
run: |
cp -r -force ./addons/glecs/* ../nightly/
- name: βž• Add and commit to nightly
id: add-and-commit
continue-on-error: true
run: |
cd ../nightly
git config --global user.name github-actions[bot]
git config --global user.email [email protected]
git add .
git commit --all -m "(AUTO) ${{ github.event.head_commit.message }}"
- name: πŸ“€ Push to nightly
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
branch: nightly
directory: ../nightly
- name: 🏁 Finish
run: exit 0