daml/sdk/ci/build-release.sh
Gary Verhaegen 7c83265ef9
[release] faster releases - experiment (#18812)
When we build a release, it is always a "past" commit - typically, one
that has already been tested twice: once when the corresponding PR was
run, and then again as a "main"-branch commit.

Release branches don't run, but their protection rules enforce linear
merges.

Either way, we know we're building a _good_ commit, and, assuming our
builds and tests are hermetic, testing that commit again when we make a
release is a pure waste of time and CPU resources.

The other case, where we make an ad-hoc release from a branch that has
not been merged, has a similar issue: we do not necessarily want to run
the full test suite, because part of the reason we need that commit may
be that it doesn't succeed as is.

Based on that observation, I wondered what might be the minimal set of
things we actually need to build when making a release. This PR is an
experiment in trying to find that out.
2024-03-27 12:06:39 +01:00

51 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $DIR/..
execution_log_postfix=${1:-}${2:-}
export LC_ALL=en_US.UTF-8
ARTIFACT_DIRS="${BUILD_ARTIFACTSTAGINGDIRECTORY:-$PWD}"
mkdir -p "${ARTIFACT_DIRS}/logs"
if [ "${1:-}" = "_m1" ]; then
bazel="arch -arm64 bazel"
else
bazel=bazel
fi
if [ "$(uname)-$(uname -m)" = "Linux-x86_64" ]; then
# These are platform-independent so we only need to build them once
extra_build_targets="//release:protobufs \
//daml-script/runner:daml-script-binary_distribute.jar \
//daml-script/daml:daml-script-dars \
//daml-script/daml3:daml3-script-dars \
//docs:sphinx-source-tree \
//docs:pdf-fonts-tar \
//docs:non-sphinx-html-docs \
//docs:sphinx-source-tree-deps \
//test-evidence:generate-security-test-evidence-files"
else
extra_build_targets=
fi
$bazel build \
//compiler/damlc/tests:platform-independence.dar \
//release:sdk-release-tarball-ce \
//release:sdk-release-tarball-ee \
//compiler/damlc:damlc-dist \
//release:protobufs \
$extra_build_targets \
--profile build-profile.json \
--experimental_profile_include_target_label \
--build_event_json_file build-events.json \
--build_event_publish_all_actions \
--execution_log_json_file "$ARTIFACT_DIRS/logs/build_execution${execution_log_postfix}.json.gz"