Skip to content

Commit

Permalink
change current architecture as default platform
Browse files Browse the repository at this point in the history
  • Loading branch information
RassK committed Feb 16, 2024
1 parent 3f875a0 commit dd3177a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Expand Up @@ -43,16 +43,12 @@ jobs:
include:
- machine: windows-2022
containers: none
platform: x64
- machine: ubuntu-20.04
containers: linux
platform: x64
- machine: macos-11
containers: none
platform: x64
- machine: actuated-arm64
containers: linux
platform: arm
runs-on: ${{ matrix.machine }}
steps:
- name: Checkout
Expand Down Expand Up @@ -102,7 +98,7 @@ jobs:
make
- name: Run TestWorkflow
run: ./build.cmd --skip NativeTests --target TestWorkflow --platform ${{ matrix.platform }} --test-target-framework ${{ matrix.test-tfm }} --containers ${{ matrix.containers }}
run: ./build.cmd --skip NativeTests --target TestWorkflow --test-target-framework ${{ matrix.test-tfm }} --containers ${{ matrix.containers }}

- name: Upload test logs
if: always()
Expand Down
27 changes: 27 additions & 0 deletions build/Build.Utils.cs
@@ -0,0 +1,27 @@
using Nuke.Common.Tools.MSBuild;
using System.Runtime.InteropServices;

partial class Build
{
private static string AndFilter(params string[] args)
{
return string.Join("&", args.Where(s => !string.IsNullOrEmpty(s)));
}

private static MSBuildTargetPlatform GetDefaultTargetPlatform()
{
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{
return Arm64TargetPlatform;
}

if (RuntimeInformation.OSArchitecture == Architecture.X86)
{
return MSBuildTargetPlatform.x86;
}

return MSBuildTargetPlatform.x64;
}

private static MSBuildTargetPlatform Arm64TargetPlatform = (MSBuildTargetPlatform)"arm64";
}
4 changes: 2 additions & 2 deletions build/Build.cs
Expand Up @@ -11,8 +11,8 @@ partial class Build : NukeBuild
[Parameter("Configuration to build. Default is 'Release'")]
readonly Configuration BuildConfiguration = Configuration.Release;

[Parameter("Platform to build - x86, x64, arm. Default is 'x64'")]
readonly MSBuildTargetPlatform Platform = MSBuildTargetPlatform.x64;
[Parameter("Platform to build - x86, x64, arm64. Default is current architecture.")]
readonly MSBuildTargetPlatform Platform = GetDefaultTargetPlatform();

[Parameter($"Docker containers type to be used in tests. One of '{ContainersNone}', '{ContainersLinux}', '{ContainersWindows}', '{ContainersWindowsOnly}'. Default is '{ContainersLinux}'")]
readonly string Containers = ContainersLinux;
Expand Down

0 comments on commit dd3177a

Please sign in to comment.