# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 parameters: is_release: '' name_str: '' name_exp: '' release_tag: '' scala_version: '' test_mode: '' steps: - bash: | set -euo pipefail major=$(cat sdk/NIGHTLY_PREFIX | awk -F. '{print $1}') minor=$(cat sdk/NIGHTLY_PREFIX | awk -F. '{print $2}') setvar() { echo "Setting '$1' to '$2'" echo "##vso[task.setvariable variable=$1]$2" } if ([ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]) \ && ([ "$major" = "2" ] && [ "$minor" -lt "9" ]); then setvar skip true else setvar skip false fi - bash: ci/dev-env-install.sh displayName: 'Build/Install the Developer Environment' condition: and(succeeded(), eq(variables.skip, 'false'), or(eq(${{parameters.is_release}}, 'false'), ne(${{parameters.name_exp}}, 'm1'))) - bash: | cd sdk source dev-env/lib/ensure-nix ci/dev-env-push.py displayName: 'Push Developer Environment build results' condition: and(succeeded(), eq(variables.skip, 'false'), eq(variables['System.PullRequest.IsFork'], 'False'), or(eq(${{parameters.is_release}}, 'false'), ne(${{parameters.name_exp}}, 'm1'))) env: # to upload to the Nix cache GOOGLE_APPLICATION_CREDENTIALS_CONTENT: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT) NIX_SECRET_KEY_CONTENT: $(NIX_SECRET_KEY_CONTENT) - bash: | ci/configure-bazel.sh displayName: 'Configure Bazel' env: IS_FORK: $(System.PullRequest.IsFork) # to upload to the bazel cache GOOGLE_APPLICATION_CREDENTIALS_CONTENT: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT) condition: and(succeeded(), eq(variables.skip, 'false'), or(eq(${{parameters.is_release}}, 'false'), ne(${{parameters.name_exp}}, 'm1'))) - bash: | sdk/fmt.sh --test displayName: 'Platform-agnostic lints and checks' condition: and(succeeded(), eq(variables.skip, 'false'), eq(${{parameters.name_exp}}, 'linux-intel')) - bash: | rm -rf sdk/bazel-testlogs/ displayName: delete old logs condition: and(succeeded(), eq(variables.skip, 'false')) - bash: | set -euo pipefail cd sdk eval "$(dev-env/bin/dade-assist)" p="_${{parameters.name_str}}" a="_$(Build.BuildNumber)_$(System.JobAttempt)" t="${{parameters.test_mode}}" ./build.sh $p $a $t displayName: 'Build' env: DAML_SDK_RELEASE_VERSION: ${{parameters.release_tag}} DAML_SCALA_VERSION: ${{parameters.scala_version}} ARTIFACTORY_USERNAME: $(ARTIFACTORY_USERNAME) ARTIFACTORY_PASSWORD: $(ARTIFACTORY_PASSWORD) IS_FORK: $(System.PullRequest.IsFork) condition: and(succeeded(), eq(variables.skip, 'false'), or(eq(${{parameters.is_release}}, 'false'), ne(${{parameters.name_exp}}, 'm1'))) # Do not publish dar from m1 - ${{ if ne(parameters.name_exp, 'm1') }}: - template: publish-platform-independence-dar.yml parameters: platform: ${{parameters.name_str}} is_release: ${{parameters.is_release}} - task: PublishBuildArtifacts@1 condition: and(succeededOrFailed(), eq(variables.skip, 'false'), or(eq(${{parameters.is_release}}, 'false'), ne(${{parameters.name_exp}}, 'm1'))) continueOnError: true inputs: pathtoPublish: '$(Build.StagingDirectory)/logs' artifactName: 'Bazel Logs' - task: PublishBuildArtifacts@1 condition: and(failed(), eq(variables.skip, 'false'), or(eq(${{parameters.is_release}}, 'false'), ne(${{parameters.name_exp}}, 'm1'))) displayName: 'Publish the bazel test logs' inputs: pathtoPublish: 'sdk/bazel-testlogs/' artifactName: 'Test logs ${{parameters.name_str}}' - bash: | set -euo pipefail cd sdk eval "$(./dev-env/bin/dade-assist)" ./bazel-bin/release/release --release-dir "$(mktemp -d)" --upload env: DAML_SDK_RELEASE_VERSION: ${{parameters.release_tag}} DAML_SCALA_VERSION: ${{parameters.scala_version}} GPG_KEY: $(gpg-code-signing) MAVEN_USERNAME: $(MAVEN_USERNAME) MAVEN_PASSWORD: $(MAVEN_PASSWORD) MAVEN_URL: "https://s01.oss.sonatype.org" NPM_TOKEN: $(NPM_TOKEN) name: publish_npm_mvn condition: and(succeeded(), eq(variables.skip, 'false'), eq(${{parameters.is_release}}, 'true'), eq(${{parameters.name_exp}}, 'linux-intel'), in(variables['Build.SourceBranchName'], 'main', 'main-2.x')) - template: bash-lib.yml parameters: var_name: bash-lib condition: and(succeeded(), eq(variables.skip, 'false'), or(eq(${{parameters.is_release}}, 'false'), ne(${{parameters.name_exp}}, 'm1'))) - bash: | set -euo pipefail cd sdk mkdir -p $(Build.StagingDirectory)/release eval "$(dev-env/bin/dade-assist)" ./ci/copy-unix-release-artifacts.sh ${{parameters.release_tag}} ${{parameters.name_str}} $(Build.StagingDirectory)/release env: DAML_SDK_RELEASE_VERSION: ${{parameters.release_tag}} name: publish condition: and(succeeded(), eq(variables.skip, 'false'), ne(${{parameters.name_exp}}, 'm1'), eq(${{parameters.is_release}}, 'true'), in(variables['Build.SourceBranchName'], 'main', 'main-2.x')) - task: PublishPipelineArtifact@0 inputs: targetPath: $(Build.StagingDirectory)/release artifactName: ${{parameters.name_str}}-release condition: and(succeeded(), eq(variables.skip, 'false'), ne(${{parameters.name_exp}}, 'm1'), eq(${{parameters.is_release}}, 'true'), in(variables['Build.SourceBranchName'], 'main', 'main-2.x'))