From e925f282848708a476e9446606d4833bf71fefa4 Mon Sep 17 00:00:00 2001
From: Stonesmile <62522391+StonesmileGit@users.noreply.github.com>
Date: Sun, 11 Aug 2024 07:48:22 +0200
Subject: [PATCH] CI using CKAN (#2979)
* Rework CSproj files to use KSPRoot-relative paths
* Change workflows to use CKAN for dependencies
* Change UGUI project to use KSPRoot-relative paths
* Change EGC project to use KSPRoot-relative paths
* Add setting default value of KSPRoot if not set
---
.github/workflows/attachReleaseArtifacts.yml | 43 ++++++++------
.github/workflows/buildAndTest.yml | 33 +++++++----
.../EngineGroupController.csproj | 56 +++++++++++++-----
Source/InstallChecker/ROInstallChecker.csproj | 15 ++++-
Source/RealismOverhaul.csproj | 38 +++++++-----
.../UnityGUIFramework.csproj | 59 +++++++++++++------
6 files changed, 163 insertions(+), 81 deletions(-)
diff --git a/.github/workflows/attachReleaseArtifacts.yml b/.github/workflows/attachReleaseArtifacts.yml
index 9cc358e8ee..d912af341f 100644
--- a/.github/workflows/attachReleaseArtifacts.yml
+++ b/.github/workflows/attachReleaseArtifacts.yml
@@ -5,6 +5,9 @@ on:
release:
types: [published]
+env:
+ KSP_ROOT: /tmp/ksp
+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
attach-release-artifacts:
@@ -28,14 +31,18 @@ jobs:
- name: Download required assemblies
id: download-assemblies
- uses: KSP-RO/BuildTools/download-assemblies@master
+ uses: KSP-RO/BuildTools/download-assemblies-v2@master
with:
KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }}
+ dependency-identifiers: |
+ Harmony2
+ ROUtils
+ RealFuels
- name: Update AssemblyInfo
uses: KSP-RO/BuildTools/update-assembly-info@master
with:
- path: ${GITHUB_WORKSPACE}/Source/Properties/AssemblyInfo.cs
+ path: ${{ github.workspace }}/Source/Properties/AssemblyInfo.cs
tag: ${{ github.event.release.tag_name }}
- name: Build mod solution
@@ -43,28 +50,28 @@ jobs:
env:
TAG_STRING: ${{ github.event.release.tag_name }}
run: |
- msbuild /restore /p:RestorePackagesConfig=true /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${GITHUB_WORKSPACE}/Source/RealismOverhaul.sln
- msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${GITHUB_WORKSPACE}/Source/KerbalPlugins.EngineGroupController.sln
- cp -v ${GITHUB_WORKSPACE}/Source/obj/Release/RealismOverhaul.dll ${GITHUB_WORKSPACE}/GameData/RealismOverhaul/Plugins/RealismOverhaul.dll
- cp -v ${GITHUB_WORKSPACE}/Source/InstallChecker/obj/Release/ROInstallChecker.dll ${GITHUB_WORKSPACE}/GameData/RealismOverhaul/Plugins/ROInstallChecker.dll
- cp -v ${GITHUB_WORKSPACE}/Source/EngineGroupController/obj/Release/EngineGroupController.dll ${GITHUB_WORKSPACE}/GameData/EngineGroupController/Plugins/EngineGroupController.dll
- cp -v ${GITHUB_WORKSPACE}/Source/UnityGUIFramework/obj/Release/UnityGUIFramework.dll ${GITHUB_WORKSPACE}/GameData/EngineGroupController/Plugins/UnityGUIFramework.dll
+ msbuild /restore /p:RestorePackagesConfig=true /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${{ github.workspace }}/Source/RealismOverhaul.sln /p:KSPRoot="${{ env.KSP_ROOT }}"
+ msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${{ github.workspace }}/Source/KerbalPlugins.EngineGroupController.sln /p:KSPRoot="${{ env.KSP_ROOT }}"
+ cp -v ${{ github.workspace }}/Source/obj/Release/RealismOverhaul.dll ${{ github.workspace }}/GameData/RealismOverhaul/Plugins/RealismOverhaul.dll
+ cp -v ${{ github.workspace }}/Source/InstallChecker/obj/Release/ROInstallChecker.dll ${{ github.workspace }}/GameData/RealismOverhaul/Plugins/ROInstallChecker.dll
+ cp -v ${{ github.workspace }}/Source/EngineGroupController/obj/Release/EngineGroupController.dll ${{ github.workspace }}/GameData/EngineGroupController/Plugins/EngineGroupController.dll
+ cp -v ${{ github.workspace }}/Source/UnityGUIFramework/obj/Release/UnityGUIFramework.dll ${{ github.workspace }}/GameData/EngineGroupController/Plugins/UnityGUIFramework.dll
- name: Remove excess DLLs
uses: KSP-RO/BuildTools/remove-excess-dlls@master
with:
- path: ${GITHUB_WORKSPACE}/GameData/
+ path: ${{ github.workspace }}/GameData/
- name: Update version file
uses: KSP-RO/BuildTools/update-version-file@master
with:
tag: ${{ github.event.release.tag_name }}
- path: ${GITHUB_WORKSPACE}/GameData/RealismOverhaul/RO.version
+ path: ${{ github.workspace }}/GameData/RealismOverhaul/RO.version
- name: Update Readme
uses: KSP-RO/BuildTools/update-version-in-readme@master
with:
- path: ${GITHUB_WORKSPACE}/README.md
+ path: ${{ github.workspace }}/README.md
tag: ${{ github.event.release.tag_name }}
- name: Update changelog file
@@ -72,7 +79,7 @@ jobs:
with:
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}
- path: ${GITHUB_WORKSPACE}/GameData/RealismOverhaul/changelog.cfg
+ path: ${{ github.workspace }}/GameData/RealismOverhaul/changelog.cfg
- name: Assemble release
id: assemble-release
@@ -82,9 +89,9 @@ jobs:
echo "Release zip: ${RELEASE_DIR}/RealismOverhaul-${{ github.event.release.tag_name }}.zip"
mkdir -v "${RELEASE_DIR}"
echo "::set-output name=release-dir::${RELEASE_DIR}"
- cp -v -R "${GITHUB_WORKSPACE}/Ships" "${RELEASE_DIR}"
- cp -v -R "${GITHUB_WORKSPACE}/GameData" "${RELEASE_DIR}"
- cp -v "${GITHUB_WORKSPACE}/README.md" "${RELEASE_DIR}/README.md"
+ cp -v -R "${{ github.workspace }}/Ships" "${RELEASE_DIR}"
+ cp -v -R "${{ github.workspace }}/GameData" "${RELEASE_DIR}"
+ cp -v "${{ github.workspace }}/README.md" "${RELEASE_DIR}/README.md"
cd ${RELEASE_DIR}
zip -r RealismOverhaul-${{ github.event.release.tag_name }}.zip GameData Ships README.md
@@ -109,9 +116,9 @@ jobs:
TAG_STRING: ${{ github.event.release.tag_name }}
run: |
RELEASEBRANCH=${{ env.tagged_branch }}
- git add "${GITHUB_WORKSPACE}/GameData/RealismOverhaul/RO.version"
- git add "${GITHUB_WORKSPACE}/README.md"
- git add "${GITHUB_WORKSPACE}/GameData/RealismOverhaul/changelog.cfg"
+ git add "${{ github.workspace }}/GameData/RealismOverhaul/RO.version"
+ git add "${{ github.workspace }}/README.md"
+ git add "${{ github.workspace }}/GameData/RealismOverhaul/changelog.cfg"
git commit -m "Update version to $TAG_STRING"
git push origin $RELEASEBRANCH
git tag $TAG_STRING $RELEASEBRANCH --force
diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml
index 9746047471..cade0cb939 100644
--- a/.github/workflows/buildAndTest.yml
+++ b/.github/workflows/buildAndTest.yml
@@ -13,6 +13,9 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
+env:
+ KSP_ROOT: /tmp/ksp
+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check-secret:
@@ -37,25 +40,29 @@ jobs:
- name: Download required assemblies
id: download-assemblies
- uses: KSP-RO/BuildTools/download-assemblies@master
+ uses: KSP-RO/BuildTools/download-assemblies-v2@master
with:
KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }}
+ dependency-identifiers: |
+ Harmony2
+ ROUtils
+ RealFuels
- name: Build mod solution
run: |
- rm -f ${GITHUB_WORKSPACE}/GameData/RealismOverhaul/Plugins/*.dll
- rm -f ${GITHUB_WORKSPACE}/GameData/EngineGroupController/Plugins/*.dll
- msbuild /restore /p:RestorePackagesConfig=true /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${GITHUB_WORKSPACE}/Source/RealismOverhaul.sln
- msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${GITHUB_WORKSPACE}/Source/KerbalPlugins.EngineGroupController.sln
- cp -v ${GITHUB_WORKSPACE}/Source/obj/Release/RealismOverhaul.dll ${GITHUB_WORKSPACE}/GameData/RealismOverhaul/Plugins/RealismOverhaul.dll
- cp -v ${GITHUB_WORKSPACE}/Source/InstallChecker/obj/Release/ROInstallChecker.dll ${GITHUB_WORKSPACE}/GameData/RealismOverhaul/Plugins/ROInstallChecker.dll
- cp -v ${GITHUB_WORKSPACE}/Source/EngineGroupController/obj/Release/EngineGroupController.dll ${GITHUB_WORKSPACE}/GameData/EngineGroupController/Plugins/EngineGroupController.dll
- cp -v ${GITHUB_WORKSPACE}/Source/UnityGUIFramework/obj/Release/UnityGUIFramework.dll ${GITHUB_WORKSPACE}/GameData/EngineGroupController/Plugins/UnityGUIFramework.dll
+ rm -f ${{ github.workspace }}/GameData/RealismOverhaul/Plugins/*.dll
+ rm -f ${{ github.workspace }}/GameData/EngineGroupController/Plugins/*.dll
+ msbuild /restore /p:RestorePackagesConfig=true /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${{ github.workspace }}/Source/RealismOverhaul.sln /p:KSPRoot="${{ env.KSP_ROOT }}"
+ msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${{ github.workspace }}/Source/KerbalPlugins.EngineGroupController.sln /p:KSPRoot="${{ env.KSP_ROOT }}"
+ cp -v ${{ github.workspace }}/Source/obj/Release/RealismOverhaul.dll ${{ github.workspace }}/GameData/RealismOverhaul/Plugins/RealismOverhaul.dll
+ cp -v ${{ github.workspace }}/Source/InstallChecker/obj/Release/ROInstallChecker.dll ${{ github.workspace }}/GameData/RealismOverhaul/Plugins/ROInstallChecker.dll
+ cp -v ${{ github.workspace }}/Source/EngineGroupController/obj/Release/EngineGroupController.dll ${{ github.workspace }}/GameData/EngineGroupController/Plugins/EngineGroupController.dll
+ cp -v ${{ github.workspace }}/Source/UnityGUIFramework/obj/Release/UnityGUIFramework.dll ${{ github.workspace }}/GameData/EngineGroupController/Plugins/UnityGUIFramework.dll
- name: Remove excess DLLs
uses: KSP-RO/BuildTools/remove-excess-dlls@master
with:
- path: ${GITHUB_WORKSPACE}/GameData/
+ path: ${{ github.workspace }}/GameData/
- name: Assemble release
id: assemble-release
@@ -64,9 +71,9 @@ jobs:
echo "Release dir: ${RELEASE_DIR}"
mkdir -v "${RELEASE_DIR}"
echo "::set-output name=release-dir::${RELEASE_DIR}"
- cp -v -R "${GITHUB_WORKSPACE}/GameData" "${RELEASE_DIR}"
- cp -v -R "${GITHUB_WORKSPACE}/Ships" "${RELEASE_DIR}"
- cp -v "${GITHUB_WORKSPACE}/README.md" "${RELEASE_DIR}"
+ cp -v -R "${{ github.workspace }}/GameData" "${RELEASE_DIR}"
+ cp -v -R "${{ github.workspace }}/Ships" "${RELEASE_DIR}"
+ cp -v "${{ github.workspace }}/README.md" "${RELEASE_DIR}"
- name: Upload artifacts
uses: actions/upload-artifact@v1
diff --git a/Source/EngineGroupController/EngineGroupController.csproj b/Source/EngineGroupController/EngineGroupController.csproj
index 341b3313b6..d32ef005bd 100644
--- a/Source/EngineGroupController/EngineGroupController.csproj
+++ b/Source/EngineGroupController/EngineGroupController.csproj
@@ -31,33 +31,57 @@
prompt
4
+
+
+ $(ReferencePath.TrimEnd([System.IO.Path]::DirectorySeparatorChar))
+
-
- d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\Assembly-CSharp.dll
+
+ $(ReferencePath)/Assembly-CSharp.dll
+ False
+
+
+ $(ReferencePath)/Assembly-CSharp-firstpass.dll
+ False
+
+
+ $(ReferencePath)/System.dll
+ False
+
+
+ $(ReferencePath)/System.Core.dll
+ False
+
+
+ $(ReferencePath)/System.Xml.Linq.dll
+ False
+
+
+ $(ReferencePath)/System.Data.DataSetExtensions.dll
+ False
+
+
+ $(ReferencePath)/System.Data.dll
False
-
- d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\Assembly-CSharp-firstpass.dll
+
+ $(ReferencePath)/System.Xml.dll
False
-
-
-
-
-
-
-
- d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\UnityEngine.dll
+
+ $(ReferencePath)/UnityEngine.dll
False
-
+
+ $(ReferencePath)/UnityEngine.AnimationModule.dll
False
-
+
+ $(ReferencePath)/UnityEngine.CoreModule.dll
False
-
- d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\UnityEngine.UI.dll
+
+ $(ReferencePath)/UnityEngine.UI.dll
False
diff --git a/Source/InstallChecker/ROInstallChecker.csproj b/Source/InstallChecker/ROInstallChecker.csproj
index d9404c5f7b..88e0d14155 100644
--- a/Source/InstallChecker/ROInstallChecker.csproj
+++ b/Source/InstallChecker/ROInstallChecker.csproj
@@ -33,12 +33,21 @@
4
x64
+
+
+ $(ReferencePath.TrimEnd([System.IO.Path]::DirectorySeparatorChar))
+
-
+
+ $(ReferencePath)/Assembly-CSharp.dll
+ False
+
+
+ $(ReferencePath)/System.dll
False
-
-
+
+ $(ReferencePath)/UnityEngine.CoreModule.dll
False
diff --git a/Source/RealismOverhaul.csproj b/Source/RealismOverhaul.csproj
index 7b92148c9d..04c579e534 100644
--- a/Source/RealismOverhaul.csproj
+++ b/Source/RealismOverhaul.csproj
@@ -33,6 +33,10 @@
4
false
+
+
+ $(ReferencePath.TrimEnd([System.IO.Path]::DirectorySeparatorChar))
+
@@ -74,38 +78,44 @@
-
- False
+
+ $(ReferencePath)/0Harmony.dll
False
-
+
+ $(ReferencePath)/Assembly-CSharp.dll
False
-
- ..\..\..\..\..\..\Games\R112\GameData\ROUtils\Plugins\ROUtils.dll
+
+ $(ReferencePath)/ROUtils.dll
False
-
+
+ $(ReferencePath)/System.dll
False
-
+
+ $(ReferencePath)/UnityEngine.dll
False
-
+
+ $(ReferencePath)/UnityEngine.CoreModule.dll
False
-
- False
+
+ $(ReferencePath)/UnityEngine.PhysicsModule.dll
False
-
+
+ $(ReferencePath)/UnityEngine.UI.dll
False
-
+
+ $(ReferencePath)/RealFuels.dll
False
-
- False
+
+ $(ReferencePath)/UnityEngine.UIModule.dll
False
diff --git a/Source/UnityGUIFramework/UnityGUIFramework.csproj b/Source/UnityGUIFramework/UnityGUIFramework.csproj
index d3145e0958..1623e48173 100644
--- a/Source/UnityGUIFramework/UnityGUIFramework.csproj
+++ b/Source/UnityGUIFramework/UnityGUIFramework.csproj
@@ -30,36 +30,61 @@
prompt
4
+
+
+ $(ReferencePath.TrimEnd([System.IO.Path]::DirectorySeparatorChar))
+
-
- False
- d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\Assembly-CSharp.dll
+
+ $(ReferencePath)/Assembly-CSharp.dll
+ False
+
+
+ $(ReferencePath)/System.dll
+ False
+
+
+ $(ReferencePath)/System.Core.dll
+ False
+
+
+ $(ReferencePath)/System.Xml.Linq.dll
+ False
+
+
+ $(ReferencePath)/System.Data.DataSetExtensions.dll
+ False
+
+
+ $(ReferencePath)/System.Data.dll
+ False
+
+
+ $(ReferencePath)/System.Xml.dll
False
-
-
-
-
-
-
-
- False
- d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\UnityEngine.dll
+
+ $(ReferencePath)/UnityEngine.dll
False
-
+
+ $(ReferencePath)/UnityEngine.CoreModule.dll
False
-
+
+ $(ReferencePath)/UnityEngine.ImageConversionModule.dll
False
-
+
+ $(ReferencePath)/UnityEngine.IMGUIModule.dll
False
-
+
+ $(ReferencePath)/UnityEngine.TextRenderingModule.dll
False
-
+
+ $(ReferencePath)/UnityEngine.UnityWebRequestWWWModule.dll
False