diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2fd60937e41..38517d74ddd 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "features": { "ghcr.io/devcontainers/features/docker-in-docker:1": {}, "ghcr.io/devcontainers/features/dotnet": { - "version": "8.0.418" + "version": "10.0.103" }, "ghcr.io/devcontainers/features/node:1": { "version": "20" @@ -18,6 +18,7 @@ "extensions": [ "ms-azuretools.vscode-docker", "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", "eamodio.gitlens" ] } diff --git a/src/ActionsRunner.sln b/src/ActionsRunner.sln index fa0bfe0ed47..6e2dcdd22be 100644 --- a/src/ActionsRunner.sln +++ b/src/ActionsRunner.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29411.138 @@ -26,48 +26,138 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Runner.Sdk.Generator", "Runner.Sdk.Generator\Runner.Sdk.Generator.csproj", "{F78EAE57-001E-4B93-BD2E-5AE16D1A1524}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Debug|x64.ActiveCfg = Debug|Any CPU + {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Debug|x64.Build.0 = Debug|Any CPU + {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Debug|x86.ActiveCfg = Debug|Any CPU + {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Debug|x86.Build.0 = Debug|Any CPU {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Release|Any CPU.ActiveCfg = Release|Any CPU {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Release|Any CPU.Build.0 = Release|Any CPU + {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Release|x64.ActiveCfg = Release|Any CPU + {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Release|x64.Build.0 = Release|Any CPU + {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Release|x86.ActiveCfg = Release|Any CPU + {084289A3-CD7A-42E0-9219-4348B4B7E19B}.Release|x86.Build.0 = Release|Any CPU {7D461AEE-BF2A-4855-BD96-56921160B36A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7D461AEE-BF2A-4855-BD96-56921160B36A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7D461AEE-BF2A-4855-BD96-56921160B36A}.Debug|x64.ActiveCfg = Debug|Any CPU + {7D461AEE-BF2A-4855-BD96-56921160B36A}.Debug|x64.Build.0 = Debug|Any CPU + {7D461AEE-BF2A-4855-BD96-56921160B36A}.Debug|x86.ActiveCfg = Debug|Any CPU + {7D461AEE-BF2A-4855-BD96-56921160B36A}.Debug|x86.Build.0 = Debug|Any CPU {7D461AEE-BF2A-4855-BD96-56921160B36A}.Release|Any CPU.ActiveCfg = Release|Any CPU {7D461AEE-BF2A-4855-BD96-56921160B36A}.Release|Any CPU.Build.0 = Release|Any CPU + {7D461AEE-BF2A-4855-BD96-56921160B36A}.Release|x64.ActiveCfg = Release|Any CPU + {7D461AEE-BF2A-4855-BD96-56921160B36A}.Release|x64.Build.0 = Release|Any CPU + {7D461AEE-BF2A-4855-BD96-56921160B36A}.Release|x86.ActiveCfg = Release|Any CPU + {7D461AEE-BF2A-4855-BD96-56921160B36A}.Release|x86.Build.0 = Release|Any CPU {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Debug|x64.ActiveCfg = Debug|Any CPU + {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Debug|x64.Build.0 = Debug|Any CPU + {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Debug|x86.ActiveCfg = Debug|Any CPU + {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Debug|x86.Build.0 = Debug|Any CPU {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Release|Any CPU.Build.0 = Release|Any CPU + {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Release|x64.ActiveCfg = Release|Any CPU + {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Release|x64.Build.0 = Release|Any CPU + {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Release|x86.ActiveCfg = Release|Any CPU + {D0320EB1-CB6D-4179-BFDC-2F2B664A370C}.Release|x86.Build.0 = Release|Any CPU {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Debug|x64.ActiveCfg = Debug|Any CPU + {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Debug|x64.Build.0 = Debug|Any CPU + {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Debug|x86.ActiveCfg = Debug|Any CPU + {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Debug|x86.Build.0 = Debug|Any CPU {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Release|Any CPU.ActiveCfg = Release|Any CPU {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Release|Any CPU.Build.0 = Release|Any CPU + {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Release|x64.ActiveCfg = Release|Any CPU + {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Release|x64.Build.0 = Release|Any CPU + {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Release|x86.ActiveCfg = Release|Any CPU + {C23AFD6F-4DCD-4243-BC61-865BE31B9168}.Release|x86.Build.0 = Release|Any CPU {D0484633-DA97-4C34-8E47-1DADE212A57A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D0484633-DA97-4C34-8E47-1DADE212A57A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0484633-DA97-4C34-8E47-1DADE212A57A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D0484633-DA97-4C34-8E47-1DADE212A57A}.Debug|x64.Build.0 = Debug|Any CPU + {D0484633-DA97-4C34-8E47-1DADE212A57A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D0484633-DA97-4C34-8E47-1DADE212A57A}.Debug|x86.Build.0 = Debug|Any CPU {D0484633-DA97-4C34-8E47-1DADE212A57A}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0484633-DA97-4C34-8E47-1DADE212A57A}.Release|Any CPU.Build.0 = Release|Any CPU + {D0484633-DA97-4C34-8E47-1DADE212A57A}.Release|x64.ActiveCfg = Release|Any CPU + {D0484633-DA97-4C34-8E47-1DADE212A57A}.Release|x64.Build.0 = Release|Any CPU + {D0484633-DA97-4C34-8E47-1DADE212A57A}.Release|x86.ActiveCfg = Release|Any CPU + {D0484633-DA97-4C34-8E47-1DADE212A57A}.Release|x86.Build.0 = Release|Any CPU {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Debug|x64.ActiveCfg = Debug|Any CPU + {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Debug|x64.Build.0 = Debug|Any CPU + {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Debug|x86.ActiveCfg = Debug|Any CPU + {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Debug|x86.Build.0 = Debug|Any CPU {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Release|Any CPU.ActiveCfg = Release|Any CPU {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Release|Any CPU.Build.0 = Release|Any CPU + {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Release|x64.ActiveCfg = Release|Any CPU + {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Release|x64.Build.0 = Release|Any CPU + {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Release|x86.ActiveCfg = Release|Any CPU + {D12EBD71-0464-46D0-8394-40BCFBA0A6F2}.Release|x86.Build.0 = Release|Any CPU {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Debug|x64.ActiveCfg = Debug|Any CPU + {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Debug|x64.Build.0 = Debug|Any CPU + {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Debug|x86.ActiveCfg = Debug|Any CPU + {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Debug|x86.Build.0 = Debug|Any CPU {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Release|Any CPU.ActiveCfg = Release|Any CPU {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Release|Any CPU.Build.0 = Release|Any CPU + {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Release|x64.ActiveCfg = Release|Any CPU + {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Release|x64.Build.0 = Release|Any CPU + {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Release|x86.ActiveCfg = Release|Any CPU + {C2F5B9FA-2621-411F-8EB2-273ED276F503}.Release|x86.Build.0 = Release|Any CPU {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Debug|x64.ActiveCfg = Debug|Any CPU + {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Debug|x64.Build.0 = Debug|Any CPU + {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Debug|x86.ActiveCfg = Debug|Any CPU + {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Debug|x86.Build.0 = Debug|Any CPU {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Release|Any CPU.ActiveCfg = Release|Any CPU {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Release|Any CPU.Build.0 = Release|Any CPU + {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Release|x64.ActiveCfg = Release|Any CPU + {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Release|x64.Build.0 = Release|Any CPU + {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Release|x86.ActiveCfg = Release|Any CPU + {D2EE812B-E4DF-49BB-AE87-12BC49949B5F}.Release|x86.Build.0 = Release|Any CPU {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Debug|x64.ActiveCfg = Debug|Any CPU + {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Debug|x64.Build.0 = Debug|Any CPU + {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Debug|x86.ActiveCfg = Debug|Any CPU + {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Debug|x86.Build.0 = Debug|Any CPU {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Release|Any CPU.ActiveCfg = Release|Any CPU {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Release|Any CPU.Build.0 = Release|Any CPU + {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Release|x64.ActiveCfg = Release|Any CPU + {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Release|x64.Build.0 = Release|Any CPU + {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Release|x86.ActiveCfg = Release|Any CPU + {C932061F-F6A1-4F1E-B854-A6C6B30DC3EF}.Release|x86.Build.0 = Release|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Debug|x64.ActiveCfg = Debug|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Debug|x64.Build.0 = Debug|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Debug|x86.ActiveCfg = Debug|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Debug|x86.Build.0 = Debug|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Release|Any CPU.Build.0 = Release|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Release|x64.ActiveCfg = Release|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Release|x64.Build.0 = Release|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Release|x86.ActiveCfg = Release|Any CPU + {F78EAE57-001E-4B93-BD2E-5AE16D1A1524}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Runner.Common/Runner.Common.csproj b/src/Runner.Common/Runner.Common.csproj index 6c4635626a2..3293b3c60c5 100644 --- a/src/Runner.Common/Runner.Common.csproj +++ b/src/Runner.Common/Runner.Common.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 Library win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 true @@ -15,11 +15,8 @@ - - - diff --git a/src/Runner.Listener/Runner.Listener.csproj b/src/Runner.Listener/Runner.Listener.csproj index 68df8fbbc67..ad38dbed04b 100644 --- a/src/Runner.Listener/Runner.Listener.csproj +++ b/src/Runner.Listener/Runner.Listener.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 Exe win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 true @@ -19,7 +19,6 @@ - diff --git a/src/Runner.PluginHost/Runner.PluginHost.csproj b/src/Runner.PluginHost/Runner.PluginHost.csproj index 81a8d2e4304..42de533dea4 100644 --- a/src/Runner.PluginHost/Runner.PluginHost.csproj +++ b/src/Runner.PluginHost/Runner.PluginHost.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 Exe win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 true @@ -17,7 +17,6 @@ - diff --git a/src/Runner.Plugins/Runner.Plugins.csproj b/src/Runner.Plugins/Runner.Plugins.csproj index a786cf1cd1b..148fb00816f 100644 --- a/src/Runner.Plugins/Runner.Plugins.csproj +++ b/src/Runner.Plugins/Runner.Plugins.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 Library win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 true diff --git a/src/Runner.Sdk.Generator/BuildConstantsGenerator.cs b/src/Runner.Sdk.Generator/BuildConstantsGenerator.cs new file mode 100644 index 00000000000..e07e4f9e70f --- /dev/null +++ b/src/Runner.Sdk.Generator/BuildConstantsGenerator.cs @@ -0,0 +1,105 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Diagnostics; + +namespace GitHub.Runner.Sdk.Generator +{ + [Generator] + public sealed class BuildConstantsGenerator : IIncrementalGenerator + { + public void Initialize(IncrementalGeneratorInitializationContext context) + { + // CommitHash, PackageRuntime, and RunnerVersion come from MSBuild via . + IncrementalValueProvider<(string CommitHash, string PackageRuntime, string RunnerVersion)> props = + context.AnalyzerConfigOptionsProvider.Select((options, _) => + { + string projectDir = ValueOrDefault(options.GlobalOptions, "build_property.MSBuildProjectDirectory", () => string.Empty); + string commitHash = ValueOrDefault(options.GlobalOptions, "build_property.CommitHash", () => GetCommitHash(projectDir)); + string packageRuntime = ValueOrDefault(options.GlobalOptions, "build_property.PackageRuntime", () => GetRuntimeId()); + string runnerVersion = ValueOrDefault(options.GlobalOptions, "build_property.RunnerVersion", () => GetRunnerVersion(projectDir)); + return (commitHash, packageRuntime, runnerVersion); + }); + + context.RegisterSourceOutput(props, (ctx, values) => + { + ctx.AddSource("BuildConstants.g.cs", BuildSource(values.CommitHash, values.PackageRuntime, values.RunnerVersion)); + }); + } + + private static string GetCommitHash(string projectDir) + { + using var process = Process.Start(new ProcessStartInfo("git", "rev-parse HEAD") + { + WorkingDirectory = projectDir, + RedirectStandardOutput = true, + UseShellExecute = false, + }); + return process.StandardOutput.ReadToEnd().Trim(); + } + + private static string GetRunnerVersion(string projectDir) + { + return File.ReadAllText(Path.Combine(projectDir, "..", "runnerversion")).Trim(); + } + + private static string GetRuntimeId() + { + string platform = "unknown"; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + platform = "win"; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + platform = "linux"; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + platform = "osx"; + } + + return $"{platform}-{RuntimeInformation.OSArchitecture}".ToLowerInvariant(); + } + + private static string ValueOrDefault(AnalyzerConfigOptions options, string name, Func getDefaultValue) + { + options.TryGetValue(name, out string? value); + if (string.IsNullOrEmpty(value)) + { + return getDefaultValue(); + } + + return value!; + } + + private static string BuildSource(string commitHash, string packageRuntime, string runnerVersion) + { + var sb = new StringBuilder(); + sb.AppendLine("namespace GitHub.Runner.Sdk"); + sb.AppendLine("{"); + sb.AppendLine(" /***"); + sb.AppendLine(" * WARNING: This file is automatically regenerated on layout so the runner can provide version/commit info (do not manually edit it)."); + sb.AppendLine(" */"); + sb.AppendLine(" public static class BuildConstants"); + sb.AppendLine(" {"); + sb.AppendLine(" public static class Source"); + sb.AppendLine(" {"); + sb.AppendLine($" public static readonly string CommitHash = \"{commitHash}\";"); + sb.AppendLine(" }"); + sb.AppendLine(); + sb.AppendLine(" public static class RunnerPackage"); + sb.AppendLine(" {"); + sb.AppendLine($" public static readonly string PackageName = \"{packageRuntime}\";"); + sb.AppendLine($" public static readonly string Version = \"{runnerVersion}\";"); + sb.AppendLine(" }"); + sb.AppendLine(" }"); + sb.AppendLine("}"); + return sb.ToString(); + } + } +} diff --git a/src/Runner.Sdk.Generator/Runner.Sdk.Generator.csproj b/src/Runner.Sdk.Generator/Runner.Sdk.Generator.csproj new file mode 100644 index 00000000000..2a36b1218ed --- /dev/null +++ b/src/Runner.Sdk.Generator/Runner.Sdk.Generator.csproj @@ -0,0 +1,22 @@ + + + + netstandard2.0 + latest + enable + disable + + false + true + + RS2008;RS1035 + + + + + + + + + diff --git a/src/Runner.Sdk/BuildConstants.cs b/src/Runner.Sdk/BuildConstants.cs deleted file mode 100644 index 75fadfbdad0..00000000000 --- a/src/Runner.Sdk/BuildConstants.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace GitHub.Runner.Sdk -{ - /*** - * WARNING: This file is automatically regenerated on layout so the runner can provide version/commit info (do not manually edit it). - */ - public static class BuildConstants - { - public static class Source - { - public static readonly string CommitHash = "N/A"; - } - - public static class RunnerPackage - { - public static readonly string PackageName = "N/A"; - public static readonly string Version = "0"; - } - } -} diff --git a/src/Runner.Sdk/Runner.Sdk.csproj b/src/Runner.Sdk/Runner.Sdk.csproj index 55dbf12627c..7cb27ceadef 100644 --- a/src/Runner.Sdk/Runner.Sdk.csproj +++ b/src/Runner.Sdk/Runner.Sdk.csproj @@ -1,23 +1,30 @@  - net8.0 + net10.0 Library win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 true true NU1701;NU1603;SYSLIB0050;SYSLIB0051 $(Version) + true + - + + + + - - - + + + diff --git a/src/Runner.Service/Windows/RunnerService.csproj b/src/Runner.Service/Windows/RunnerService.csproj index ed43de7b06a..eb80c7d7e8d 100644 --- a/src/Runner.Service/Windows/RunnerService.csproj +++ b/src/Runner.Service/Windows/RunnerService.csproj @@ -1,89 +1,43 @@ - - - + + - Debug - AnyCPU - {D12EBD71-0464-46D0-8394-40BCFBA0A6F2} + net48 + net47 WinExe - Properties RunnerService RunnerService + false false - false - 512 true - - v4.8 - - - v4.7 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + + AppARM.config + - - - - - - - - + - + Component - + RunnerService.cs - - - + True True Resource.resx - - - - - - + - + ResXFileCodeGenerator Resource.Designer.cs - - + diff --git a/src/Runner.Worker/Runner.Worker.csproj b/src/Runner.Worker/Runner.Worker.csproj index 4470920e10c..687c32184cd 100644 --- a/src/Runner.Worker/Runner.Worker.csproj +++ b/src/Runner.Worker/Runner.Worker.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 Exe win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 true @@ -21,7 +21,6 @@ - diff --git a/src/Sdk/Sdk.csproj b/src/Sdk/Sdk.csproj index 644bf887ef7..7dd617abe05 100644 --- a/src/Sdk/Sdk.csproj +++ b/src/Sdk/Sdk.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 Library win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 @@ -19,18 +19,12 @@ - - - - - - diff --git a/src/Test/L0/ProcessExtensionL0.cs b/src/Test/L0/ProcessExtensionL0.cs index d650b4889ee..283c47fd498 100644 --- a/src/Test/L0/ProcessExtensionL0.cs +++ b/src/Test/L0/ProcessExtensionL0.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Threading; using System.Threading.Tasks; -using System.Linq; using Xunit; namespace GitHub.Runner.Common.Tests @@ -27,11 +24,13 @@ public async Task SuccessReadProcessEnv() try { #if OS_WINDOWS - string node = Path.Combine(TestUtil.GetSrcPath(), @"..\_layout\externals\node20\bin\node"); + string nodeExec = "node.exe"; #else - string node = Path.Combine(TestUtil.GetSrcPath(), @"../_layout/externals/node20/bin/node"); hc.EnqueueInstance(new ProcessInvokerWrapper()); + string nodeExec = "node"; #endif + string nodeFallback = Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "externals", "node20", "bin", nodeExec); + string node = FindInPath(nodeExec) ?? nodeFallback; var startInfo = new ProcessStartInfo(node, "-e \"setTimeout(function(){{}}, 15 * 1000);\""); startInfo.Environment[envName] = envValue; sleep = Process.Start(startInfo); @@ -66,5 +65,17 @@ public async Task SuccessReadProcessEnv() } } } + private static string FindInPath(string executable) + { + foreach (string dir in (Environment.GetEnvironmentVariable("PATH") ?? "").Split(Path.PathSeparator)) + { + string full = Path.Combine(dir, executable); + if (File.Exists(full)) + { + return full; + } + } + return null; + } } } diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj index a5a19aea7d1..a75a0f3dbdc 100644 --- a/src/Test/Test.csproj +++ b/src/Test/Test.csproj @@ -1,6 +1,6 @@ - net8.0 + net10.0 win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 true NU1701;NU1603;NU1603;xUnit2013;SYSLIB0050;SYSLIB0051 @@ -19,7 +19,6 @@ - diff --git a/src/dev.sh b/src/dev.sh index 716fa08e677..338bebbd7f9 100755 --- a/src/dev.sh +++ b/src/dev.sh @@ -17,9 +17,10 @@ LAYOUT_DIR="$SCRIPT_DIR/../_layout" DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/netcore2x" PACKAGE_DIR="$SCRIPT_DIR/../_package" DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk" -DOTNETSDK_VERSION="8.0.418" +DOTNETSDK_VERSION="10.0.103" DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION" RUNNER_VERSION=$(cat runnerversion) +GIT_COMMIT_HASH=$(git rev-parse HEAD) pushd "$SCRIPT_DIR" @@ -116,21 +117,21 @@ function heading() { echo echo - echo "-----------------------------------------" + echo "----------------------------------------------------------------------------------" echo " ${1}" - echo "-----------------------------------------" + echo "----------------------------------------------------------------------------------" } function build () { - heading "Building ..." - dotnet msbuild -t:Build -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" ./dir.proj || failed build + heading "Building $RUNNER_VERSION: $GIT_COMMIT_HASH --- $RUNTIME_ID ..." + dotnet msbuild -t:Build -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" -p:CommitHash="${GIT_COMMIT_HASH}" ./dir.proj || failed build } function layout () { - heading "Create layout ..." - dotnet msbuild -t:layout -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" ./dir.proj || failed build + heading "Create $RUNNER_VERSION: $GIT_COMMIT_HASH --- $RUNTIME_ID ..." + dotnet msbuild -t:layout -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" -p:CommitHash="${GIT_COMMIT_HASH}" ./dir.proj || failed build #change execution flag to allow running with sudo if [[ ("$CURRENT_PLATFORM" == "linux") || ("$CURRENT_PLATFORM" == "darwin") ]]; then @@ -147,13 +148,13 @@ function layout () function runtest () { - heading "Testing ..." + heading "Testing $RUNNER_VERSION: $GIT_COMMIT_HASH --- $RUNTIME_ID ..." if [[ ("$CURRENT_PLATFORM" == "linux") || ("$CURRENT_PLATFORM" == "darwin") ]]; then ulimit -n 1024 fi - dotnet msbuild -t:test -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" ./dir.proj || failed "failed tests" + dotnet test -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" -p:CommitHash="${GIT_COMMIT_HASH}" Test/Test.csproj || failed "failed tests" } function format() diff --git a/src/dir.proj b/src/dir.proj index 056a312e8f8..1c97f01c85d 100644 --- a/src/dir.proj +++ b/src/dir.proj @@ -1,34 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -40,17 +12,13 @@ - + + - - - - - @@ -81,6 +49,8 @@ + + diff --git a/src/global.json b/src/global.json index 519b109fa8a..058bafa625b 100644 --- a/src/global.json +++ b/src/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0.418" + "version": "10.0.103" } }