Fix Windows only failing unittests #289
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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('bin') }}" >> $GITHUB_ENV | |
- name: ποΈ Define cpp cache key Linux | |
shell: bash | |
run: echo "cpp_key=cpp.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('cpp/') }}" >> $GITHUB_ENV | |
- name: ποΈ Define includes cache key Linux | |
shell: bash | |
run: echo "include_key=include.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('cpp/include') }}.${{ hashFiles('cpp/SConstruct') }}" >> $GITHUB_ENV | |
# --- Restore caches --- | |
- name: πΎ Restore cached cpp files | |
uses: actions/cache/[email protected] | |
with: | |
path: cpp | |
key: ${{ env.cpp_key }} | |
- name: πΎ Restore cached include files | |
uses: actions/cache/[email protected] | |
with: | |
path: 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=./cpp platform=${{ matrix.platform }} arch=${{ matrix.arch }} | |
printf *** ls bin/ *** | |
ls 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('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: cpp | |
key: ${{ env.cpp_key }} | |
- name: πΎ Cache cpp include build files | |
uses: actions/cache/save@v4 | |
with: | |
path: cpp/include | |
key: ${{ env.include_key }} | |
- name: πΎ Cache bin | |
uses: actions/cache/[email protected] | |
with: | |
path: ./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 of testing project | |
uses: actions/checkout@v4 | |
with: | |
ref: "unittests-project" | |
- name: π Setup git environment of plugin | |
uses: actions/checkout@v4 | |
with: | |
path: "addons/glecs" | |
- name: πΎ Load cached library as debug | |
uses: actions/cache/[email protected] | |
with: | |
path: ./bin/${{ matrix.lib_debug }} | |
key: ${{ matrix.bin_key }} | |
enableCrossOsArchive: true | |
- name: πΎ Load cached library as release | |
uses: actions/cache/[email protected] | |
with: | |
path: ./bin/${{ matrix.lib_release }} | |
key: ${{ matrix.bin_key }} | |
enableCrossOsArchive: true | |
- run: tree | |
- 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 res://addons/glecs/utils/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 bin/" | |
echo "***" | |
ls 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: ./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: ./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: ./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 ./* ../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 |