From 1fd8938f2bd89a77c445fb58f5820b083552966f Mon Sep 17 00:00:00 2001 From: Marvin <52848568+mleem97@users.noreply.github.com> Date: Mon, 20 Apr 2026 06:23:58 +0200 Subject: [PATCH] fix: improve CI build robustness with better stubs and paths --- .github/workflows/release.yml | 26 +++++++++++++++++++---- ci-stubs/create-stubs.sh | 27 ++++++++++++++++++++++- src/gregCore.csproj | 40 +++++++++++++++++++++-------------- 3 files changed, 72 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae9ed063..284f6ff0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Set Version shell: pwsh @@ -31,13 +31,24 @@ jobs: echo "Building gregFramework version $version" # 1. Build gregCore - # Hinweis: In CI müssen ggf. Stubs für MelonLoader/Il2Cpp vorhanden sein. - name: Build gregCore + shell: pwsh run: | - if (Test-Path "ci-stubs/create-stubs.sh") { bash ci-stubs/create-stubs.sh } + if (Test-Path "ci-stubs/create-stubs.sh") { + # Use bash (from Git for Windows) to run the stub script + bash ci-stubs/create-stubs.sh + } dotnet build src/gregCore.csproj -c Release -p:Version=${{ env.VERSION }} -p:CI=true - # 2. Prepare Assets + # 2. Build gregExtractor (Optional, only if in this repo) + - name: Publish gregExtractor + shell: pwsh + run: | + if (Test-Path "gregExtractor/gregExtractor.csproj") { + dotnet publish gregExtractor/gregExtractor.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:Version=${{ env.VERSION }} -o publish/extractor + } + + # 3. Prepare Assets - name: Prepare Assets shell: pwsh run: | @@ -50,6 +61,13 @@ jobs: Copy-Item $coreDll $releaseDir/ Compress-Archive -Path $coreDll, "README.md" -DestinationPath "$releaseDir/gregCore-v${{ env.VERSION }}.zip" } + + # gregExtractor + $extractorExe = "publish/extractor/gregExtractor.exe" + if (Test-Path $extractorExe) { + Copy-Item $extractorExe $releaseDir/ + Compress-Archive -Path "publish/extractor/*" -DestinationPath "$releaseDir/gregExtractor-v${{ env.VERSION }}.zip" + } - name: Create Release uses: softprops/action-gh-release@v2 diff --git a/ci-stubs/create-stubs.sh b/ci-stubs/create-stubs.sh index 2a4f7c02..bdf68408 100644 --- a/ci-stubs/create-stubs.sh +++ b/ci-stubs/create-stubs.sh @@ -2,4 +2,29 @@ # Erzeugt leere Stub-DLLs für CI-Build ohne echtes MelonLoader # Diese enthalten nur die nötigen Type-Definitionen -dotnet new classlib -n MelonLoaderStub -f net6.0 +mkdir -p ci-stubs +cd ci-stubs + +ASSEMBLIES=( + "MelonLoader" + "Il2CppInterop.Runtime" + "Il2CppInterop.Common" + "0Harmony" + "Assembly-CSharp" + "Il2Cppmscorlib" + "UnityEngine.CoreModule" + "UnityEngine.IMGUIModule" + "UnityEngine.UIModule" + "UnityEngine.InputLegacyModule" +) + +for asm in "${ASSEMBLIES[@]}"; do + if [ ! -f "$asm.dll" ]; then + echo "Creating stub for $asm..." + dotnet new classlib -n "$asm" -f net6.0 --force + dotnet build "$asm/$asm.csproj" -c Release -o . + rm -rf "$asm" + fi +done + +echo "Stubs created in $(pwd)" diff --git a/src/gregCore.csproj b/src/gregCore.csproj index 8012f4ae..5be04384 100644 --- a/src/gregCore.csproj +++ b/src/gregCore.csproj @@ -6,6 +6,7 @@ enable true + $(MSBuildProjectDirectory)\.. gregCore gregCore 1.0.0.33-pre @@ -20,48 +21,55 @@ - - $(MELON_BASE_DIR)\net6\MelonLoader.dll - False - - - $(RepoRoot)\ci-stubs\MelonLoader.dll + + + $(MELON_BASE_DIR)\net6\MelonLoader.dll + $(RepoRoot)\ci-stubs\MelonLoader.dll False - $(MELON_BASE_DIR)\net6\Il2CppInterop.Runtime.dll + $(MELON_BASE_DIR)\net6\Il2CppInterop.Runtime.dll + $(RepoRoot)\ci-stubs\Il2CppInterop.Runtime.dll False - $(MELON_BASE_DIR)\net6\Il2CppInterop.Common.dll + $(MELON_BASE_DIR)\net6\Il2CppInterop.Common.dll + $(RepoRoot)\ci-stubs\Il2CppInterop.Common.dll False - $(MELON_BASE_DIR)\net6\0Harmony.dll + $(MELON_BASE_DIR)\net6\0Harmony.dll + $(RepoRoot)\ci-stubs\0Harmony.dll False - $(MELON_BASE_DIR)\Il2CppAssemblies\Assembly-CSharp.dll + $(MELON_BASE_DIR)\Il2CppAssemblies\Assembly-CSharp.dll + $(RepoRoot)\ci-stubs\Assembly-CSharp.dll False - $(MELON_BASE_DIR)\Il2CppAssemblies\Il2Cppmscorlib.dll + $(MELON_BASE_DIR)\Il2CppAssemblies\Il2Cppmscorlib.dll + $(RepoRoot)\ci-stubs\Il2Cppmscorlib.dll False - $(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.CoreModule.dll + $(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.CoreModule.dll + $(RepoRoot)\ci-stubs\UnityEngine.CoreModule.dll False - $(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.IMGUIModule.dll + $(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.IMGUIModule.dll + $(RepoRoot)\ci-stubs\UnityEngine.IMGUIModule.dll False - $(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.UIModule.dll + $(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.UIModule.dll + $(RepoRoot)\ci-stubs\UnityEngine.UIModule.dll False - $(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.InputLegacyModule.dll + $(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.InputLegacyModule.dll + $(RepoRoot)\ci-stubs\UnityEngine.InputLegacyModule.dll False @@ -71,4 +79,4 @@ - \ No newline at end of file +