Skip to content

Arm64 - disable testing the artifacts as well as the docker images for Arm64 #3852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ jobs:
with:
name: nuget
path: ${{ github.workspace }}/artifacts/packages/nuget
-
name: Setup QEMU
if: inputs.arch == 'arm64'
uses: docker/setup-qemu-action@v3
-
name: Setup Docker Buildx
if: inputs.arch == 'arm64'
uses: docker/setup-buildx-action@v3
with:
install: true
-
name: Docker Test
if: success() && github.event_name == 'pull_request' || github.repository_owner != 'GitTools'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [ amd64, amd64 ]
arch: [ amd64, arm64 ]

uses: ./.github/workflows/_artifacts_linux.yml
with:
Expand All @@ -75,7 +75,7 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [ amd64, amd64 ]
arch: [ amd64, arm64 ]

uses: ./.github/workflows/_docker.yml
with:
Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsDotnetToolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void Run(BuildContext context)

foreach (var dockerImage in context.Images)
{
if (context.SkipImageForArtifacts(dockerImage)) continue;
if (context.SkipImageTesting(dockerImage)) continue;

var cmd = $"{rootPrefix}/scripts/test-global-tool.sh --version {version} --nugetPath {rootPrefix}/nuget --repoPath {rootPrefix}/repo";

Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsMsBuildCoreTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override void Run(BuildContext context)

foreach (var dockerImage in context.Images)
{
if (context.SkipImageForArtifacts(dockerImage)) continue;
if (context.SkipImageTesting(dockerImage)) continue;

var framework = dockerImage.TargetFramework;

Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsNativeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void Run(BuildContext context)

foreach (var dockerImage in context.Images)
{
if (context.SkipImageForArtifacts(dockerImage)) continue;
if (context.SkipImageTesting(dockerImage)) continue;

var runtime = "linux";
if (dockerImage.Distro.StartsWith("alpine"))
Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsPrepare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override void Run(BuildContext context)
{
foreach (var dockerImage in context.Images)
{
if (context.SkipImageForArtifacts(dockerImage)) continue;
if (context.SkipImageTesting(dockerImage)) continue;
context.DockerPullImage(dockerImage);
}
}
Expand Down
3 changes: 0 additions & 3 deletions build/common/Utilities/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public class Constants
public static readonly string[] VersionsToBuild = [Version60, Version70, Version80];
public static readonly string[] Frameworks = [NetVersion60, NetVersion70, NetVersion80];

public static readonly string[] DistrosToSkipForArtifacts = [];
public static readonly string[] DistrosToSkipForDocker = [];

public const string DockerBaseImageName = "gittools/build-images";
public const string DockerImageName = "gittools/gitversion";

Expand Down
12 changes: 12 additions & 0 deletions build/common/Utilities/ContextExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Runtime.InteropServices;
using Cake.Common.Build.AzurePipelines;
using Xunit;
using ProcessArchitecture = System.Runtime.InteropServices.Architecture;

namespace Common.Utilities;

Expand All @@ -12,6 +14,7 @@ public static IEnumerable<string> ExecuteCommand(this ICakeContext context, File
{
processSettings.WorkingDirectory = workDir;
}

context.StartProcess(exe, processSettings, out var redirectedOutput);
return redirectedOutput.ToList();
}
Expand Down Expand Up @@ -79,6 +82,12 @@ public static string GetOS(this ICakeContext context)
return string.Empty;
}

public static bool IsRunningOnAmd64(this ICakeContext _)
=> RuntimeInformation.ProcessArchitecture == ProcessArchitecture.X64;

public static bool IsRunningOnArm64(this ICakeContext _) =>
RuntimeInformation.ProcessArchitecture == ProcessArchitecture.Arm64;

public static string GetBuildAgent(this ICakeContext context)
{
var buildSystem = context.BuildSystem();
Expand Down Expand Up @@ -142,6 +151,7 @@ public static string GetBranchName(this ICakeContext context)
{
repositoryBranch = buildSystem.GitHubActions.Environment.Workflow.Ref.Replace("refs/heads/", "");
}

return repositoryBranch;
}

Expand All @@ -161,6 +171,7 @@ public static string GetRepositoryName(this ICakeContext context)
{
repositoryName = buildSystem.GitHubActions.Environment.Workflow.Repository;
}

return repositoryName;
}

Expand All @@ -172,6 +183,7 @@ public static string GetRepositoryName(this ICakeContext context)
context.GetFiles($"src/GitVersion.App/bin/{Constants.DefaultConfiguration}/{Constants.NetVersionLatest}/gitversion.dll").SingleOrDefault();
public static FilePath? GetGitVersionDotnetToolLocation(this ICakeContext context) =>
context.MakeAbsolute(Paths.Tools.Combine("gitversion").CombineWithFilePath("gitversion.dll"));

public static FilePath? GetSchemaDotnetToolLocation(this ICakeContext context) =>
context.MakeAbsolute(Paths.Tools.Combine("schema").CombineWithFilePath("schema.dll"));
}
27 changes: 10 additions & 17 deletions build/common/Utilities/DockerContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,19 @@ public enum Architecture

public static class DockerContextExtensions
{
public static bool SkipImageForArtifacts(this ICakeContext context, DockerImage dockerImage)
public static bool SkipImageTesting(this ICakeContext context, DockerImage dockerImage)
{
var (distro, targetFramework, architecture, _, _) = dockerImage;

if (architecture == Architecture.Amd64) return false;
if (!Constants.DistrosToSkipForArtifacts.Contains(distro)) return false;

context.Information($"Skipping Target: {targetFramework}, Distro: {distro}, Arch: {architecture}");
return true;
}

public static bool SkipImageForDocker(this ICakeContext context, DockerImage dockerImage)
{
var (distro, targetFramework, architecture, _, _) = dockerImage;

if (architecture == Architecture.Amd64) return false;
if (!Constants.DistrosToSkipForDocker.Contains(distro)) return false;

context.Information($"Skipping Target: {targetFramework}, Distro: {distro}, Arch: {architecture}");
return true;
switch (architecture)
{
case Architecture.Amd64:
case Architecture.Arm64 when context.IsRunningOnArm64():
return false;
default:
context.Information($"Skipping Target: {targetFramework}, Distro: {distro}, Arch: {architecture}");
return true;
}
}

public static void DockerBuildImage(this BuildContextBase context, DockerImage dockerImage)
Expand Down
1 change: 0 additions & 1 deletion build/docker/Tasks/DockerBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public override void Run(BuildContext context)

foreach (var dockerImage in context.Images)
{
if (context.SkipImageForDocker(dockerImage)) continue;
context.DockerBuildImage(dockerImage);
}
}
Expand Down
1 change: 0 additions & 1 deletion build/docker/Tasks/DockerPublish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public override void Run(BuildContext context)
{
foreach (var dockerImage in context.Images)
{
if (context.SkipImageForDocker(dockerImage)) continue;
context.DockerPushImage(dockerImage);
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Tasks/DockerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void Run(BuildContext context)
{
foreach (var dockerImage in context.Images)
{
if (context.SkipImageForDocker(dockerImage)) continue;
if (context.SkipImageTesting(dockerImage)) continue;
context.DockerTestImage(dockerImage);
}
}
Expand Down