From 2da2557363b632b72a4a4f6cb8baf279244c2e42 Mon Sep 17 00:00:00 2001 From: Gary Verhaegen Date: Tue, 16 Aug 2022 07:54:58 +0200 Subject: [PATCH] ci: enable M1 CI node (#14622) CHANGELOG_BEGIN CHANGELOG_END --- build.sh | 12 ++++++++--- ci/build.yml | 46 +++++++++---------------------------------- ci/job-variables.yml | 2 +- ci/macOS.yml | 47 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 41 deletions(-) create mode 100644 ci/macOS.yml diff --git a/build.sh b/build.sh index decd280404..8ea22da690 100755 --- a/build.sh +++ b/build.sh @@ -28,8 +28,14 @@ if [ -n "$SANDBOX_PID" ]; then echo $SANDBOX_PID | xargs kill fi +if [ "$1" = "_m1" ]; then + bazel="arch -arm64 bazel" +else + bazel=bazel +fi + # Bazel test only builds targets that are dependencies of a test suite so do a full build first. -bazel build //... \ +$bazel build //... \ --build_tag_filters "$tag_filter" \ --profile build-profile.json \ --experimental_profile_include_target_label \ @@ -68,7 +74,7 @@ stop_postgresql # in case it's running from a previous build start_postgresql # Run the tests. -bazel test //... \ +$bazel test //... \ --build_tag_filters "$tag_filter" \ --test_tag_filters "$tag_filter" \ --test_env "POSTGRESQL_HOST=${POSTGRESQL_HOST}" \ @@ -82,7 +88,7 @@ bazel test //... \ --experimental_execution_log_file "$ARTIFACT_DIRS/logs/test_execution${execution_log_postfix}.log" # Make sure that Bazel query works. -bazel query 'deps(//...)' >/dev/null +$bazel query 'deps(//...)' >/dev/null # Check that we can load damlc in ghci # Disabled on darwin since it sometimes seem to hang and this only diff --git a/ci/build.yml b/ci/build.yml index 40918334e5..88f026496d 100644 --- a/ci/build.yml +++ b/ci/build.yml @@ -104,43 +104,15 @@ jobs: trigger_sha: '$(trigger_sha)' - template: report-end.yml -- job: macOS - dependsOn: - - check_for_release - timeoutInMinutes: 360 - pool: - name: macOS-pool - demands: assignment -equals default - variables: - - name: release_sha - value: $[ dependencies.check_for_release.outputs['out.release_sha'] ] - - name: release_tag - value: $[ coalesce(dependencies.check_for_release.outputs['out.release_tag'], '0.0.0') ] - - name: trigger_sha - value: $[ dependencies.check_for_release.outputs['out.trigger_sha'] ] - - name: is_release - value: $[ dependencies.check_for_release.outputs['out.is_release'] ] - - template: job-variables.yml - steps: - - template: report-start.yml - - template: clear-shared-segments-macos.yml - - checkout: self - - bash: | - set -euo pipefail - git checkout $(release_sha) - name: checkout_release - condition: and(succeeded(), eq(variables.is_release, 'true')) - - template: clean-up.yml - - template: build-unix.yml - parameters: - release_tag: $(release_tag) - name: macos - is_release: variables.is_release - - template: upload-bazel-metrics.yml - - template: tell-slack-failed.yml - parameters: - trigger_sha: '$(trigger_sha)' - - template: report-end.yml +- template: macOS.yml + parameters: + name: macOS + assignment: default + +- template: macOS.yml + parameters: + name: m1 + assignment: m1-builds - job: Windows dependsOn: diff --git a/ci/job-variables.yml b/ci/job-variables.yml index c2f48854fb..bdea9fa484 100644 --- a/ci/job-variables.yml +++ b/ci/job-variables.yml @@ -5,7 +5,7 @@ variables: - name: pipeline_timestamp value: $[ format('{0:yyyy}-{0:MM}-{0:dd}T{0:HH}:{0:mm}:{0:ss}.{0:fffffff}', pipeline.startTime) ] - name: pipeline_id - value: $(pipeline_timestamp)-$(System.JobDisplayName)-$(System.JobId)-$(System.JobAttempt) + value: $(pipeline_timestamp)-$(System.JobName)-$(System.JobId)-$(System.JobAttempt) - name: git_branch_sha value: $[ dependencies.git_sha.outputs['out.branch'] ] - name: git_main_sha diff --git a/ci/macOS.yml b/ci/macOS.yml new file mode 100644 index 0000000000..59eda9e924 --- /dev/null +++ b/ci/macOS.yml @@ -0,0 +1,47 @@ +# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +parameters: +- name: name +- name: assignment + +jobs: +- job: ${{parameters.name}} + dependsOn: + - check_for_release + timeoutInMinutes: 360 + pool: + name: macOS-pool + demands: assignment -equals ${{parameters.assignment}} + condition: or(eq('${{parameters.name}}', 'macOS'), + eq(variables['Build.SourceBranchName'], 'main')) + variables: + - name: release_sha + value: $[ dependencies.check_for_release.outputs['out.release_sha'] ] + - name: release_tag + value: $[ coalesce(dependencies.check_for_release.outputs['out.release_tag'], '0.0.0') ] + - name: trigger_sha + value: $[ dependencies.check_for_release.outputs['out.trigger_sha'] ] + - name: is_release + value: $[ dependencies.check_for_release.outputs['out.is_release'] ] + - template: job-variables.yml + steps: + - template: report-start.yml + - template: clear-shared-segments-macos.yml + - checkout: self + - bash: | + set -euo pipefail + git checkout $(release_sha) + name: checkout_release + condition: and(succeeded(), eq(variables.is_release, 'true')) + - template: clean-up.yml + - template: build-unix.yml + parameters: + release_tag: $(release_tag) + name: ${{parameters.name}} + is_release: variables.is_release + - template: upload-bazel-metrics.yml + - template: tell-slack-failed.yml + parameters: + trigger_sha: '$(trigger_sha)' + - template: report-end.yml