Test that canton 3.x builds with bazel hourly (#17876)

* introduce a canton2 directory

* rename to canton-3x and only keep the bazel rules

* add canton-3x to bazelignore

* fix visibility rules

* add a build-canton-3x script

* add build-canton-3x.sh temporarily to prs.yml to test it out

* try sending a message to stack when failing

* backport 243125adee

* restore prs.yml and add the job to azure-cron.yml

* restore tell-slack-failed condition

* address comments

* display the revision at which canton was cloned, to ease debugging
This commit is contained in:
Paul Brauner 2023-11-23 08:54:35 +01:00 committed by GitHub
parent fc03cef4d6
commit 18e0e9e656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1172 additions and 4 deletions

View File

@ -7,3 +7,4 @@ language-support/ts/node_modules/
language-support/ts/packages/node_modules/
navigator/frontend/node_modules/
compatibility/
canton-3x/

View File

@ -4,7 +4,7 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: '^canton/'
exclude: '^canton(-3x)?/'
repos:
- repo: local
hooks:

View File

@ -27,3 +27,4 @@ navigator/frontend/src/ui-core/src/api/Queries.ts
# ignore canton code drop
canton
canton-3x

View File

@ -16,5 +16,7 @@ newlines.topLevelStatementBlankLines = [
# to not get more than we want.
project.excludePaths = [
"glob:**/canton/community/**/*.{scala,sc}",
"glob:**/canton/daml-common-staging/**/*.{scala,sc}"
"glob:**/canton/daml-common-staging/**/*.{scala,sc}",
"glob:**/canton-3x/community/**/*.{scala,sc}",
"glob:**/canton-3x/daml-common-staging/**/*.{scala,sc}"
]

View File

@ -211,3 +211,15 @@ jobs:
- template: ci/tell-slack-failed.yml
- template: ci/refresh-get-daml-com.yml
- job: build_canton_3x_with_bazel
timeoutInMinutes: 120
pool:
name: 'ubuntu_20_04'
demands: assignment -equals default
steps:
- checkout: self
- bash: ci/build-canton-3x.sh
env:
GITHUB_TOKEN: $(CANTON_READONLY_TOKEN)
- template: ci/tell-slack-failed.yml

1115
canton-3x/BUILD.bazel Normal file

File diff suppressed because it is too large Load Diff

View File

1
canton-3x/shade_rule Normal file
View File

@ -0,0 +1 @@
zap org.apache.pekko.stream.scaladsl.BroadcastHub*

32
ci/build-canton-3x.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# Copyright (c) 2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
eval "$(./dev-env/bin/dade-assist)"
tmp=$(mktemp -d)
trap 'rm -rf ${tmp}' EXIT
if [ -z "${GITHUB_TOKEN:-}" ]; then
repo_url="git@github.com:DACH-NY/canton.git"
else
repo_url="https://$GITHUB_TOKEN@github.com/DACH-NY/canton"
fi
git clone --depth 1 --branch main $repo_url $tmp
head=$(git -C $tmp rev-parse HEAD)
echo "cloned at revision $head"
for path in community daml-common-staging; do
src=$tmp/$path
dst=canton-3x/$path
rm -rf $dst
mkdir -p $(dirname $dst)
cp -rf $src $dst
git add $dst
done
sed -i 's/canton-3x\///' .bazelignore
bazel build //canton-3x/...

View File

@ -23,6 +23,7 @@ steps:
-H 'Content-type: application/json' \
--data "{\"text\":\"$WARNING\n\"}" \
$(Slack.ci-failures-daml)
name: tell_slack_failed
condition: and(failed(),
or(eq(variables['Build.SourceBranchName'], 'main'),
startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')))

View File

@ -29,6 +29,7 @@ da_scala_library(
tags = ["maven_coordinates=com.daml:daml-lf-api-type-signature:__VERSION__"],
visibility = [
"//canton:__subpackages__",
"//canton-3x:__subpackages__",
"//daml-assistant/daml-sdk:__subpackages__",
"//daml-lf:__subpackages__",
"//daml-script:__subpackages__",

View File

@ -29,6 +29,7 @@ da_scala_library(
tags = ["maven_coordinates=com.daml:daml-lf-interpreter:__VERSION__"],
visibility = [
"//canton:__subpackages__",
"//canton-3x:__subpackages__",
"//compiler/repl-service:__subpackages__",
"//compiler/scenario-service:__subpackages__",
"//daml-lf:__subpackages__",

View File

@ -21,6 +21,7 @@ da_scala_library(
tags = ["maven_coordinates=com.daml:daml-lf-validation:__VERSION__"],
visibility = [
"//canton:__subpackages__",
"//canton-3x:__subpackages__",
"//compiler/scenario-service:__subpackages__",
"//daml-lf:__subpackages__",
# TODO https://github.com/digital-asset/daml/issues/15453

4
fmt.sh
View File

@ -49,7 +49,7 @@ check_diff() {
# $1 merge_base
# $2 regex
# "${@:3}" command
changed_files=$(git diff --name-only --diff-filter=ACMRT "$1" | grep $2 | grep -v '^canton/' || [[ $? == 1 ]])
changed_files=$(git diff --name-only --diff-filter=ACMRT "$1" | grep $2 | grep -E -v '^canton(-3x)?/' || [[ $? == 1 ]])
if [[ -n "$changed_files" ]]; then
run "${@:3}" ${changed_files[@]:-}
else
@ -147,7 +147,7 @@ if [ "$diff_mode" = "true" ]; then
check_diff $merge_base '\.\(ts\|tsx\)$' run_pprettier ${prettier_args[@]:-}
else
run hlint -j4 --git
java_files=$(find . -name "*.java" | grep -v '^\./canton')
java_files=$(find . -name "*.java" | grep -E -v '^\./canton(-3x)?')
if [[ -z "$java_files" ]]; then
echo "Unexpected: no Java file in the repository"
exit 1