diff --git a/.github/workflows/run-script.yml b/.github/workflows/run-script.yml index 5ece980..1f3e4af 100644 --- a/.github/workflows/run-script.yml +++ b/.github/workflows/run-script.yml @@ -11,10 +11,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup .NET 8.0 + - name: Setup .NET 9.0 uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0' + dotnet-version: '9.0' - name: Run script shell: pwsh diff --git a/Runner/Helpers/GitHelper.cs b/Runner/Helpers/GitHelper.cs index 94b0843..3eff0f8 100644 --- a/Runner/Helpers/GitHelper.cs +++ b/Runner/Helpers/GitHelper.cs @@ -30,4 +30,19 @@ private static bool ShouldSkipLine(string line) span.StartsWith("@@", StringComparison.Ordinal) || span.StartsWith("\\ No newline at end of file", StringComparison.Ordinal); } + + public static async Task> GetChangedFilesAsync(JobBase job, string baselineRef, string workDir) + { + List lines = []; + + await job.RunProcessAsync("git", + $"diff --name-only {baselineRef}", + lines, + workDir: workDir, + checkExitCode: false, + suppressOutputLogs: true, + suppressStartingLog: true); + + return lines; + } } diff --git a/Runner/Jobs/JitDiffJob.cs b/Runner/Jobs/JitDiffJob.cs index dc151c0..88875dc 100644 --- a/Runner/Jobs/JitDiffJob.cs +++ b/Runner/Jobs/JitDiffJob.cs @@ -80,7 +80,9 @@ public static async Task BuildAndCopyRuntimeBranchBitsAsync(JobBase job, string { string arch = IsArm ? "arm64" : "x64"; - await job.RunProcessAsync("bash", $"build.sh clr+libs -c Release {RuntimeHelpers.LibrariesExtraBuildArgs}", logPrefix: $"{branch} release", workDir: "runtime"); + string targets = await ShouldBuildsLibsAsync() ? "clr+libs" : "clr"; + + await job.RunProcessAsync("bash", $"build.sh {targets} -c Release {RuntimeHelpers.LibrariesExtraBuildArgs}", logPrefix: $"{branch} release", workDir: "runtime"); Task copyReleaseBitsTask = RuntimeHelpers.CopyReleaseArtifactsAsync(job, branch, $"artifacts-{branch}"); @@ -94,6 +96,20 @@ public static async Task BuildAndCopyRuntimeBranchBitsAsync(JobBase job, string } await copyReleaseBitsTask; + + async Task ShouldBuildsLibsAsync() + { + if (branch == "pr") + { + List changedFiles = await GitHelper.GetChangedFilesAsync(job, "main", "runtime"); + + return changedFiles.Any(f => + !f.StartsWith("src/coreclr/", StringComparison.OrdinalIgnoreCase) || + f.Contains("/System.Private.CoreLib/", StringComparison.OrdinalIgnoreCase)); + } + + return true; + } } private async Task CollectFrameworksDiffsAsync() diff --git a/Runner/Runner.csproj b/Runner/Runner.csproj index f38bcc4..fdd2b42 100644 --- a/Runner/Runner.csproj +++ b/Runner/Runner.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 enable ${NoWarn};IDE0305