fix: improve CI build robustness with better stubs and paths

This commit is contained in:
Marvin
2026-04-20 06:23:58 +02:00
parent 524eaacbd5
commit 1fd8938f2b
3 changed files with 72 additions and 21 deletions
+22 -4
View File
@@ -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
+26 -1
View File
@@ -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)"
+24 -16
View File
@@ -6,6 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RepoRoot>$(MSBuildProjectDirectory)\..</RepoRoot>
<AssemblyName>gregCore</AssemblyName>
<RootNamespace>gregCore</RootNamespace>
<Version>1.0.0.33-pre</Version>
@@ -20,48 +21,55 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="MelonLoader" Condition="'$(CI)' != 'true'">
<HintPath>$(MELON_BASE_DIR)\net6\MelonLoader.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MelonLoader" Condition="'$(CI)' == 'true'">
<HintPath>$(RepoRoot)\ci-stubs\MelonLoader.dll</HintPath>
<!-- Common References with CI Fallback -->
<Reference Include="MelonLoader">
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\net6\MelonLoader.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\MelonLoader.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Il2CppInterop.Runtime">
<HintPath>$(MELON_BASE_DIR)\net6\Il2CppInterop.Runtime.dll</HintPath>
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\net6\Il2CppInterop.Runtime.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\Il2CppInterop.Runtime.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Il2CppInterop.Common">
<HintPath>$(MELON_BASE_DIR)\net6\Il2CppInterop.Common.dll</HintPath>
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\net6\Il2CppInterop.Common.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\Il2CppInterop.Common.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="0Harmony">
<HintPath>$(MELON_BASE_DIR)\net6\0Harmony.dll</HintPath>
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\net6\0Harmony.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>$(MELON_BASE_DIR)\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>$(MELON_BASE_DIR)\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\Il2Cppmscorlib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>$(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.IMGUIModule.dll</HintPath>
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.IMGUIModule.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\UnityEngine.IMGUIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>$(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.UIModule.dll</HintPath>
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.UIModule.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\UnityEngine.UIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>$(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.InputLegacyModule.dll</HintPath>
<HintPath Condition="'$(CI)' != 'true'">$(MELON_BASE_DIR)\Il2CppAssemblies\UnityEngine.InputLegacyModule.dll</HintPath>
<HintPath Condition="'$(CI)' == 'true'">$(RepoRoot)\ci-stubs\UnityEngine.InputLegacyModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
@@ -71,4 +79,4 @@
<PackageReference Include="MoonSharp" Version="2.0.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
</Project>