diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70bf4307..b982324d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -410,6 +410,18 @@ jobs: dotnet build "${{ env.UI_PROJECT }}" -c ${{ env.BUILD_CONFIGURATION }} $BUILD_PROPS dotnet build "${{ env.MACOS_PROJECT }}" -c ${{ env.BUILD_CONFIGURATION }} $BUILD_PROPS + # Runs the macOS composition root before publish. "Run Tests" at the end of this job + # already covered this project, but it sits after Publish and Smoke Test App Launch — + # so an unresolvable service killed the job at the smoke test, as a status-134 crash + # after packaging, and the assertion that names the service never executed. Running it + # here fails in seconds with the service name. A missing platform registration is + # invisible to per-branch CI, appearing only once both halves are merged, so this is + # the earliest point it can surface. + - name: Run macOS Tests + run: | + dotnet test GenHub/GenHub.Tests/GenHub.Tests.MacOS/GenHub.Tests.MacOS.csproj \ + -c ${{ env.BUILD_CONFIGURATION }} --verbosity normal + - name: Publish macOS App run: | BUILD_PROPS="-p:Version=${{ steps.buildinfo.outputs.VERSION }} -p:GitShortHash=${{ steps.buildinfo.outputs.SHORT_HASH }} -p:PullRequestNumber=${{ steps.buildinfo.outputs.PR_NUMBER }} -p:BuildChannel=${{ steps.buildinfo.outputs.CHANNEL }}" @@ -484,7 +496,9 @@ jobs: shell: bash run: | while IFS= read -r test_project; do - [[ "$test_project" == *Windows* || "$test_project" == *Linux* ]] && continue + # MacOS is covered by "Run macOS Tests" before publish, so it is skipped + # here rather than run a second time. + [[ "$test_project" == *Windows* || "$test_project" == *Linux* || "$test_project" == *MacOS* ]] && continue echo "Testing $test_project" dotnet test "$test_project" -c ${{ env.BUILD_CONFIGURATION }} --verbosity normal done < <(find GenHub/GenHub.Tests -type f -name '*.csproj' | sort) diff --git a/GenHub/GenHub.MacOS/Infrastructure/DependencyInjection/MacOSServicesModule.cs b/GenHub/GenHub.MacOS/Infrastructure/DependencyInjection/MacOSServicesModule.cs index ac9db992..4b761b29 100644 --- a/GenHub/GenHub.MacOS/Infrastructure/DependencyInjection/MacOSServicesModule.cs +++ b/GenHub/GenHub.MacOS/Infrastructure/DependencyInjection/MacOSServicesModule.cs @@ -1,11 +1,17 @@ -using System.Runtime.Versioning; using GenHub.Core.Interfaces.GameInstallations; +using GenHub.Core.Interfaces.GameSettings; using GenHub.Core.Interfaces.Shortcuts; +using GenHub.Core.Interfaces.Storage; +using GenHub.Core.Interfaces.Workspace; using GenHub.Features.AppUpdate.Interfaces; using GenHub.Features.AppUpdate.Services; +using GenHub.Features.GameSettings; +using GenHub.Features.Workspace; using GenHub.MacOS.Features.Shortcuts; using GenHub.MacOS.GameInstallations; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using System.Runtime.Versioning; namespace GenHub.MacOS.Infrastructure.DependencyInjection; @@ -23,8 +29,21 @@ public static class MacOSServicesModule public static IServiceCollection AddMacOSServices(this IServiceCollection services) { services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); + // Real hard links via link(2). Without this the base implementation throws, which + // is deliberate: silently copying made a missing registration invisible while + // every workspace consumed a full copy of the game. + services.AddScoped(serviceProvider => + { + var baseService = serviceProvider.GetRequiredService(); + var casService = serviceProvider.GetRequiredService(); + var logger = serviceProvider.GetRequiredService>(); + return new UnixFileOperationsService(baseService, casService, logger); + }); + // Disables self-update on macOS, which publishes no update artifacts. // AppServices.ConfigureApplicationServices invokes the platform module after // AddAppUpdateModule, so this registration supersedes VelopackUpdateManager. diff --git a/GenHub/GenHub.Tests/Shared/CompositionRootAssertions.cs b/GenHub/GenHub.Tests/Shared/CompositionRootAssertions.cs index 0d647112..7e446415 100644 --- a/GenHub/GenHub.Tests/Shared/CompositionRootAssertions.cs +++ b/GenHub/GenHub.Tests/Shared/CompositionRootAssertions.cs @@ -4,6 +4,7 @@ using GenHub.Common.ViewModels; using GenHub.Core.Interfaces.Common; using GenHub.Core.Interfaces.GameInstallations; +using GenHub.Core.Interfaces.GameSettings; using GenHub.Core.Interfaces.Shortcuts; using GenHub.Core.Interfaces.Workspace; using GenHub.Features.AppUpdate.Interfaces; @@ -43,7 +44,9 @@ public static class CompositionRootAssertions [ typeof(IConfigurationProviderService), typeof(IFileOperationsService), + typeof(IGamePathProvider), typeof(IShortcutService), + typeof(ISymlinkCapabilityProvider), typeof(IVelopackUpdateManager), ];