From c4170b1d7325cd8479230fd293d17465a0c59a9d Mon Sep 17 00:00:00 2001 From: Fripe070 <72686066+Fripe070@users.noreply.github.com> Date: Sat, 26 Apr 2025 01:31:13 +0200 Subject: [PATCH 1/9] Github actions build --- .github/workflows/build.yml | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fbcf881 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,74 @@ +name: Build meson project + +on: + push: + pull_request: + +jobs: + build: + name: ${{ matrix.os }} / ${{ matrix.compiler }} (${{ matrix.build_type }}) + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + build_type: [release] + + include: + # Linux Compilers + - os: ubuntu-latest + compiler: gcc + - os: ubuntu-latest + compiler: clang + + # Windows Compilers + - os: windows-latest + compiler: msvc + - os: windows-latest + compiler: gcc + - os: windows-latest + compiler: clang + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up C++ environment + uses: aminya/setup-cpp@v1 + with: + ninja: true + meson: true + cmake: true + compiler: ${{ matrix.compiler }} + + - name: Install System Dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libgl1-mesa-dev + + - name: Set reusable workflow outputs + id: set_outputs + shell: bash + run: | + echo "build-dir=${{ github.workspace }}/build" >> $GITHUB_OUTPUT + + - name: Configure Meson + run: meson setup ${{ steps.set_outputs.outputs.build-dir }} --buildtype=${{ matrix.build_type }} + + - name: Build + run: meson compile -C ${{ steps.set_outputs.outputs.build-dir }} + + - name: Upload Build Artifacts + if: github.event_name == 'push' + uses: actions/upload-artifact@v4 + with: + name: build-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }} + path: | + ${{ steps.set_outputs.outputs.build-dir }}/lowlevelgame + ${{ steps.set_outputs.outputs.build-dir }}/lowlevelgame.exe + ${{ github.workspace }}/resources/ + + - name: Run Tests + run: meson test -C ${{ steps.set_outputs.outputs.build-dir }} --print-errorlogs From 1001451693469f1698a2684e078be6d451e507f5 Mon Sep 17 00:00:00 2001 From: Fripe070 <72686066+Fripe070@users.noreply.github.com> Date: Sat, 26 Apr 2025 01:42:17 +0200 Subject: [PATCH 2/9] (CI) And so it begins --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbcf881..3a9ca6b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install -y libgl1-mesa-dev + sudo apt-get install -y libglu1-mesa-dev libgl1-mesa-dev - name: Set reusable workflow outputs id: set_outputs From 9e375a5e29a679683270a1c9738907920cf90a4e Mon Sep 17 00:00:00 2001 From: Fripe070 <72686066+Fripe070@users.noreply.github.com> Date: Sat, 26 Apr 2025 01:46:54 +0200 Subject: [PATCH 3/9] (Not CI?!) Fix CI build error --- src/engine/resources/shader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/resources/shader.cpp b/src/engine/resources/shader.cpp index 06ae40c..d7711b7 100644 --- a/src/engine/resources/shader.cpp +++ b/src/engine/resources/shader.cpp @@ -173,7 +173,7 @@ namespace Resource::Loading std::expected preprocessShaderSource(std::string shaderSrc) { constexpr auto includeDirective = "#include"; - constexpr auto includeDirectiveLength = strlen(includeDirective); + const auto includeDirectiveLength = strlen(includeDirective); std::vector processedFiles; // Avoid infinite recursion and unnecessary file reads From bd9832c9b23bbb9ae6c6a6be0ab1be874749459c Mon Sep 17 00:00:00 2001 From: Fripe070 <72686066+Fripe070@users.noreply.github.com> Date: Sat, 26 Apr 2025 01:51:33 +0200 Subject: [PATCH 4/9] (CI) KILL TESTS --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a9ca6b..4279c14 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,6 +69,3 @@ jobs: ${{ steps.set_outputs.outputs.build-dir }}/lowlevelgame ${{ steps.set_outputs.outputs.build-dir }}/lowlevelgame.exe ${{ github.workspace }}/resources/ - - - name: Run Tests - run: meson test -C ${{ steps.set_outputs.outputs.build-dir }} --print-errorlogs From 5e9bac56f4320b2a99be60441b8124d7dde49cc3 Mon Sep 17 00:00:00 2001 From: Fripe070 <72686066+Fripe070@users.noreply.github.com> Date: Sat, 26 Apr 2025 01:57:37 +0200 Subject: [PATCH 5/9] (CI) Ngl I dont care enough about windows clang to fix this --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4279c14..8c6ad1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,8 +27,6 @@ jobs: compiler: msvc - os: windows-latest compiler: gcc - - os: windows-latest - compiler: clang steps: - name: Checkout code From 882ba405ac111d864a03efa2c7bd53318245b59a Mon Sep 17 00:00:00 2001 From: Fripe070 <72686066+Fripe070@users.noreply.github.com> Date: Sat, 26 Apr 2025 02:06:27 +0200 Subject: [PATCH 6/9] (CI) Matrix my matrix my compiler my matrix --- .github/workflows/build.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c6ad1a..db36327 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,19 +14,13 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] build_type: [release] + compiler: [gcc, clang, msvc] - include: - # Linux Compilers + exclude: - os: ubuntu-latest - compiler: gcc - - os: ubuntu-latest - compiler: clang - - # Windows Compilers - - os: windows-latest compiler: msvc - - os: windows-latest - compiler: gcc + - os: windows-latest # Issues with meson for whatever reason + compiler: clang steps: - name: Checkout code From dcdf203a24aea705921f4b7e254220eafd1fe76c Mon Sep 17 00:00:00 2001 From: Fripe070 <72686066+Fripe070@users.noreply.github.com> Date: Sat, 26 Apr 2025 02:11:30 +0200 Subject: [PATCH 7/9] (CI) Oh.... MSVC does not support C++23 fully --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db36327..0626a48 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,11 +14,9 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] build_type: [release] - compiler: [gcc, clang, msvc] + compiler: [gcc, clang] exclude: - - os: ubuntu-latest - compiler: msvc - os: windows-latest # Issues with meson for whatever reason compiler: clang From 89638f6bdf8c10b782d87975add69f6d6173b8d9 Mon Sep 17 00:00:00 2001 From: Fripe070 <72686066+Fripe070@users.noreply.github.com> Date: Sat, 26 Apr 2025 23:51:50 +0200 Subject: [PATCH 8/9] (CI) Cache Meson dependencies --- .github/workflows/build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0626a48..04cfa2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: Build meson project on: push: pull_request: + workflow_dispatch: jobs: build: @@ -24,6 +25,15 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Cache Meson dependencies + uses: actions/cache@v4 + with: + path: | + ${{ github.workspace }}/subprojects/*/ + key: ${{ runner.os }}-meson-${{ hashFiles('**/meson.build', '**/meson_options.txt', '**/subprojects/*.wrap') }} + restore-keys: | + ${{ runner.os }}-meson- + - name: Set up C++ environment uses: aminya/setup-cpp@v1 with: From fc112ed2825c3b0a6a0550abed5aae9e01c10e15 Mon Sep 17 00:00:00 2001 From: Fripe070 <72686066+Fripe070@users.noreply.github.com> Date: Sun, 27 Apr 2025 00:11:25 +0200 Subject: [PATCH 9/9] (CI) Cleaner artifact uploads --- .github/workflows/build.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04cfa2c..974848b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,12 +60,23 @@ jobs: - name: Build run: meson compile -C ${{ steps.set_outputs.outputs.build-dir }} + + - name: Prepare Artifacts (Linux) + if: github.event_name == 'push' && runner.os == 'Linux' + run: | + cp ${{ steps.set_outputs.outputs.build-dir }}/lowlevelgame ${{ github.workspace }}/lowlevelgame + + - name: Prepare Artifacts (Windows) + if: github.event_name == 'push' && runner.os == 'Windows' + run: | + cp ${{ steps.set_outputs.outputs.build-dir }}/lowlevelgame.exe ${{ github.workspace }}/lowlevelgame.exe + - name: Upload Build Artifacts if: github.event_name == 'push' uses: actions/upload-artifact@v4 with: name: build-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }} path: | - ${{ steps.set_outputs.outputs.build-dir }}/lowlevelgame - ${{ steps.set_outputs.outputs.build-dir }}/lowlevelgame.exe + ${{ github.workspace }}/lowlevelgame + ${{ github.workspace }}/lowlevelgame.exe ${{ github.workspace }}/resources/