daml/compatibility/BUILD
Moritz Kiefer 34ae06414e
Speed-up create-daml-app compat tests (#6087)
Previously we ran `daml codegen js` and `daml build` in the tests and
we also ran it twice. While this makes sense for the SDK integration
tests, it doesn’t really make sense for the compatibility tests. These
are SDK-only features so they don’t actually test compatibility. These
steps are super slow and running them in the tests also means that we
run them a quadratic number of times.

This PR moves the `daml build` and the `daml codegen js` step to
separate genrules. In the actual test, the only expensive steps are to
run `yarn install` and the actual jest tests. In principle, we could
probably try to factor out the `yarn install` step as well but I’m a
bit scared of coyping around node_modules so I’ll not attempt to do
that for now.

changelog_begin
changelog_end
2020-05-25 16:25:10 +02:00

96 lines
2.6 KiB
Python

# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("@bazel_skylib//lib:versions.bzl", "versions")
load("@os_info//:os_info.bzl", "is_windows")
load("//bazel_tools:testing.bzl", "create_daml_app_codegen", "create_daml_app_dar", "sdk_platform_test")
load(
"//bazel_tools/daml_script:daml_script.bzl",
"daml_script_dar",
"daml_script_test",
)
load("//sandbox-migration:util.bzl", "migration_test")
load("//:versions.bzl", "platform_versions", "sdk_versions", "stable_versions")
load("@daml//bazel_tools:haskell.bzl", "da_haskell_binary")
config_setting(
name = "ghci_data",
define_values = {
"ghci_data": "True",
},
)
[
sh_binary(
name = "sandbox-with-postgres-{}".format(version),
srcs = ["@//bazel_tools:sandbox-with-postgres.sh"],
data = [
"@//bazel_tools/client_server/with-postgres:with-postgres-exe",
"@daml-sdk-{}//:daml".format(version),
],
deps = ["@bazel_tools//tools/bash/runfiles"],
)
for version in platform_versions
]
[
[
create_daml_app_dar(sdk_version),
create_daml_app_codegen(sdk_version),
]
for sdk_version in sdk_versions
]
[
sdk_platform_test(
platform_version = platform_version,
sdk_version = sdk_version,
)
for sdk_version in sdk_versions
for platform_version in platform_versions
]
[
daml_script_dar(sdk_version)
for sdk_version in sdk_versions
]
[
daml_script_test(
compiler_version = sdk_version,
runner_version = platform_version,
)
for sdk_version in sdk_versions
for platform_version in platform_versions
# Test that the DAML script runner can run DARs built with an older SDK
# version. I.e. where the runner version is at least the SDK version or
# more recent. The HEAD version 0.0.0 is a special case.
if versions.is_at_least(sdk_version, platform_version) and sdk_version != "0.0.0" or
platform_version == "0.0.0"
]
test_suite(
name = "head-quick",
tags = ["head-quick"],
)
# We have two migration tests: migration-stable runs through all stable releases
# including current HEAD. migration-all includes snapshot releases.
migration_test(
name = "migration-stable",
# Exclusive due to hardcoded postgres ports.
tags = [
"exclusive",
"head-quick",
],
versions = stable_versions,
) if not is_windows else None
migration_test(
name = "migration-all",
# Exclusive due to hardcoded postgres ports.
tags = ["exclusive"],
versions = platform_versions,
) if not is_windows else None