daml/ci/build-unix.yml
Gary Verhaegen 179d85362d
update copyright (#18167)
* update copyright

* undo hack from #18168

* update hash in platform-independence-pre-check
2024-01-15 20:27:42 +01:00

141 lines
5.2 KiB
YAML

# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
parameters:
is_release: ''
name: ''
release_tag: ''
scala_version: ''
test_mode: ''
steps:
- bash: ci/dev-env-install.sh
displayName: 'Build/Install the Developer Environment'
condition: and(succeeded(),
or(eq(${{parameters.is_release}}, 'false'),
ne('${{parameters.name}}', 'm1')))
- bash: |
source dev-env/lib/ensure-nix
ci/dev-env-push.py
displayName: 'Push Developer Environment build results'
condition: and(succeeded(),
eq(variables['System.PullRequest.IsFork'], 'False'),
or(eq(${{parameters.is_release}}, 'false'),
ne('${{parameters.name}}', '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(),
or(eq(${{parameters.is_release}}, 'false'),
ne('${{parameters.name}}', 'm1')))
- bash: ./fmt.sh --test
displayName: 'Platform-agnostic lints and checks'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- bash: |
set -euo pipefail
if [ -e bazel-testlogs ]; then
rm -rf bazel-testlogs/
fi
displayName: delete old logs
- bash: |
set -euo pipefail
p="_${{parameters.name}}"
a="_$(Build.BuildNumber)_$(System.JobAttempt)"
t="${{parameters.test_mode}}"
if [ "$p" == "_m1" ]; then
./build.sh $p $a $t || ./build.sh $p $a $t || ./build.sh $p $a $t || ./build.sh $p $a $t
else
./build.sh $p $a $t
fi
displayName: 'Build'
env:
DAML_SDK_RELEASE_VERSION: ${{parameters.release_tag}}
DAML_SCALA_VERSION: ${{parameters.scala_version}}
ARTIFACTORY_USERNAME: $(ARTIFACTORY_USERNAME)
ARTIFACTORY_PASSWORD: $(ARTIFACTORY_PASSWORD)
condition: and(succeeded(),
or(eq(${{parameters.is_release}}, 'false'),
ne('${{parameters.name}}', 'm1')))
# Do not publish dar from m1
- ${{ if ne(parameters.name, 'm1') }}:
- template: publish-platform-independence-dar.yml
parameters:
platform: '${{parameters.name}}'
is_release: '${{parameters.is_release}}'
- task: PublishBuildArtifacts@1
condition: and(succeededOrFailed(),
or(eq(${{parameters.is_release}}, 'false'),
ne('${{parameters.name}}', 'm1')))
continueOnError: true
inputs:
pathtoPublish: '$(Build.StagingDirectory)/logs'
artifactName: 'Bazel Logs'
- task: PublishBuildArtifacts@1
condition: and(failed(),
or(eq(${{parameters.is_release}}, 'false'),
ne('${{parameters.name}}', 'm1')))
displayName: 'Publish the bazel test logs'
inputs:
pathtoPublish: 'bazel-testlogs/'
artifactName: 'Test logs ${{parameters.name}}'
- bash: |
set -euo pipefail
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(${{parameters.is_release}}, 'true'),
eq('${{parameters.scala_version}}', ''),
in(variables['Build.SourceBranchName'], 'main', 'main-2.x'),
in('${{parameters.name}}', 'linux', 'linux-scala-2.12'))
- template: bash-lib.yml
parameters:
var_name: bash-lib
condition: and(succeeded(),
or(eq(${{parameters.is_release}}, 'false'),
ne('${{parameters.name}}', 'm1')))
- bash: |
set -euo pipefail
eval "$(./dev-env/bin/dade-assist)"
mkdir -p $(Build.StagingDirectory)/release
./ci/copy-unix-release-artifacts.sh ${{parameters.release_tag}} ${{parameters.name}} $(Build.StagingDirectory)/release
env:
DAML_SDK_RELEASE_VERSION: ${{parameters.release_tag}}
name: publish
condition: and(succeeded(),
ne('${{parameters.name}}', '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}}-release
condition: and(succeeded(),
ne('${{parameters.name}}', 'm1'),
eq(${{parameters.is_release}}, 'true'),
in(variables['Build.SourceBranchName'], 'main', 'main-2.x'))