Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 37 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,37 @@ env:
RESONITE_INSTALL_DIR: ${{ github.workspace }}/.resonite

jobs:
formatting:
runs-on: ubuntu-latest
env:
ResoniteAssembliesDir: ${{ github.workspace }}/.resonite
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x

- name: Prepare fallback references
shell: bash
run: |
set -euo pipefail
mkdir -p "$ResoniteAssembliesDir/Libraries" "$ResoniteAssembliesDir/rml_libs"
curl -sSfL -o "$ResoniteAssembliesDir/Libraries/ResoniteModLoader.dll" \
https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/ResoniteModLoader.dll
curl -sSfL -o "$ResoniteAssembliesDir/rml_libs/0Harmony.dll" \
https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/0Harmony.dll

- name: Verify formatting
run: dotnet format WhileLoopTimeout.sln --verify-no-changes
Comment thread
esnya marked this conversation as resolved.

build:
if: github.event_name != 'pull_request'
needs: formatting
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -43,7 +73,6 @@ jobs:
fi

- name: Setup Resonite environment
id: resonite
uses: resonite-modding-group/setup-resonite-env-action@v0.1.0
with:
steam-user: ${{ secrets.STEAMUSER }}
Expand All @@ -56,10 +85,6 @@ jobs:
shell: bash
run: |
set -euo pipefail
if [ -z "${RESONITE_PATH:-}" ]; then
echo '::error::Resonite path is empty. Ensure the setup-resonite-env step succeeded and exposed resonite-path.'
exit 1
fi
install -d "$RESONITE_PATH/Libraries" "$RESONITE_PATH/rml_libs"
curl -sSfL -o "$RESONITE_PATH/Libraries/ResoniteModLoader.dll" \
https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/ResoniteModLoader.dll
Expand All @@ -69,7 +94,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x

- name: Cache NuGet packages
uses: actions/cache@v4
Expand All @@ -83,29 +108,19 @@ jobs:
env:
ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }}
shell: bash
run: |
dotnet restore WhileLoopTimeout.sln

- name: Verify formatting
env:
ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }}
shell: bash
run: |
dotnet format WhileLoopTimeout.sln --verify-no-changes --no-restore
run: dotnet restore WhileLoopTimeout.sln

- name: Build
env:
ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }}
shell: bash
run: |
dotnet build WhileLoopTimeout.sln --configuration Release --no-restore
run: dotnet build WhileLoopTimeout.sln --configuration Release --no-restore

- name: Test
env:
ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }}
shell: bash
run: |
dotnet test WhileLoopTimeout.sln --configuration Release --no-build
run: dotnet test WhileLoopTimeout.sln --configuration Release --no-build

- name: Prepare release assets
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
Expand All @@ -114,9 +129,9 @@ jobs:
set -euo pipefail
artifacts_dir=release-artifacts
mkdir -p "$artifacts_dir"
cp src/WhileLoopTimeout/bin/Release/net9.0/WhileLoopTimeout.dll "$artifacts_dir/WhileLoopTimeout.dll"
if [ -f src/WhileLoopTimeout/bin/Release/net9.0/WhileLoopTimeout.pdb ]; then
cp src/WhileLoopTimeout/bin/Release/net9.0/WhileLoopTimeout.pdb "$artifacts_dir/WhileLoopTimeout.pdb"
cp src/WhileLoopTimeout/bin/Release/net10.0/WhileLoopTimeout.dll "$artifacts_dir/WhileLoopTimeout.dll"
if [ -f src/WhileLoopTimeout/bin/Release/net10.0/WhileLoopTimeout.pdb ]; then
cp src/WhileLoopTimeout/bin/Release/net10.0/WhileLoopTimeout.pdb "$artifacts_dir/WhileLoopTimeout.pdb"
fi

- name: Upload release artifacts
Expand Down Expand Up @@ -158,8 +173,6 @@ jobs:
with:
tag_name: ${{ steps.tag.outputs.tag_name }}
name: While Loop Timeout ${{ steps.tag.outputs.tag_name }}
# When triggered by release event, this updates the existing release
# When triggered by tag push, this creates a new release
generate_release_notes: ${{ github.event_name != 'release' }}
files: |
release-artifacts/WhileLoopTimeout.dll
Expand Down
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@
<PropertyGroup Condition="'$(ResoniteAssembliesDir)'!=''">
<ResolvedResoniteAssembliesDir>$([System.IO.Path]::GetFullPath('$(ResoniteAssembliesDir)'))</ResolvedResoniteAssembliesDir>
</PropertyGroup>

<PropertyGroup>
<FrooxEnginePresent Condition="Exists('$(ResolvedResoniteAssembliesDir)/FrooxEngine.dll')">true</FrooxEnginePresent>
<FrooxEnginePresent Condition="'$(FrooxEnginePresent)'==''">false</FrooxEnginePresent>
</PropertyGroup>
</Project>
3 changes: 2 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project>
<Target Name="EnsureResoniteAssembliesDir" BeforeTargets="ResolveReferences">
<Error Condition="'$(ResoniteAssembliesDir)'==''" Text="ResoniteAssembliesDir must be set (or install Resonite under ./Resonite, the default Steam Windows path, or ~/.steam/steam/steamapps/common/Resonite/ for auto-detection)." />
<Error Condition="!Exists('$(ResolvedResoniteAssembliesDir)/FrooxEngine.dll')" Text="Cannot find FrooxEngine.dll under $(ResolvedResoniteAssembliesDir)." />
<Error Condition="'$(FrooxEnginePresent)'!='true' and !Exists('$(ResolvedResoniteAssembliesDir)/Libraries/ResoniteModLoader.dll')" Text="Cannot find ResoniteModLoader.dll under $(ResolvedResoniteAssembliesDir)/Libraries." />
<Error Condition="'$(FrooxEnginePresent)'!='true' and !Exists('$(ResolvedResoniteAssembliesDir)/rml_libs/0Harmony.dll')" Text="Cannot find 0Harmony.dll under $(ResolvedResoniteAssembliesDir)/rml_libs." />
</Target>
</Project>
16 changes: 14 additions & 2 deletions src/WhileLoopTimeout/WhileLoopTimeout.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>12.0</LangVersion>
Expand All @@ -17,7 +17,7 @@
<DefineConstants>$(DefineConstants);USE_RESONITE_HOT_RELOAD_LIB</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="'$(FrooxEnginePresent)'=='true'">
<Reference Include="ResoniteModLoader">
<HintPath>$(ResolvedResoniteAssembliesDir)/Libraries/ResoniteModLoader.dll</HintPath>
<Private>false</Private>
Expand Down Expand Up @@ -56,6 +56,18 @@
</Reference>
</ItemGroup>

<ItemGroup Condition="'$(FrooxEnginePresent)'!='true'">
<PackageReference Include="Resonite.GameLibs" Version="2026.4.16.1327" />
<Reference Include="ResoniteModLoader">
<HintPath>$(ResolvedResoniteAssembliesDir)/Libraries/ResoniteModLoader.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="HarmonyLib">
<HintPath>$(ResolvedResoniteAssembliesDir)/rml_libs/0Harmony.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0" PrivateAssets="all" />
</ItemGroup>
Expand Down
17 changes: 15 additions & 2 deletions tests/WhileLoopTimeout.Tests/WhileLoopTimeout.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>WhileLoopTimeout.Tests</RootNamespace>
<IsPackable>false</IsPackable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NoWarn>$(NoWarn);CA1515;CA1707</NoWarn>
</PropertyGroup>

Expand All @@ -24,7 +25,7 @@
<Using Include="Xunit" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition="'$(FrooxEnginePresent)'=='true'">
<Reference Include="FrooxEngine">
<HintPath>$(ResoniteAssembliesDir)/FrooxEngine.dll</HintPath>
<Private>true</Private>
Expand Down Expand Up @@ -59,4 +60,16 @@
</Reference>
</ItemGroup>

<ItemGroup Condition="'$(FrooxEnginePresent)'!='true'">
<PackageReference Include="Resonite.GameLibs" Version="2026.4.16.1327" />
<Reference Include="ResoniteModLoader">
<HintPath>$(ResoniteAssembliesDir)/Libraries/ResoniteModLoader.dll</HintPath>
<Private>true</Private>
</Reference>
<Reference Include="HarmonyLib">
<HintPath>$(ResoniteAssembliesDir)/rml_libs/0Harmony.dll</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>

</Project>
Loading