Skip to content

Commit 3751a9c

Browse files
committed
(build) run tests for arm64 artifacts when TEST_ARM64_ARTIFACTS is enabled
1 parent a38bd16 commit 3751a9c

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

.github/workflows/_artifacts_linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ jobs:
5050
name: '[Test Artifacts]'
5151
shell: pwsh
5252
run: dotnet run/artifacts.dll --target=ArtifactsTest --arch ${{ inputs.arch }} --docker_dotnetversion=${{ matrix.targetFramework }} --docker_distro=${{ matrix.distro }}
53+
env:
54+
TEST_ARM64_ARTIFACTS: ${{ secrets.TEST_ARM64_ARTIFACTS }}

.github/workflows/ci.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@ name: CI
33
on:
44
push:
55
branches:
6-
- main
7-
- 'fix/*'
8-
- 'feature/*'
9-
- 'poc/*'
10-
- 'support/*'
6+
- main
7+
- 'fix/*'
8+
- 'feature/*'
9+
- 'poc/*'
10+
- 'support/*'
1111
paths:
12-
- '**'
13-
- '!docs/**'
14-
- '!new-cli/**'
12+
- '**'
13+
- '!docs/**'
14+
- '!new-cli/**'
1515

1616
pull_request:
1717
branches:
18-
- main
19-
- 'support/*'
18+
- main
19+
- 'support/*'
2020
paths:
21-
- '**'
22-
- '!docs/**'
23-
- '!new-cli/**'
21+
- '**'
22+
- '!docs/**'
23+
- '!new-cli/**'
2424

2525
repository_dispatch:
26-
types: [release]
26+
types: [ release ]
2727

2828
env:
2929
DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2
@@ -70,9 +70,10 @@ jobs:
7070
with:
7171
runner: ubuntu-latest
7272
arch: ${{ matrix.arch }}
73+
secrets: inherit
7374

7475
docker_linux_images:
75-
needs: [ build ]
76+
needs: [ build ]
7677
name: Docker Images (${{ matrix.arch }})
7778
strategy:
7879
fail-fast: false
@@ -86,7 +87,7 @@ jobs:
8687
secrets: inherit
8788

8889
docker_linux_manifests:
89-
needs: [ docker_linux_images ]
90+
needs: [ docker_linux_images ]
9091
name: Docker Manifests
9192
uses: ./.github/workflows/_docker_manifests.yml
9293
secrets: inherit

build/artifacts/BuildContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ public class BuildContext : BuildContextBase
88

99
public bool IsDockerOnLinux { get; set; }
1010

11+
public bool TestArm64Artifacts { get; set; }
12+
13+
public Architecture? Architecture { get; set; }
14+
1115
public IEnumerable<DockerImage> Images { get; set; } = new List<DockerImage>();
1216

1317
public BuildContext(ICakeContext context) : base(context)

build/artifacts/BuildLifetime.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ public override void Setup(BuildContext context, ISetupContext info)
1010
base.Setup(context, info);
1111

1212
context.IsDockerOnLinux = context.DockerCustomCommand("info --format '{{.OSType}}'").First().Replace("'", string.Empty) == "linux";
13+
context.TestArm64Artifacts = context.EnvironmentVariable("TEST_ARM64_ARTIFACTS", false);
1314

14-
var architecture = context.HasArgument(Arguments.Architecture) ? context.Argument<Architecture>(Arguments.Architecture) : (Architecture?)null;
15+
context.Architecture = context.HasArgument(Arguments.Architecture) ? context.Argument<Architecture>(Arguments.Architecture) : (Architecture?)null;
1516
var dockerRegistry = context.Argument(Arguments.DockerRegistry, DockerRegistry.DockerHub);
1617
var dotnetVersion = context.Argument(Arguments.DockerDotnetVersion, string.Empty).ToLower();
1718
var dockerDistro = context.Argument(Arguments.DockerDistro, string.Empty).ToLower();
1819

1920
var versions = string.IsNullOrWhiteSpace(dotnetVersion) ? Constants.VersionsToBuild : new[] { dotnetVersion };
2021
var distros = string.IsNullOrWhiteSpace(dockerDistro) ? Constants.DockerDistrosToBuild : new[] { dockerDistro };
21-
var archs = architecture.HasValue ? new[] { architecture.Value } : Constants.ArchToBuild;
22+
23+
var archs = context.Architecture.HasValue ? new[] { context.Architecture.Value } : Constants.ArchToBuild;
2224

2325
var registry = dockerRegistry == DockerRegistry.DockerHub ? Constants.DockerHubRegistry : Constants.GitHubContainerRegistry;
2426
context.Images = from version in versions

build/artifacts/Tasks/ArtifactsMsBuildCoreTest.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public override bool ShouldRun(BuildContext context)
1515
var shouldRun = true;
1616
shouldRun &= context.ShouldRun(context.IsDockerOnLinux, $"{nameof(ArtifactsMsBuildCoreTest)} works only on Docker on Linux agents.");
1717

18+
if (context.Architecture is Architecture.Arm64)
19+
{
20+
shouldRun &= context.ShouldRun(context.TestArm64Artifacts, $"{nameof(ArtifactsMsBuildCoreTest)} works only when TEST_ARM64_ARTIFACTS is enabled.");
21+
}
22+
1823
return shouldRun;
1924
}
2025

0 commit comments

Comments
 (0)