Update README.md #355
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: | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "build" | |
cancel-in-progress: false | |
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 | |
- name: Action | |
run: echo ${{github.event_name}} | |
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/save@v4 | |
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: 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 }} | |
# - 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 }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: π Setup git environment of plugin | |
uses: actions/checkout@v4 | |
- name: πΎ Load cached library as debug | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./bin/${{ matrix.lib_debug }} | |
key: ${{ matrix.bin_key }} | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
# - name: πΎ Load cached library as release | |
# uses: actions/cache/restore@v4 | |
# with: | |
# path: ./bin/${{ matrix.lib_release }} | |
# key: ${{ matrix.bin_key }} | |
# enableCrossOsArchive: true | |
# fail-on-cache-miss: true | |
- name: Copy plugin to temp folder | |
shell: bash | |
run: | | |
mkdir ../addons | |
cp -R ../godot-glecs/ ../addons/glecs/ | |
- name: π Setup git environment of plugin | |
uses: actions/checkout@v4 | |
with: | |
ref: "unittests-project" | |
- name: Add glecs plugin from temp to unittests project | |
shell: bash | |
run: | | |
cp -R ../addons/glecs addons/glecs | |
- 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: Print Folder Tree | |
uses: jaywcjlove/github-action-folder-tree@main | |
with: | |
exclude: "addons/glecs/|addons/gut/|cpp|.godot|.git" | |
path: ./ | |
- name: π Run Glecs tests | |
id: run-godot-tests | |
shell: bash | |
run: godot --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' }} | |
needs: ["data", "compile_glecs", "run_test_suite"] | |
runs-on: ubuntu-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/restore@v4 | |
with: | |
# A list of files, directories, and wildcard patterns to cache and restore | |
path: ./bin/${{ needs.data.outputs.lib_debug_linux_x86_64 }} | |
# 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, Windows x86_64 | |
uses: actions/cache/restore@v4 | |
with: | |
# A list of files, directories, and wildcard patterns to cache and restore | |
path: ./bin/${{ needs.data.outputs.lib_debug_windows_x86_64 }} | |
# 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: π Load compiled library, Mac x86_64 | |
# uses: actions/cache/restore@v4 | |
# with: | |
# # A list of files, directories, and wildcard patterns to cache and restore | |
# path: ./bin/${{ needs.data.outputs.lib_debug_macos_x86_64 }} | |
# # 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: π Update nightly | |
run: python utils/update_nightly.py --repository "${{ github.repository }}" --message "${{ 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 |