Skip to content

Commit

Permalink
CI using CKAN (#2979)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
StonesmileGit authored Aug 11, 2024
1 parent f5b1324 commit e925f28
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 81 deletions.
43 changes: 25 additions & 18 deletions .github/workflows/attachReleaseArtifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -28,51 +31,55 @@ 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
shell: bash
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
uses: KSP-RO/BuildTools/process-changelog@master
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
Expand All @@ -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
Expand All @@ -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
Expand Down
33 changes: 20 additions & 13 deletions .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down
56 changes: 40 additions & 16 deletions Source/EngineGroupController/EngineGroupController.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,57 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<KSPRoot Condition=" '$(KSPRoot)' == '' ">
$(ReferencePath.TrimEnd([System.IO.Path]::DirectorySeparatorChar))</KSPRoot>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/Assembly-CSharp.dll">
<HintPath>$(ReferencePath)/Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/Assembly-CSharp-firstpass.dll">
<HintPath>$(ReferencePath)/Assembly-CSharp-firstpass.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/System.dll">
<HintPath>$(ReferencePath)/System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/System.Core.dll">
<HintPath>$(ReferencePath)/System.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/System.Xml.Linq.dll">
<HintPath>$(ReferencePath)/System.Xml.Linq.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/System.Data.DataSetExtensions.dll">
<HintPath>$(ReferencePath)/System.Data.DataSetExtensions.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/System.Data.dll">
<HintPath>$(ReferencePath)/System.Data.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/System.Xml.dll">
<HintPath>$(ReferencePath)/System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\UnityEngine.dll</HintPath>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.dll">
<HintPath>$(ReferencePath)/UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AnimationModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.AnimationModule.dll">
<HintPath>$(ReferencePath)/UnityEngine.AnimationModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.CoreModule.dll">
<HintPath>$(ReferencePath)/UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>d:\Games\Kerbal_1.0.4_RSS\KSP_Data\Managed\UnityEngine.UI.dll</HintPath>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.UI.dll">
<HintPath>$(ReferencePath)/UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand Down
15 changes: 12 additions & 3 deletions Source/InstallChecker/ROInstallChecker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<KSPRoot Condition=" '$(KSPRoot)' == '' ">
$(ReferencePath.TrimEnd([System.IO.Path]::DirectorySeparatorChar))</KSPRoot>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/Assembly-CSharp.dll">
<HintPath>$(ReferencePath)/Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/System.dll">
<HintPath>$(ReferencePath)/System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="UnityEngine.CoreModule">
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.CoreModule.dll">
<HintPath>$(ReferencePath)/UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand Down
38 changes: 24 additions & 14 deletions Source/RealismOverhaul.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<KSPRoot Condition=" '$(KSPRoot)' == '' ">
$(ReferencePath.TrimEnd([System.IO.Path]::DirectorySeparatorChar))</KSPRoot>
</PropertyGroup>
<ItemGroup>
<Compile Include="AdjustableCoMShifter.cs" />
<Compile Include="DebugTools\DebugDrawer.cs" />
Expand Down Expand Up @@ -74,38 +78,44 @@
<Compile Include="DynamicPartHider\PartUpgradeFiltering.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="$(KSPRoot)/GameData/000_Harmony/0Harmony.dll">
<HintPath>$(ReferencePath)/0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/Assembly-CSharp.dll">
<HintPath>$(ReferencePath)/Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ROUtils">
<HintPath>..\..\..\..\..\..\Games\R112\GameData\ROUtils\Plugins\ROUtils.dll</HintPath>
<Reference Include="$(KSPRoot)/GameData/ROUtils/Plugins/ROUtils.dll">
<HintPath>$(ReferencePath)/ROUtils.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System">
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/System.dll">
<HintPath>$(ReferencePath)/System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine">
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.dll">
<HintPath>$(ReferencePath)/UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.CoreModule.dll">
<HintPath>$(ReferencePath)/UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.PhysicsModule.dll">
<HintPath>$(ReferencePath)/UnityEngine.PhysicsModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.UI.dll">
<HintPath>$(ReferencePath)/UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RealFuels">
<Reference Include="$(KSPRoot)/GameData/RealFuels/Plugins/RealFuels.dll">
<HintPath>$(ReferencePath)/RealFuels.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="$(KSPRoot)/KSP_x64_Data/Managed/UnityEngine.UIModule.dll">
<HintPath>$(ReferencePath)/UnityEngine.UIModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand Down
Loading

0 comments on commit e925f28

Please sign in to comment.