mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
fef712bf60
CHANGELOG_BEGIN - Our Linux binaries are now built on Ubuntu 20.04 instead of 16.04. We do not expect any user-level impact, but please reach out if you do notice any issue that might be caused by this. CHANGELOG_END
161 lines
5.5 KiB
YAML
161 lines
5.5 KiB
YAML
# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
trigger: none
|
|
|
|
pr:
|
|
autoCancel: true # cancel previous builds on push
|
|
branches:
|
|
include:
|
|
- main
|
|
- release/*
|
|
|
|
jobs:
|
|
- template: build.yml
|
|
|
|
- job: check_standard_change_label
|
|
dependsOn:
|
|
- git_sha
|
|
variables:
|
|
fork_sha: $[ dependencies.git_sha.outputs['out.fork_point'] ]
|
|
branch_sha: $[ dependencies.git_sha.outputs['out.branch'] ]
|
|
condition: eq(variables['Build.Reason'], 'PullRequest')
|
|
pool:
|
|
name: 'ubuntu_20_04'
|
|
demands: assignment -equals default
|
|
steps:
|
|
- checkout: self
|
|
- bash: |
|
|
set -euo pipefail
|
|
|
|
has_changed () {
|
|
git diff $(fork_sha) $(branch_sha) --name-only | grep -q "^$1"
|
|
}
|
|
|
|
fail_if_missing_std_change_label () {
|
|
curl https://api.github.com/repos/digital-asset/daml/pulls/$PR -s | jq -r '.labels[].name' | grep -q '^Standard-Change$'
|
|
}
|
|
|
|
if has_changed "infra/" || has_changed "LATEST"; then
|
|
fail_if_missing_std_change_label
|
|
fi
|
|
env:
|
|
PR: $(System.PullRequest.PullRequestNumber)
|
|
|
|
- job: check_changelog_entry
|
|
dependsOn:
|
|
- git_sha
|
|
variables:
|
|
fork_sha: $[ dependencies.git_sha.outputs['out.fork_point'] ]
|
|
branch_sha: $[ dependencies.git_sha.outputs['out.branch'] ]
|
|
pr.num: $[ variables['System.PullRequest.PullRequestNumber'] ]
|
|
condition: eq(variables['Build.Reason'], 'PullRequest')
|
|
pool:
|
|
name: 'ubuntu_20_04'
|
|
demands: assignment -equals default
|
|
steps:
|
|
- checkout: self
|
|
- template: bash-lib.yml
|
|
parameters:
|
|
var_name: bash-lib
|
|
- bash: |
|
|
set -euo pipefail
|
|
source $(bash-lib)
|
|
git checkout $(branch_sha)
|
|
if ci/check-changelog.sh $(fork_sha); then
|
|
exit 0
|
|
else
|
|
user=$(user_slack_handle $(branch_sha))
|
|
if [ "$user" != "" ]; then
|
|
tell_slack "<@${user}> <https://dev.azure.com/digitalasset/daml/_build/results?buildId=$(Build.BuildId)|Build $(Build.BuildId)> for <https://github.com/digital-asset/daml/pull/$(pr.num)|PR $(pr.num)> is missing a changelog entry." \
|
|
"$(Slack.team-daml-ci)"
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
# required for collect_build_data
|
|
- job: release
|
|
condition: false
|
|
|
|
- job: notify_release_pr
|
|
condition: and(not(canceled()),
|
|
startsWith(variables['Build.SourceBranchName'], 'auto-release-pr-'),
|
|
eq(dependencies.check_for_release.outputs['out.is_release'], 'true'))
|
|
dependsOn:
|
|
- git_sha
|
|
- collect_build_data
|
|
- check_for_release
|
|
pool:
|
|
name: 'ubuntu_20_04'
|
|
demands: assignment -equals default
|
|
variables:
|
|
branch_sha: $[ dependencies.git_sha.outputs['out.branch'] ]
|
|
status: $[ dependencies.collect_build_data.result ]
|
|
is_release: $[ dependencies.check_for_release.outputs['out.is_release'] ]
|
|
steps:
|
|
- checkout: self
|
|
persistCredentials: true
|
|
- template: bash-lib.yml
|
|
parameters:
|
|
var_name: bash-lib
|
|
- bash: |
|
|
set -euo pipefail
|
|
|
|
source $(bash-lib)
|
|
|
|
AUTH="$(get_gh_auth_header)"
|
|
PR=$(curl -H "$AUTH" \
|
|
-H "Accept: application/vnd.github.groot-preview+json" \
|
|
-s -f \
|
|
"https://api.github.com/repos/digital-asset/daml/commits/$(git rev-parse HEAD)/pulls" \
|
|
| jq '.[0].number' \
|
|
|| echo "")
|
|
# Note: if we somehow fail to resolve the PR number from the GitHub
|
|
# API, there is still value in getting the notification on Slack, as
|
|
# we do have the build number and from there we can click through to
|
|
# the PR. Hence the `|| echo ""`.
|
|
PR_HANDLER=$(head -1 release/rotation | awk '{print $1}')
|
|
|
|
case "$(status)" in
|
|
Succeeded*)
|
|
msg="has succeeded! Next step is to approve & merge."
|
|
;;
|
|
Failed*)
|
|
msg="has failed. Please investigate."
|
|
;;
|
|
*)
|
|
# Should not be reached, but who knows?
|
|
msg="has completed with status $(status). See <https://github.com/digital-asset/daml/blob/main/release/RELEASE.md|RELEASE.md> for what to do next."
|
|
;;
|
|
esac
|
|
tell_slack "<@${PR_HANDLER}> <https://dev.azure.com/digitalasset/daml/_build/results?buildId=$(Build.BuildId)|Build $(Build.BuildId)> for release PR <https://github.com/digital-asset/daml/pull/${PR}|#${PR}> $msg"
|
|
|
|
- job: notify_user
|
|
condition: and(eq(variables['Build.Reason'], 'PullRequest'), not(canceled()))
|
|
dependsOn:
|
|
- git_sha
|
|
- collect_build_data
|
|
- check_for_release
|
|
- check_changelog_entry
|
|
pool:
|
|
name: 'ubuntu_20_04'
|
|
demands: assignment -equals default
|
|
variables:
|
|
pr.num: $[ variables['System.PullRequest.PullRequestNumber'] ]
|
|
branch_sha: $[ dependencies.git_sha.outputs['out.branch'] ]
|
|
build_status: $[ dependencies.collect_build_data.result ]
|
|
changelog_status: $[ dependencies.check_changelog_entry.result ]
|
|
steps:
|
|
- template: bash-lib.yml
|
|
parameters:
|
|
var_name: bash-lib
|
|
- bash: |
|
|
set -euo pipefail
|
|
source $(bash-lib)
|
|
|
|
user=$(user_slack_handle $(branch_sha))
|
|
if [ "$user" != "" ]; then
|
|
tell_slack "<@${user}> <https://dev.azure.com/digitalasset/daml/_build/results?buildId=$(Build.BuildId)|Build $(Build.BuildId)> for <https://github.com/digital-asset/daml/pull/$(pr.num)|PR $(pr.num)> has completed with status $(build_status) (changelog: $(changelog_status))." \
|
|
"$(Slack.team-daml-ci)"
|
|
fi
|