Enable building .NET Core osx-arm64 in CI (#43187)
authorSteve MacLean <Steve.MacLean@microsoft.com>
Fri, 9 Oct 2020 22:02:51 +0000 (18:02 -0400)
committerGitHub <noreply@github.com>
Fri, 9 Oct 2020 22:02:51 +0000 (18:02 -0400)
* Enable building .NET Core osx-arm64 in CI
* For osx-arm64 xcode-select xcode_12.2
* Use vmImage macOS-10.15 for all platforms

16 files changed:
eng/install-native-dependencies.sh
eng/pipelines/common/global-build-job.yml
eng/pipelines/common/platform-matrix.yml
eng/pipelines/common/templates/runtimes/build-test-job.yml
eng/pipelines/common/xplat-setup.yml
eng/pipelines/coreclr/ci.yml
eng/pipelines/coreclr/templates/build-jit-job.yml
eng/pipelines/coreclr/templates/build-job.yml
eng/pipelines/coreclr/templates/xplat-job.yml
eng/pipelines/installer/jobs/base-job.yml
eng/pipelines/libraries/base-job.yml
eng/pipelines/libraries/build-job.yml
eng/pipelines/libraries/outerloop.yml
eng/pipelines/mono/templates/build-job.yml
eng/pipelines/runtime-official.yml
eng/pipelines/runtime.yml

index e8ab193..31a61e9 100755 (executable)
@@ -1,5 +1,24 @@
 #!/usr/bin/env bash
 
+# This is a simple script primarily used for CI to install necessary dependencies
+#
+# For CI typical usage is
+#
+# ./install-native-dependencies.sh <OS> <arch> azDO
+#
+# For developer use it is not recommended to include the azDO final argument as that
+# makes installation and configuration setting only required for azDO
+#
+# So simple developer usage would currently be
+#
+# ./install-native-dependencies.sh <OS>
+
+if [ "$1" = "OSX" ] && [ "$2" = "arm64" ] && [ "$3" = "azDO" ]; then
+    # On AzDO macOS-10.15 build agents the Xcode currently defaults to Xcode 11.7
+    # Cross compilation for osx-arm64 requires xcode 12.2 or greater
+    sudo xcode-select -s /Applications/Xcode_12.2.app/Contents/Developer
+fi
+
 if [ "$1" = "Linux" ]; then
     sudo apt update
     if [ "$?" != "0" ]; then
index 41cc326..14326ce 100644 (file)
@@ -42,7 +42,7 @@ jobs:
 
       # Do not rename as it clashes with MSBuild property in libraries/build-native.proj
       - name: _crossBuildPropertyArg
-        value: /p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }}
+        value: /p:CrossBuild=${{ or(ne(parameters.crossrootfsDir, ''),  and(eq(parameters.osGroup, 'OSX'), eq(parameters.archType, 'arm64'))) }}
 
       - name: _cxx11Parameter
         ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.archType, 'arm64')) }}:
@@ -66,7 +66,7 @@ jobs:
       - template: /eng/pipelines/common/restore-internal-tools.yml
 
     - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
         displayName: Install Build Dependencies
 
       - script: |
index 44d52cb..a4ed15a 100644 (file)
@@ -445,6 +445,27 @@ jobs:
         helixQueueGroup: ${{ parameters.helixQueueGroup }}
         ${{ insert }}: ${{ parameters.jobParameters }}
 
+# macOS arm64
+
+- ${{ if or(containsValue(parameters.platforms, 'OSX_arm64'), eq(parameters.platformGroup, 'all')) }}:
+  - template: xplat-setup.yml
+    parameters:
+      jobTemplate: ${{ parameters.jobTemplate }}
+      helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
+      variables: ${{ parameters.variables }}
+      osGroup: OSX
+      archType: arm64
+      targetRid: osx-arm64
+      platform: OSX_arm64
+      jobParameters:
+        runtimeFlavor: ${{ parameters.runtimeFlavor }}
+        stagedBuild: ${{ parameters.stagedBuild }}
+        buildConfig: ${{ parameters.buildConfig }}
+        ${{ if eq(parameters.passPlatforms, true) }}:
+          platforms: ${{ parameters.platforms }}
+        helixQueueGroup: ${{ parameters.helixQueueGroup }}
+        ${{ insert }}: ${{ parameters.jobParameters }}
+
 # macOS x64
 
 - ${{ if or(containsValue(parameters.platforms, 'OSX_x64'), eq(parameters.platformGroup, 'all')) }}:
index 144cc13..a658bba 100644 (file)
@@ -87,7 +87,7 @@ jobs:
 
     # Install test build dependencies
     - ${{ if eq(parameters.osGroup, 'OSX') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
         displayName: Install native dependencies
     - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
       # Necessary to install correct cmake version
index 0a3d6cd..a5720c2 100644 (file)
@@ -116,7 +116,7 @@ jobs:
 
         # OSX Build Pool (we don't have on-prem OSX BuildPool
         ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
-          vmImage: 'macOS-10.14'
+          vmImage: 'macOS-10.15'
 
         ${{ if eq(parameters.osGroup, 'Browser') }}:
           vmImage: 'ubuntu-latest'
index e7ef3ab..9059f11 100644 (file)
@@ -44,6 +44,7 @@ jobs:
     - Linux_musl_arm64
     - Linux_musl_x64
     - Linux_x64
+    - OSX_arm64
     - OSX_x64
     - Windows_NT_arm
     - Windows_NT_arm64
@@ -72,6 +73,7 @@ jobs:
     - Linux_arm
     - Linux_musl_arm64
     - Linux_x64
+    - OSX_arm64
     - OSX_x64
     - Windows_NT_x86
     jobParameters:
index f46a57a..34efd80 100644 (file)
@@ -80,7 +80,7 @@ jobs:
     # and FreeBSD builds use a build agent with dependencies
     # preinstalled, so we only need this step for OSX and Windows.
     - ${{ if eq(parameters.osGroup, 'OSX') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
         displayName: Install native dependencies
     - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
       # Necessary to install python
index 526b43a..30e89d4 100644 (file)
@@ -125,7 +125,7 @@ jobs:
     # and FreeBSD builds use a build agent with dependencies
     # preinstalled, so we only need this step for OSX and Windows.
     - ${{ if eq(parameters.osGroup, 'OSX') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
         displayName: Install native dependencies
     - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
       # Necessary to install python
index 7f03b78..485326b 100644 (file)
@@ -91,12 +91,14 @@ jobs:
       - name: _HelixSource
         value: ci/dotnet/runtime/$(Build.SourceBranch)
 
+    - name: crossArg
+      value: ''
     - ${{ if ne(parameters.crossrootfsDir, '') }}:
       - name: crossArg
         value: '-cross'
-    - ${{ if eq(parameters.crossrootfsDir, '') }}:
+    - ${{ if and(eq(parameters.osGroup, 'OSX'), eq(parameters.archType, 'arm64')) }}:
       - name: crossArg
-        value: ''
+        value: '-cross'
 
     - ${{ each variable in parameters.variables }}:
       - ${{insert}}: ${{ variable }}
index 4d85159..a93c4e9 100644 (file)
@@ -67,7 +67,8 @@ jobs:
       not(in(parameters.archType, 'x64', 'x86')),
       eq(parameters.runtimeFlavor, 'mono'),
       eq(parameters.isOfficialBuild, true),
-      ne(parameters.crossrootfsDir, '')) }}
+      ne(parameters.crossrootfsDir, ''),
+      and(eq(parameters.osGroup, 'OSX'), eq(parameters.archType, 'arm64'))) }}
 
   - name: BuildAction
     value: -test
@@ -130,6 +131,8 @@ jobs:
         /p:PortableBuild=true
         /p:SkipTests=$(SkipTests)
         /p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
+        /p:TargetArchitecture=${{ parameters.archType }}
+        /p:CrossBuild=${{ eq(parameters.archType, 'arm64') }}
         $(llvmParameter)
 
     - name: BaseJobBuildCommand
@@ -137,6 +140,7 @@ jobs:
         $(Build.SourcesDirectory)/build.sh -ci
         $(BuildAction)
         -configuration $(_BuildConfig)
+        -arch ${{ parameters.archType }}
         $(LiveOverridePathArgs)
         $(CommonMSBuildArgs)
         $(OfficialBuildArg)
@@ -462,7 +466,7 @@ jobs:
         cleanUnpackFolder: false
 
   - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
-    - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
+    - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
       displayName: Install Build Dependencies
 
     - script: |
index 3da0d03..dd4864b 100644 (file)
@@ -57,7 +57,11 @@ jobs:
           - _testScopeArg: -testscope ${{ parameters.testScope }}
 
         - ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}:
-          - _crossBuildPropertyArg: /p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }}
+          - _crossBuildPropertyArg: /p:CrossBuild=${{ or(ne(parameters.crossrootfsDir, ''), and(eq(parameters.osGroup, 'OSX'), eq(parameters.archType, 'arm64'))) }}
+
+        - ${{ if eq(parameters.osGroup, 'OSX') }}:
+          # OSX is currently building on x64, anything else is a cross build
+          - _crossBuildPropertyArg: /p:CrossBuild=${{ ne(parameters.archType, 'x64') }}
 
         - ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, '_musl')) }}:
           - _runtimeOSArg: /p:RuntimeOS=linux-musl
index 820247b..02e1d87 100644 (file)
@@ -77,7 +77,7 @@ jobs:
           - template: /eng/pipelines/common/restore-internal-tools.yml
 
         - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
-          - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
+          - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
             displayName: Install Build Dependencies
 
           - script: |
index d88481e..5e76151 100644 (file)
@@ -33,6 +33,7 @@ jobs:
           - Linux_arm64
           - Linux_musl_arm64
       - ${{ if eq(variables['includeOsxOuterloop'], true) }}:        
+        - OSX_arm64
         - OSX_x64
       jobParameters:
         testGroup: innerloop
@@ -56,6 +57,7 @@ jobs:
           - Linux_musl_x64
           - Linux_musl_arm64
       - ${{ if and(eq(variables['includeOsxOuterloop'], true), eq(variables['isFullMatrix'], true)) }}:
+        - OSX_arm64
         - OSX_x64
       helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
       jobParameters:
@@ -77,6 +79,7 @@ jobs:
           - Linux_x64
           - Linux_musl_x64
         - ${{ if eq(variables['includeOsxOuterloop'], true) }}:
+          - OSX_arm64
           - OSX_x64
         helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
         jobParameters:
@@ -101,4 +104,4 @@ jobs:
           isFullMatrix: ${{ variables['isFullMatrix'] }}
           framework: net48
           runTests: true
-          testScope: outerloop
\ No newline at end of file
+          testScope: outerloop
index e46ca5e..02bcd0c 100644 (file)
@@ -87,7 +87,7 @@ jobs:
     # and FreeBSD builds use a build agent with dependencies
     # preinstalled, so we only need this step for OSX and Windows.
     - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
         displayName: Install native dependencies
     - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
       # Necessary to install python
index 3deef33..8014127 100644 (file)
@@ -49,6 +49,7 @@ stages:
       jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml
       buildConfig: release
       platforms:
+      - OSX_arm64
       - OSX_x64
       - Linux_x64
       - Linux_arm
@@ -172,6 +173,7 @@ stages:
       jobTemplate: /eng/pipelines/libraries/build-job.yml
       buildConfig: Release
       platforms:
+      - OSX_arm64
       - OSX_x64
       - Linux_x64
       - Linux_arm
@@ -214,6 +216,7 @@ stages:
         useOfficialAllConfigurations: true
         buildFullPlatformManifest: true
       platforms:
+      - OSX_arm64
       - OSX_x64
       - Linux_x64
       - Linux_arm
index e953d20..3fc54c1 100644 (file)
@@ -143,6 +143,7 @@ jobs:
     - Linux_musl_arm
     - Linux_musl_arm64
     - Linux_musl_x64
+    - OSX_arm64
     - Windows_NT_x86
     - Windows_NT_x64
     - Windows_NT_arm
@@ -201,6 +202,7 @@ jobs:
     jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml
     buildConfig: release
     platforms:
+    - OSX_arm64
     - OSX_x64
     - Linux_x64
     - Linux_arm
@@ -619,6 +621,7 @@ jobs:
     - Linux_arm64
     - Linux_musl_x64
     - Linux_x64
+    - OSX_arm64
     - OSX_x64
     - Windows_NT_x64
     - FreeBSD_x64
@@ -705,6 +708,7 @@ jobs:
   parameters:
     buildConfig: Release
     platforms:
+      - OSX_arm64
       - OSX_x64
       - Linux_x64
       - Linux_arm64