From 86eab9811ae03a7c37bf33e46e6b13fb5641c064 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Mon, 12 Jan 2026 14:47:51 +0500 Subject: [PATCH] remove azure devops usage and try to fix pr build linking --- Clients/GithubClient/Client.CI.cs | 27 +++++++++++++- CompatBot/Commands/Pr.cs | 62 ++----------------------------- 2 files changed, 29 insertions(+), 60 deletions(-) diff --git a/Clients/GithubClient/Client.CI.cs b/Clients/GithubClient/Client.CI.cs index 36c776eb..127b9ba9 100644 --- a/Clients/GithubClient/Client.CI.cs +++ b/Clients/GithubClient/Client.CI.cs @@ -127,7 +127,7 @@ public partial class Client // https://api.github.com/repos/RPCS3/rpcs3/actions/artifacts/2802751674 /zip // we need public web links like this: // https://github.com/RPCS3/rpcs3/actions/runs/14017059654/artifacts/2802751674 - var windowsBuildArtifact = artifacts.FirstOrDefault(a => a.Name.Contains("Windows")); + var windowsBuildArtifact = artifacts.FirstOrDefault(a => a.Name.Contains("Windows") && !a.Name.Contains("Clang") && !a.Name.Contains("ARM")); if (windowsBuildArtifact is { ArchiveDownloadUrl.Length: > 0, Expired: false }) { var winZipUrl = $"https://github.com/RPCS3/rpcs3/actions/runs/{run.Id}/artifacts/{windowsBuildArtifact.Id}"; @@ -151,6 +151,31 @@ public partial class Client } } + // windows arm build + var windowsArmBuildArtifact = artifacts.FirstOrDefault(a => a.Name.Contains("Windows") && a.Name.Contains("ARM")); + if (windowsArmBuildArtifact is { ArchiveDownloadUrl.Length: > 0, Expired: false }) + { + var winZipUrl = $"https://github.com/RPCS3/rpcs3/actions/runs/{run.Id}/artifacts/{windowsArmBuildArtifact.Id}"; + result = result with { WindowsArmBuildDownloadLink = winZipUrl }; + try + { + await using var stream = await client.Actions.Artifacts.DownloadArtifact(OwnerId, RepoId, windowsArmBuildArtifact.Id, "zip").ConfigureAwait(false); + using var zipStream = ReaderFactory.Open(stream); + while (zipStream.MoveToNextEntry() && !cancellationToken.IsCancellationRequested) + { + if (zipStream.Entry.Key?.EndsWith(".7z", StringComparison.OrdinalIgnoreCase) is true) + { + result = result with { WindowsArmFilename = Path.GetFileName(zipStream.Entry.Key) }; + break; + } + } + } + catch (Exception e2) + { + ApiConfig.Log.Error(e2, "Failed to get windows arm build filename"); + } + } + // linux build var linuxBuildArtifact = artifacts .Where(a => a.Name.Contains("Linux") && a.Name.Contains("x64", StringComparison.OrdinalIgnoreCase)) diff --git a/CompatBot/Commands/Pr.cs b/CompatBot/Commands/Pr.cs index f546eb6f..ad657c52 100644 --- a/CompatBot/Commands/Pr.cs +++ b/CompatBot/Commands/Pr.cs @@ -134,7 +134,6 @@ internal sealed class Pr var (state, _) = prInfo.GetState(); var embed = prInfo.AsEmbed(); - var azureClient = Config.GetAzureDevOpsClient(); if (state is "Open" or "Closed") { var windowsDownloadHeader = "Windows x64 PR Build"; @@ -151,7 +150,7 @@ internal sealed class Pr string? macArmDownloadText = null; string? buildTime = null; - if (azureClient is not null && prInfo is {Head.Sha: {Length: >0} commit}) + if (prInfo is {Head.Sha: {Length: >0} commit}) try { windowsDownloadText = "⏳ Pending…"; @@ -160,9 +159,8 @@ internal sealed class Pr windowsArmDownloadText = "⏳ Pending…"; linuxArmDownloadText = "⏳ Pending…"; macArmDownloadText = "⏳ Pending…"; - var latestBuild = await azureClient.GetPrBuildInfoAsync(commit, prInfo.MergedAt?.DateTime, pr, Config.Cts.Token).ConfigureAwait(false); var ghBuild = await GithubClient.GetPrBuildInfoAsync(commit, prInfo.MergedAt?.DateTime, pr, Config.Cts.Token).ConfigureAwait(false); - if (latestBuild is null && ghBuild is null) + if (ghBuild is null) { if (state is "Open") { @@ -175,60 +173,6 @@ internal sealed class Pr linuxArmDownloadText = null; macArmDownloadText = null; } - if (latestBuild is not null) - { - var shouldHaveArtifacts = false; - if (latestBuild is - { - Status: BuildStatus.Completed, - Result: BuildResult.Succeeded or BuildResult.PartiallySucceeded, - FinishTime: not null - }) - { - buildTime = $"Built on {latestBuild.FinishTime:u} ({(DateTime.UtcNow - latestBuild.FinishTime.Value).AsTimeDeltaDescription()} ago)"; - shouldHaveArtifacts = true; - } - - // Check for subtask errors (win/lin/mac) - if (latestBuild is { Result: BuildResult.Failed or BuildResult.Canceled }) - { - macDownloadText = $"❌ {latestBuild.Result}"; - macArmDownloadText = $"❌ {latestBuild.Result}"; - } - - // Check estimated time for pending builds - if (latestBuild is { Status: BuildStatus.InProgress, StartTime: not null }) - { - var estimatedCompletionTime = latestBuild.StartTime.Value + (await azureClient.GetPipelineDurationAsync(Config.Cts.Token).ConfigureAwait(false)).Mean; - var estimatedTime = TimeSpan.FromMinutes(1); - if (estimatedCompletionTime > DateTime.UtcNow) - estimatedTime = estimatedCompletionTime - DateTime.UtcNow; - macDownloadText = $"⏳ Pending in {estimatedTime.AsTimeDeltaDescription()}…"; - macArmDownloadText = $"⏳ Pending in {estimatedTime.AsTimeDeltaDescription()}…"; - } - - // mac build - var name = latestBuild.MacFilename ?? "Mac PR Build"; - name = name.Replace("rpcs3-", "").Replace("_macos", ""); - if (!string.IsNullOrEmpty(latestBuild.MacBuildDownloadLink)) - macDownloadText = $"[⏬ {name}]({latestBuild.MacBuildDownloadLink})"; - else if (shouldHaveArtifacts) - { - if (latestBuild.FinishTime.HasValue && (DateTime.UtcNow - latestBuild.FinishTime.Value).TotalDays > 30) - macDownloadText = "No longer available"; - } - - // mac arm build - name = latestBuild.MacArmFilename ?? "Mac Apple Silicon PR Build"; - name = name.Replace("rpcs3-", "").Replace("_macos_arm64", ""); - if (!string.IsNullOrEmpty(latestBuild.MacArmBuildDownloadLink)) - macArmDownloadText = $"[⏬ {name}]({latestBuild.MacArmBuildDownloadLink})"; - else if (shouldHaveArtifacts) - { - if (latestBuild.FinishTime.HasValue && (DateTime.UtcNow - latestBuild.FinishTime.Value).TotalDays > 30) - macArmDownloadText = "No longer available"; - } - } if (ghBuild is not null) { var shouldHaveArtifacts = false; @@ -360,7 +304,7 @@ internal sealed class Pr if (!string.IsNullOrEmpty(buildTime)) embed.WithFooter(buildTime); } - else if (state is "Merged" && azureClient is not null) + else if (state is "Merged") { var mergeTime = prInfo.MergedAt.GetValueOrDefault(); var now = DateTime.UtcNow;