Skip to content

Commit

Permalink
[CI] Added a job without Lua scripting
Browse files Browse the repository at this point in the history
- This will allow checking that everything builds & links properly without Lua scripting support

- Prevented scripting to be used in the full demo if unavailable
  • Loading branch information
Razakhel committed Nov 16, 2024
1 parent 2d04b19 commit e2a7558
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 34 deletions.
46 changes: 33 additions & 13 deletions .github/workflows/RaZ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
linux:
name: "Linux (${{ matrix.compiler.c }}, ${{ matrix.build_type }}\
${{ !matrix.use_audio && ', no audio' || '' }}\
${{ !matrix.use_lua && ', no Lua' || '' }}\
${{ !matrix.use_window && ', no window' || '' }})"
runs-on: ubuntu-latest

Expand All @@ -24,11 +25,14 @@ jobs:
- Release
use_audio:
- true
use_lua:
- true
use_window:
- true
include:
- { compiler: { c: gcc, cpp: g++ }, build_type: Debug, use_audio: false, use_window: true }
- { compiler: { c: gcc, cpp: g++ }, build_type: Debug, use_audio: true, use_window: false }
- { compiler: { c: gcc, cpp: g++ }, build_type: Debug, use_audio: false, use_lua: true, use_window: true }
- { compiler: { c: gcc, cpp: g++ }, build_type: Debug, use_audio: true, use_lua: false, use_window: true }
- { compiler: { c: gcc, cpp: g++ }, build_type: Debug, use_audio: true, use_lua: true, use_window: false }

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -77,6 +81,7 @@ jobs:
-DCMAKE_C_COMPILER=${{ matrix.compiler.c }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp }} \
-DRAZ_BUILD_EXAMPLES=ON -DRAZ_GEN_DOC=ON \
-DRAZ_USE_AUDIO=${{ matrix.use_audio && 'ON' || 'OFF' }} \
-DRAZ_USE_LUA=${{ matrix.use_lua && 'ON' || 'OFF' }} \
-DRAZ_USE_WINDOW=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_IMGUI=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_FBX=OFF -DRAZ_BUILD_TESTS=ON ${{ matrix.compiler.c == 'gcc' && '-DRAZ_ENABLE_COVERAGE=ON' || '' }} \
Expand Down Expand Up @@ -112,7 +117,7 @@ jobs:
# Preparing code coverage; only done with GCC in Debug with all features enabled
- name: Coverage setup
if: matrix.compiler.c == 'gcc' && matrix.build_type == 'Debug' && matrix.use_audio && matrix.use_window
if: matrix.compiler.c == 'gcc' && matrix.build_type == 'Debug' && matrix.use_audio && matrix.use_lua && matrix.use_window
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
lcov -d ./CMakeFiles/RaZ.dir/src/ -c -o coverage.info &&
Expand All @@ -121,7 +126,7 @@ jobs:
# Processing code coverage; only done with GCC in Debug with all features enabled
- name: Coverage processing
if: matrix.compiler.c == 'gcc' && matrix.build_type == 'Debug' && matrix.use_audio && matrix.use_window
if: matrix.compiler.c == 'gcc' && matrix.build_type == 'Debug' && matrix.use_audio && matrix.use_lua && matrix.use_window
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -133,7 +138,7 @@ jobs:
run: sudo cmake --install . --prefix ./ --config ${{ matrix.build_type }}

- name: Upload build
if: matrix.use_audio && matrix.use_window
if: matrix.use_audio && matrix.use_lua && matrix.use_window
uses: actions/upload-artifact@v4
with:
name: RaZ-linux-${{ matrix.compiler.c }}-${{ matrix.build_type }}-${{ github.sha }}
Expand All @@ -148,6 +153,7 @@ jobs:
windows:
name: "Windows (${{ matrix.compiler.c }}, ${{ matrix.build_type }}\
${{ !matrix.use_audio && ', no audio' || '' }}\
${{ !matrix.use_lua && ', no Lua' || '' }}\
${{ !matrix.use_window && ', no window' || '' }})"
runs-on: windows-2022
env:
Expand All @@ -163,11 +169,14 @@ jobs:
- Release
use_audio:
- true
use_lua:
- true
use_window:
- true
include:
- { compiler: { c: cl, cpp: cl }, build_type: Debug, use_audio: false, use_window: true }
- { compiler: { c: cl, cpp: cl }, build_type: Debug, use_audio: true, use_window: false }
- { compiler: { c: cl, cpp: cl }, build_type: Debug, use_audio: false, use_lua: true, use_window: true }
- { compiler: { c: cl, cpp: cl }, build_type: Debug, use_audio: true, use_lua: false, use_window: true }
- { compiler: { c: cl, cpp: cl }, build_type: Debug, use_audio: true, use_lua: true, use_window: false }

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -202,6 +211,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DRAZ_BUILD_EXAMPLES=ON -DRAZ_GEN_DOC=OFF \
-DRAZ_USE_AUDIO=${{ matrix.use_audio && 'ON' || 'OFF' }} \
-DRAZ_USE_LUA=${{ matrix.use_lua && 'ON' || 'OFF' }} \
-DRAZ_USE_WINDOW=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_IMGUI=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_FBX=OFF -DRAZ_BUILD_TESTS=ON \
Expand All @@ -221,7 +231,7 @@ jobs:
run: cmake --install . --prefix C:/RaZ --config ${{ matrix.build_type }}

- name: Upload build
if: matrix.use_audio && matrix.use_window
if: matrix.use_audio && matrix.use_lua && matrix.use_window
uses: actions/upload-artifact@v4
with:
name: RaZ-windows-${{ matrix.compiler.c }}-${{ matrix.build_type }}-${{ github.sha }}
Expand All @@ -235,6 +245,7 @@ jobs:
macos:
name: "macOS (${{ matrix.compiler.c }}, ${{ matrix.build_type }}\
${{ !matrix.use_audio && ', no audio' || '' }}\
${{ !matrix.use_lua && ', no Lua' || '' }}\
${{ !matrix.use_window && ', no window' || '' }})"
runs-on: macos-latest

Expand All @@ -248,11 +259,14 @@ jobs:
- Release
use_audio:
- true
use_lua:
- true
use_window:
- true
include:
- { compiler: { c: clang, cpp: clang++ }, build_type: Debug, use_audio: false, use_window: true }
- { compiler: { c: clang, cpp: clang++ }, build_type: Debug, use_audio: true, use_window: false }
- { compiler: { c: clang, cpp: clang++ }, build_type: Debug, use_audio: false, use_lua: true, use_window: true }
- { compiler: { c: clang, cpp: clang++ }, build_type: Debug, use_audio: true, use_lua: false, use_window: true }
- { compiler: { c: clang, cpp: clang++ }, build_type: Debug, use_audio: true, use_lua: true, use_window: false }

steps:
- uses: actions/checkout@v4
Expand All @@ -278,6 +292,7 @@ jobs:
-DCMAKE_C_COMPILER=${{ matrix.compiler.c }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp }} \
-DRAZ_BUILD_EXAMPLES=ON -DRAZ_GEN_DOC=OFF \
-DRAZ_USE_AUDIO=${{ matrix.use_audio && 'ON' || 'OFF' }} \
-DRAZ_USE_LUA=${{ matrix.use_lua && 'ON' || 'OFF' }} \
-DRAZ_USE_WINDOW=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_IMGUI=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_FBX=OFF -DRAZ_BUILD_TESTS=ON \
Expand All @@ -298,7 +313,7 @@ jobs:
run: sudo cmake --install . --prefix ./ --config ${{ matrix.build_type }}

- name: Upload build
if: matrix.use_audio && matrix.use_window
if: matrix.use_audio && matrix.use_lua && matrix.use_window
uses: actions/upload-artifact@v4
with:
name: RaZ-macos-${{ matrix.compiler.c }}-${{ matrix.build_type }}-${{ github.sha }}
Expand All @@ -312,7 +327,8 @@ jobs:

emscripten:
name: "Emscripten (${{ matrix.compiler.c }}, ${{ matrix.build_type }}\
${{ !matrix.use_audio && ', no audio' || '' }})"
${{ !matrix.use_audio && ', no audio' || '' }}\
${{ !matrix.use_lua && ', no Lua' || '' }})"
runs-on: ubuntu-latest
env:
EMSCRIPTEN_VERSION: 3.1.0 # The 'latest' version may fail to build
Expand All @@ -327,8 +343,11 @@ jobs:
- Release
use_audio:
- true
use_lua:
- true
include:
- { compiler: { c: emcc, cpp: em++ }, build_type: Debug, use_audio: false }
- { compiler: { c: emcc, cpp: em++ }, build_type: Debug, use_audio: false, use_lua: true }
- { compiler: { c: emcc, cpp: em++ }, build_type: Debug, use_audio: true, use_lua: false }

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -382,6 +401,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DRAZ_BUILD_EXAMPLES=ON -DRAZ_GEN_DOC=OFF \
-DRAZ_USE_AUDIO=${{ matrix.use_audio && 'ON' || 'OFF' }} \
-DRAZ_USE_LUA=${{ matrix.use_lua && 'ON' || 'OFF' }} \
-DRAZ_USE_FBX=OFF -DRAZ_BUILD_TESTS=ON ${{ matrix.build_type == 'Debug' && '-DRAZ_EMSCRIPTEN_DEBUG_FAST_LINK=ON' || '' }} \
-DSKIP_RENDERER_ERRORS=ON -DENABLE_DEBUG_INFO=ON \
$GITHUB_WORKSPACE &&
Expand Down
44 changes: 23 additions & 21 deletions examples/EmscriptenAssets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -177,31 +177,33 @@ target_link_options(
# Assets - ScriptDemo #
#######################

set(
RaZ_ScriptDemo_ASSETS

assets/meshes/shield.obj
assets/materials/shield.mtl
assets/textures/shield_albedo.png
assets/textures/shield_normal.png
assets/textures/shield_metallic.png
assets/textures/shield_roughness.png
assets/textures/shield_ao.png
)
if (RAZ_USE_LUA)
set(
RaZ_ScriptDemo_ASSETS

assets/meshes/shield.obj
assets/materials/shield.mtl
assets/textures/shield_albedo.png
assets/textures/shield_normal.png
assets/textures/shield_metallic.png
assets/textures/shield_roughness.png
assets/textures/shield_ao.png
)

foreach (ASSET_PATH ${RaZ_ScriptDemo_ASSETS})
target_link_options(RaZ_ScriptDemo PRIVATE "SHELL:--preload-file ${CMAKE_SOURCE_DIR}/${ASSET_PATH}@${ASSET_PATH}")
endforeach ()
foreach (ASSET_PATH ${RaZ_ScriptDemo_ASSETS})
target_link_options(RaZ_ScriptDemo PRIVATE "SHELL:--preload-file ${CMAKE_SOURCE_DIR}/${ASSET_PATH}@${ASSET_PATH}")
endforeach ()

target_link_options(
RaZ_ScriptDemo
target_link_options(
RaZ_ScriptDemo

PRIVATE
PRIVATE

"SHELL:--preload-file ${CMAKE_SOURCE_DIR}/scripts@scripts"
"SHELL:--preload-file ${CMAKE_SOURCE_DIR}/shaders@shaders"
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
)
"SHELL:--preload-file ${CMAKE_SOURCE_DIR}/scripts@scripts"
"SHELL:--preload-file ${CMAKE_SOURCE_DIR}/shaders@shaders"
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
)
endif ()

####################
# Assets - SSRDemo #
Expand Down
4 changes: 4 additions & 0 deletions examples/fullDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ int main() {
// Scripting //
///////////////

#if !defined(RAZ_NO_LUA)
constexpr std::string_view luaScriptSource = R"(
local rotAngle = Degreesf.new(20)
Expand All @@ -235,6 +236,7 @@ end)";
world.addSystem<Raz::ScriptSystem>();

auto& luaScript = mesh.addComponent<Raz::LuaScript>(luaScriptSource.data());
#endif

///////////
// Audio //
Expand Down Expand Up @@ -272,6 +274,7 @@ end)";
DemoUtils::insertOverlayCullingOption(window, overlay);
DemoUtils::insertOverlayVerticalSyncOption(window, overlay);

#if !defined(RAZ_NO_LUA)
constexpr float overlayScriptWidth = 600.f;
constexpr float overlayScriptSourceHeight = 225.f;
constexpr float overlayScriptHeight = overlayScriptSourceHeight + 60.f;
Expand Down Expand Up @@ -300,6 +303,7 @@ end)";
});

overlay.addButton("Edit script", [&overlayScript] () noexcept { overlayScript.enable(!overlayScript.isEnabled()); });
#endif

overlay.addSeparator();

Expand Down

0 comments on commit e2a7558

Please sign in to comment.