diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f3a11c80b..bcd9f417a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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() diff --git a/build/Build.Utils.cs b/build/Build.Utils.cs new file mode 100644 index 0000000000..4f34fa668d --- /dev/null +++ b/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"; +} diff --git a/build/Build.cs b/build/Build.cs index a5ff9e1ce1..d77bff12b6 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -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; @@ -167,9 +167,4 @@ string TestNameFilter() return "FullyQualifiedName~" + TestName; } - - static string AndFilter(params string[] args) - { - return string.Join("&", args.Where(s => !string.IsNullOrEmpty(s))); - } }