From d25fa7fe1e99f2601996100c6b8fe0f8ef301c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 4 Apr 2023 08:52:12 +0200 Subject: [PATCH 1/5] Fix compilation with mingw GCC 12 Another case of the compiler bug found in #17371 --- src/openrct2/scripting/Plugin.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/openrct2/scripting/Plugin.cpp b/src/openrct2/scripting/Plugin.cpp index 6ff1fd6f70..26059a0aca 100644 --- a/src/openrct2/scripting/Plugin.cpp +++ b/src/openrct2/scripting/Plugin.cpp @@ -123,7 +123,15 @@ void Plugin::ThrowIfStopping() const void Plugin::Unload() { +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937, fixed in GCC13 +# if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +# endif _metadata.Main = {}; +# if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic pop +# endif _hasLoaded = false; } From b3b45853b70e519afd6696692a8d0a2e128c1540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 4 Apr 2023 08:53:33 +0200 Subject: [PATCH 2/5] Update CI images to v11 --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bda33661f1..d1dd3abc66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: name: Windows (${{ matrix.platform_name }}) using mingw runs-on: ubuntu-latest needs: check-code-formatting - container: openrct2/openrct2-build:8-mingw + container: openrct2/openrct2-build:11-mingw strategy: fail-fast: false matrix: @@ -262,19 +262,19 @@ jobs: build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off -DDISABLE_FLAC=ON -DDISABLE_VORBIS=ON - platform: x86_64 distro: focal - image: openrct2/openrct2-build:8-focal + image: openrct2/openrct2-build:11-focal build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g1 -gz" -DWITH_TESTS=off - platform: x86_64 distro: jammy - image: openrct2/openrct2-build:8-jammy + image: openrct2/openrct2-build:11-jammy build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" - platform: x86_64 distro: bullseye - image: openrct2/openrct2-build:8-bullseye + image: openrct2/openrct2-build:11-bullseye build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off - platform: i686 distro: focal - image: openrct2/openrct2-build:8-focal32 + image: openrct2/openrct2-build:11-focal32 build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g1 -gz" -DWITH_TESTS=off steps: - name: Checkout @@ -312,7 +312,7 @@ jobs: name: Linux (x86_64, AppImage) runs-on: ubuntu-latest needs: check-code-formatting - container: openrct2/openrct2-build:8-focal + container: openrct2/openrct2-build:11-focal steps: - name: Checkout uses: actions/checkout@v3 @@ -370,7 +370,7 @@ jobs: name: Linux (Debug, [http, network, flac, vorbis OpenGL] disabled) using clang runs-on: ubuntu-latest needs: check-code-formatting - container: openrct2/openrct2-build:8-jammy + container: openrct2/openrct2-build:11-jammy steps: - name: Checkout uses: actions/checkout@v3 @@ -386,7 +386,7 @@ jobs: name: Android runs-on: ubuntu-latest needs: check-code-formatting - container: openrct2/openrct2-build:8-android + container: openrct2/openrct2-build:11-android steps: - name: Checkout uses: actions/checkout@v3 From e822880db8659a4c350ef446acaa5d0f6f83ffd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 4 Apr 2023 08:54:19 +0200 Subject: [PATCH 3/5] Add clang-based coverage information for tests --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1dd3abc66..d5a989413d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -382,6 +382,39 @@ jobs: uses: ammaraskar/gcc-problem-matcher@master - name: Build OpenRCT2 run: . scripts/setenv && build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DDISABLE_NETWORK=ON -DDISABLE_HTTP=ON -DDISABLE_FLAC=ON -DDISABLE_VORBIS=ON -DDISABLE_OPENGL=ON + linux-clang-tests: + name: Linux (Debug) using clang, coverage enabled + runs-on: ubuntu-latest + needs: check-code-formatting + container: openrct2/openrct2-build:11-jammy + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: linux-clang + - name: Install GCC problem matcher + uses: ammaraskar/gcc-problem-matcher@master + - name: Build OpenRCT2 + run: . scripts/setenv && build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping" -DWITH_TESTS=on + - name: Run Tests + run: . scripts/setenv -q && LLVM_PROFILE_FILE="openrct2-coverage-%p.profraw" run-tests + - name: Process coverage information + run: | + cd bin + llvm-profdata merge -sparse openrct2-coverage*profraw -o openrct2.profdata + llvm-cov export -instr-profile=openrct2.profdata ./OpenRCT2Tests > coverage.json + xz -1v openrct2.profdata + xz -1v coverage.json + - name: Upload artifacts (CI) + uses: actions/upload-artifact@v3 + with: + name: OpenRCT2-${{ runner.os }}-coverage + path: | + bin/*profdata* + bin/coverage.json* + if-no-files-found: error android: name: Android runs-on: ubuntu-latest From b996a59d3c2d276a0af3270ce39fe59533c62fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 4 Apr 2023 09:56:20 +0200 Subject: [PATCH 4/5] Provide coverage report in CI logs --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5a989413d..968035aed4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -405,6 +405,7 @@ jobs: cd bin llvm-profdata merge -sparse openrct2-coverage*profraw -o openrct2.profdata llvm-cov export -instr-profile=openrct2.profdata ./OpenRCT2Tests > coverage.json + llvm-cov report ./OpenRCT2Tests -instr-profile=openrct2.profdata xz -1v openrct2.profdata xz -1v coverage.json - name: Upload artifacts (CI) From 0f7996f00634b3f4e7041b33a9f9067038fe3a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 4 Apr 2023 09:56:31 +0200 Subject: [PATCH 5/5] Include test binary in coverage artifacts for offline processing --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 968035aed4..148ec7b5f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -408,6 +408,7 @@ jobs: llvm-cov report ./OpenRCT2Tests -instr-profile=openrct2.profdata xz -1v openrct2.profdata xz -1v coverage.json + xz -1v OpenRCT2Tests - name: Upload artifacts (CI) uses: actions/upload-artifact@v3 with: @@ -415,6 +416,7 @@ jobs: path: | bin/*profdata* bin/coverage.json* + bin/OpenRCT2Tests.xz if-no-files-found: error android: name: Android