From e30fbf56138e704c478ea4b5d8fb552df5e99b91 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Mon, 14 Apr 2025 22:14:06 +0200 Subject: [PATCH] Renamed `build-only` to `compile-only`. More flexible setup for compile-only runs. --- .github/workflows/build-packages.yml | 2 +- ReleaseBuilder/Build/Command.RuntimeConfig.cs | 8 +++++ ReleaseBuilder/Build/Command.cs | 35 +++++++++++-------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml index 669534145..c1e452cef 100644 --- a/.github/workflows/build-packages.yml +++ b/.github/workflows/build-packages.yml @@ -22,7 +22,7 @@ jobs: - name: Compile releases working-directory: ./ReleaseBuilder - run: dotnet run -- build debug --build-only=true --git-stash-push=false --disable-docker-push=true --keep-builds=true --disable-authenticode=true --disable-signcode=true --disable-notarize-signing=true --disable-gpg-signing=true --disable-s3-upload=true --disable-github-upload=true --disable-update-server-reload=true --disable-discourse-announce=true --disable-clean-source=true --password=test1234 --version=2.0.0.99 + run: dotnet run -- build debug --compile-only=true --git-stash-push=false --disable-docker-push=true --keep-builds=true --disable-authenticode=true --disable-signcode=true --disable-notarize-signing=true --disable-gpg-signing=true --disable-s3-upload=true --disable-github-upload=true --disable-update-server-reload=true --disable-discourse-announce=true --disable-clean-source=true --password=test1234 --version=2.0.0.99 # Disabled, as a new test needs to be written for the new UI # selenium: diff --git a/ReleaseBuilder/Build/Command.RuntimeConfig.cs b/ReleaseBuilder/Build/Command.RuntimeConfig.cs index b78a40504..97f556936 100644 --- a/ReleaseBuilder/Build/Command.RuntimeConfig.cs +++ b/ReleaseBuilder/Build/Command.RuntimeConfig.cs @@ -211,6 +211,14 @@ public static partial class Command } } + /// + /// Disables docker builds + /// + public void DisableDockerBuilds() + { + _dockerBuild = false; + } + /// /// Cache value for checking if notarize is enabled /// diff --git a/ReleaseBuilder/Build/Command.cs b/ReleaseBuilder/Build/Command.cs index 6d2a3cb35..d9ee5c90e 100644 --- a/ReleaseBuilder/Build/Command.cs +++ b/ReleaseBuilder/Build/Command.cs @@ -191,8 +191,8 @@ public static partial class Command getDefaultValue: () => false ); - var buildOnlyOption = new Option( - name: "--build-only", + var compileOnlyOption = new Option( + name: "--compile-only", description: "Only build the binaries, do not create packages", getDefaultValue: () => false ); @@ -332,7 +332,7 @@ public static partial class Command buildTargetOption, solutionFileOption, keepBuildsOption, - buildOnlyOption, + compileOnlyOption, disableAuthenticodeOption, disableCodeSignOption, passwordOption, @@ -369,7 +369,7 @@ public static partial class Command /// The release channel /// The version override to use /// If the builds should be kept - /// If only the build should be performed + /// If only the build should be performed /// If authenticode signing should be disabled /// If signcode should be disabled /// The password to use for the keyfile @@ -397,7 +397,7 @@ public static partial class Command ReleaseChannel Channel, string? Version, bool KeepBuilds, - bool BuildOnly, + bool CompileOnly, bool DisableAuthenticode, bool DisableSignCode, string Password, @@ -433,7 +433,7 @@ public static partial class Command throw new FileNotFoundException($"Solution file not found: {input.SolutionFile.FullName}"); // This could be fixed, so we will throw an exception if the build is not possible - if (buildTargets.Any(x => x.Package == PackageType.MSI) && !configuration.IsMSIBuildPossible()) + if (buildTargets.Any(x => x.Package == PackageType.MSI) && !configuration.IsMSIBuildPossible() && !input.CompileOnly) throw new Exception("WiX toolset not configured, cannot build MSI files"); // This will be fixed in the future, but requires a new http-interface for Synology DSM @@ -441,7 +441,7 @@ public static partial class Command throw new Exception("Synology SPK files are currently not supported"); // This will not work, so to make it easier for non-MacOS developers, we will remove the MacOS packages - if (buildTargets.Any(x => x.Package == PackageType.MacPkg || x.Package == PackageType.DMG) && !configuration.IsMacPkgBuildPossible()) + if (buildTargets.Any(x => x.Package == PackageType.MacPkg || x.Package == PackageType.DMG) && !configuration.IsMacPkgBuildPossible() && !input.CompileOnly) { Console.WriteLine("MacOS packages requested but not running on MacOS, removing from build targets"); buildTargets = buildTargets.Where(x => x.Package != PackageType.MacPkg && x.Package != PackageType.DMG).ToArray(); @@ -532,13 +532,20 @@ public static partial class Command rtcfg.ToggleGithubUpload(rtcfg.ReleaseInfo.Channel); rtcfg.ToogleDiscourseAnnounce(rtcfg.ReleaseInfo.Channel); rtcfg.ToggleUpdateServerReload(); - await rtcfg.ToggleDockerBuild(); - - if (!rtcfg.UseDockerBuild) + if (input.CompileOnly) { - var unsupportedBuilds = buildTargets.Where(x => x.Package == PackageType.Docker || x.Package == PackageType.Deb || x.Package == PackageType.RPM).ToList(); - if (unsupportedBuilds.Any()) - throw new Exception($"The following packages cannot be built without Docker: {string.Join(", ", unsupportedBuilds.Select(x => x.PackageTargetString))}"); + rtcfg.DisableDockerBuilds(); + } + else + { + await rtcfg.ToggleDockerBuild(); + + if (!rtcfg.UseDockerBuild) + { + var unsupportedBuilds = buildTargets.Where(x => x.Package == PackageType.Docker || x.Package == PackageType.Deb || x.Package == PackageType.RPM).ToList(); + if (unsupportedBuilds.Any()) + throw new Exception($"The following packages cannot be built without Docker: {string.Join(", ", unsupportedBuilds.Select(x => x.PackageTargetString))}"); + } } // Prevent the system from going to sleep during the build @@ -588,7 +595,7 @@ public static partial class Command await Compile.BuildProjects(baseDir, input.BuildPath.FullName, sourceBuildMap, windowsOnly, buildTargets, releaseInfo, input.KeepBuilds, rtcfg, input.UseHostedBuilds, input.DisableCleanSource, input.AllowAssemblyMismatch); - if (input.BuildOnly) + if (input.CompileOnly) { Console.WriteLine("Build completed, skipping package creation ..."); return;