From 61f7c58f5e5d4dc1eac2713811182d40b5d913f8 Mon Sep 17 00:00:00 2001 From: Yimura <24669514+Yimura@users.noreply.github.com> Date: Wed, 1 Feb 2023 19:49:12 +0100 Subject: [PATCH] feat(Actions): Improve CI compile times (#921) --- .github/workflows/ci.yml | 18 +++++++------ .github/workflows/nightly.yml | 44 +++++++------------------------- src/invoker.cpp | 21 ++++++++------- src/services/gui/gui_service.cpp | 2 +- 4 files changed, 32 insertions(+), 53 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5d5477d..7d6b0e9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,6 @@ jobs: - name: Check CMake version run: cmake --version - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 - - name: Cache build/ id: cache-build uses: actions/cache@v3 @@ -22,23 +19,28 @@ jobs: path: build key: ${{ runner.os }}-build + - name: Setup MSVC environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: amd64 + - name: Generate CMake project - run: cmake -S. -Bbuild -G "Visual Studio 17 2022" -DCMAKE_CONFIGURATION_TYPES=Release + run: cmake -D CMAKE_BUILD_TYPE=Release -S. -Bbuild -G Ninja - name: Build 64bit release DLL - run: cmake --build build --config Release --target ALL_BUILD + run: cmake --build ./build --config Release --target YimMenu -- - name: Check if DLL got built - run: if (-Not (Test-Path -path "build/Release/YimMenu.dll")) {throw 1} + run: if (-Not (Test-Path -path "build/YimMenu.dll")) {throw 1} - name: Rename DLL to YimMenu-dev-{GITHUB_SHA}.dll run: | del YimMenu-dev-*.dll ren YimMenu.dll YimMenu-dev-${{github.sha}}.dll - working-directory: build/Release/ + working-directory: build/ - name: Upload Artifact uses: actions/upload-artifact@v3 with: name: binary - path: build/Release/YimMenu-dev-*.dll + path: build/YimMenu-dev-*.dll diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7dba6f3e..876d8a5d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -21,20 +21,22 @@ jobs: - name: Check CMake version run: cmake --version - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 + - name: Setup MSVC environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: amd64 - name: Generate CMake project - run: cmake -S. -Bbuild -G "Visual Studio 17 2022" -DCMAKE_CONFIGURATION_TYPES=Release + run: cmake -D CMAKE_BUILD_TYPE=Release -S. -Bbuild -G Ninja - name: Build 64bit release DLL - run: cmake --build build --config Release --target ALL_BUILD + run: cmake --build ./build --config Release --target YimMenu -- - name: Upload Artifact uses: actions/upload-artifact@v3 with: name: binary - path: build/Release/YimMenu.dll + path: build/YimMenu.dll - name: Generate Build Info id: var @@ -42,33 +44,6 @@ jobs: echo "full_sha=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT echo "short_sha=$(git rev-parse --short HEAD)" >> $env:GITHUB_OUTPUT - check_detections: - runs-on: ubuntu-latest - name: Check for detections in Binary and notify if necesarry - needs: build_nightly - steps: - - name: Download Artifact - uses: actions/download-artifact@v3 - with: - name: binary - - - name: Test file for detected bits - id: detections - uses: yimura/gtav-sigscan-action@v0.0.3 - with: - file: ./YimMenu.dll - - - name: Notify on Discord - if: ${{ steps.detections.outputs.is_detected == 'true' }} - uses: tsickert/discord-webhook@v5.3.0 - with: - webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} - embed-title: YimMenu has been detected by the sigscanner! - embed-description: | - The following bits have been detected: - ```yml - ${{ steps.detections.outputs.detected_string }} - ``` check_date: runs-on: ubuntu-latest name: Check latest commit @@ -125,12 +100,11 @@ jobs: ``` To verify the build SHA256 during the action, click the build link, go-to "Create Release", open the Echo build sha256 step and read the sha256. - Compare this build hash with one that you generated yourself from the build artifacts. - Alternatively you can download the build artifacts, generate a SHA256 checksum and compare it with the below binary. + You can download the build artifacts, generate a SHA256 checksum and compare it with the below binary. Build artifacts ARE NOT automatically the same as release assets since release assets can be modified afterwards. These are nightly builds of YimMenu, they are provided for testing purposes only: - - Test if your build environment produces a broken BigBaseV2.dll + - Test if your build environment produces a broken YimMenu.dll - Test if source code is out of date and no longer compatible with the current version of GTA V If you wish to use this menu as-is you are on your own, no warranty is provided. diff --git a/src/invoker.cpp b/src/invoker.cpp index 53159a9e..6da4626c 100644 --- a/src/invoker.cpp +++ b/src/invoker.cpp @@ -40,16 +40,19 @@ namespace big { rage::scrNativeHandler handler = it->second; - __try + [this, hash, handler] { - _call_asm(&m_call_context, handler, g_pointers->m_native_return); - // handler(&m_call_context); - g_pointers->m_fix_vectors(&m_call_context); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - [hash]() { LOG(WARNING) << "Exception caught while trying to call " << hash << " native."; }(); - } + __try + { + _call_asm(&m_call_context, handler, g_pointers->m_native_return); + // handler(&m_call_context); + g_pointers->m_fix_vectors(&m_call_context); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + [hash]() { LOG(WARNING) << "Exception caught while trying to call " << hash << " native."; }(); + } + }(); } else { diff --git a/src/services/gui/gui_service.cpp b/src/services/gui/gui_service.cpp index 3519c270..815cff1c 100644 --- a/src/services/gui/gui_service.cpp +++ b/src/services/gui/gui_service.cpp @@ -14,7 +14,7 @@ namespace big navigation_struct* gui_service::get_selected() { - navigation_struct tab_none = { "", nullptr }; + static navigation_struct tab_none = { "", nullptr }; if (current_tab.empty() || current_tab.at(0) == tabs::NONE) return &tab_none;