2022-01-04 18:32:17 +03:00
|
|
|
# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
2020-04-23 13:58:11 +03:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2021-11-23 17:00:50 +03:00
|
|
|
load("@os_info//:os_info.bzl", "is_windows")
|
2021-02-26 15:47:59 +03:00
|
|
|
load("//bazel_tools:testing.bzl", "create_daml_app_codegen", "create_daml_app_dar", "daml_lf_compatible", "sdk_platform_test")
|
2020-05-05 13:33:32 +03:00
|
|
|
load(
|
|
|
|
"//bazel_tools/daml_script:daml_script.bzl",
|
|
|
|
"daml_script_dar",
|
|
|
|
"daml_script_test",
|
|
|
|
)
|
2020-05-27 15:32:37 +03:00
|
|
|
load(
|
|
|
|
"//bazel_tools/daml_trigger:daml_trigger.bzl",
|
|
|
|
"daml_trigger_dar",
|
|
|
|
"daml_trigger_test",
|
|
|
|
)
|
2020-06-12 10:48:53 +03:00
|
|
|
load(
|
|
|
|
"//bazel_tools/data_dependencies:data_dependencies.bzl",
|
|
|
|
"data_dependencies_coins",
|
2020-06-12 20:21:00 +03:00
|
|
|
"data_dependencies_upgrade_test",
|
2020-06-12 10:48:53 +03:00
|
|
|
)
|
2020-05-27 15:32:37 +03:00
|
|
|
load("//bazel_tools:versions.bzl", "versions")
|
2020-05-05 15:46:58 +03:00
|
|
|
load("//sandbox-migration:util.bzl", "migration_test")
|
2020-05-05 20:40:03 +03:00
|
|
|
load("//:versions.bzl", "platform_versions", "sdk_versions", "stable_versions")
|
2020-05-25 17:25:10 +03:00
|
|
|
load("@daml//bazel_tools:haskell.bzl", "da_haskell_binary")
|
2020-04-23 13:58:11 +03:00
|
|
|
|
2020-04-24 15:04:14 +03:00
|
|
|
config_setting(
|
|
|
|
name = "ghci_data",
|
|
|
|
define_values = {
|
|
|
|
"ghci_data": "True",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2020-04-24 13:08:32 +03:00
|
|
|
[
|
|
|
|
sh_binary(
|
|
|
|
name = "sandbox-with-postgres-{}".format(version),
|
|
|
|
srcs = ["@//bazel_tools:sandbox-with-postgres.sh"],
|
2020-06-19 16:55:39 +03:00
|
|
|
args = ["sandbox"],
|
2020-04-24 15:04:14 +03:00
|
|
|
data = [
|
2020-05-05 15:46:58 +03:00
|
|
|
"@//bazel_tools/client_server/with-postgres:with-postgres-exe",
|
2020-04-24 15:04:14 +03:00
|
|
|
"@daml-sdk-{}//:daml".format(version),
|
2022-01-13 17:47:04 +03:00
|
|
|
] + ([
|
|
|
|
"@daml-sdk-{}//:sandbox-on-x".format(version),
|
|
|
|
] if versions.is_at_least("2.0.0", version) else []),
|
2020-04-24 13:08:32 +03:00
|
|
|
deps = ["@bazel_tools//tools/bash/runfiles"],
|
2020-04-24 15:04:14 +03:00
|
|
|
)
|
|
|
|
for version in platform_versions
|
2020-04-24 13:08:32 +03:00
|
|
|
]
|
|
|
|
|
2020-05-25 17:25:10 +03:00
|
|
|
[
|
|
|
|
[
|
|
|
|
create_daml_app_dar(sdk_version),
|
|
|
|
create_daml_app_codegen(sdk_version),
|
|
|
|
]
|
|
|
|
for sdk_version in sdk_versions
|
|
|
|
]
|
|
|
|
|
2021-02-18 13:58:23 +03:00
|
|
|
# Instead of testing the full cartesian product of all SDK versions with
|
|
|
|
# all platform (~= Sandbox/JSON API) versions, we test the latest version of
|
|
|
|
# each with all versions of the other. This gives us a reasonable feedback
|
|
|
|
# with regards to maintaining backwards-compatibility without causing the
|
|
|
|
# test runs to grow quadratically.
|
|
|
|
head = "0.0.0"
|
|
|
|
|
|
|
|
# Missing on purpose: do not test the latest SDK with the latest platform
|
|
|
|
# That is not a compatibility test, it's just testing the main branch. ;)
|
|
|
|
|
|
|
|
# Test all old platform versions with the latest SDK
|
2020-04-23 15:46:22 +03:00
|
|
|
[
|
|
|
|
sdk_platform_test(
|
|
|
|
platform_version = platform_version,
|
2021-02-18 13:58:23 +03:00
|
|
|
sdk_version = head,
|
|
|
|
)
|
|
|
|
for platform_version in platform_versions
|
2021-02-26 15:47:59 +03:00
|
|
|
if platform_version != head and daml_lf_compatible(head, platform_version)
|
2021-02-18 13:58:23 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
# Test all old SDK versions with the latest platform
|
|
|
|
[
|
|
|
|
sdk_platform_test(
|
|
|
|
platform_version = head,
|
2020-04-24 15:04:14 +03:00
|
|
|
sdk_version = sdk_version,
|
2020-04-23 15:46:22 +03:00
|
|
|
)
|
|
|
|
for sdk_version in sdk_versions
|
2021-02-26 15:47:59 +03:00
|
|
|
if sdk_version != head and daml_lf_compatible(sdk_version, head)
|
2020-04-28 17:06:36 +03:00
|
|
|
]
|
2020-04-24 15:43:35 +03:00
|
|
|
|
2020-05-05 13:33:32 +03:00
|
|
|
[
|
|
|
|
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
|
2020-05-27 15:32:37 +03:00
|
|
|
# more recent.
|
|
|
|
if versions.is_at_least(sdk_version, platform_version)
|
|
|
|
]
|
|
|
|
|
2020-10-29 16:19:10 +03:00
|
|
|
# Change to `CommandId` generation
|
|
|
|
first_post_7587_trigger_version = "1.7.0-snapshot.20201012.5405.0.af92198d"
|
interpret allowed updates and other actions in a free Trigger monad, like Script (#7456)
* conservatively move daml-script, trigger SValue interpreters to common library
* introduce expect and JavaList pattern for converters
* clean up trigger Converter Command interpretation
* add Church Free monad
* add an action language for trigger updates
* add expectE to remove some of the joins
* convert more of the converters to expect
* tool for unrolling Free/Roll
* split handleStepResult up and clean up its pattern
* handleStepFreeResult to interpret TriggerF
* replace Free Church with Pure/Roll free from Script
* newtype for ActionTrigger
* replace update in low-level Trigger with Free TriggerF
* submit one Commands at a time
* boolean blindness strikes again
* log missed TriggerF steps
* comment actual Submit contents
* match #7501 fromPureSExpr sig change in 00b80b8ea3
* avoid using forwardPort in runTrigger
* push State back into DAML, so it can be excluded from the action list
* push Message back into DAML, unifying the action language for initialState and update
* bringing TriggerF into initial state
* really add TriggerF into initial state, with all ports, tested
* add ActionTrigger class, express initialState in its terms
* add all TriggerF actions to existing TriggerA
* Trigger.rule will no longer have Time argument
* rename getS, setS to get, put, matching C.M.T.State from transformers
* make high-level Rule evaluate to the underlying TriggerF sequence
* Assert's testRule doesn't have a transform yet
* move DamlTuple2 to common converter library
- suggested by @cocreature; thanks
* combine the two Frees, provide from Script
* remove time argument from integration tests
CHANGELOG_BEGIN
- [Triggers] The ``Time`` argument was removed from the trigger rule function; instead, it
can be fetched within the ``TriggerA`` ``do`` block by ``getTime``, as with ``Update``
and ``Scenario``. The ``LowLevel`` trigger interface has been redesigned; such triggers
need to be rewritten or ported to high-level triggers.
See `issue #7456 <https://github.com/digital-asset/daml/pull/7456>`_.
CHANGELOG_END
* add trigger rule simulator to support Assert module
* missed new Free module
- left in script per @cocreature
* remove retract as we ended up using foldFree for that purpose instead
- suggested by @cocreature; thanks
* throw ConverterException instead of RuntimeException
- suggested by @cocreature; thanks
* remove Time argument from coin-upgrade-trigger
* port trigger service tests
* port trigger scenario test
* put TriggerSetup and TriggerRule into LowLevel.Trigger instead of unboxed Free
- suggested by @cocreature; thanks
* remove Time argument from trigger compatibility test
* submit commands as soon as each `emitCommands` is sequenced
- we still collect a list, but only for tracking commandsInFlight
* filter out compatibility tests for triggers before now
* remove commented imports, libraries from new shared converter
* make the TriggerF interpreter tail-recursive
* remove unused compatibility trait
* add back new state logging
* remove refactoring comment
* rewrite some LowLevel initialStates in do
* hide Daml.Script.Free from docs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* remove forwardPortInitialState
- suggested by @cocreature; thanks
* manually port low-level updates
- suggested by @cocreature; thanks
* remove forwardPort
- suggested by @cocreature; thanks
* fail faster on unrecognized TriggerF
- suggested by @cocreature; thanks
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-10-02 21:18:13 +03:00
|
|
|
|
2020-05-27 15:32:37 +03:00
|
|
|
[
|
|
|
|
daml_trigger_dar(sdk_version)
|
|
|
|
for sdk_version in sdk_versions
|
2020-10-29 16:19:10 +03:00
|
|
|
if versions.is_at_least(first_post_7587_trigger_version, sdk_version)
|
2020-05-27 15:32:37 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
[
|
|
|
|
daml_trigger_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 trigger 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.
|
2020-10-29 16:19:10 +03:00
|
|
|
if versions.is_at_least(first_post_7587_trigger_version, sdk_version) and
|
interpret allowed updates and other actions in a free Trigger monad, like Script (#7456)
* conservatively move daml-script, trigger SValue interpreters to common library
* introduce expect and JavaList pattern for converters
* clean up trigger Converter Command interpretation
* add Church Free monad
* add an action language for trigger updates
* add expectE to remove some of the joins
* convert more of the converters to expect
* tool for unrolling Free/Roll
* split handleStepResult up and clean up its pattern
* handleStepFreeResult to interpret TriggerF
* replace Free Church with Pure/Roll free from Script
* newtype for ActionTrigger
* replace update in low-level Trigger with Free TriggerF
* submit one Commands at a time
* boolean blindness strikes again
* log missed TriggerF steps
* comment actual Submit contents
* match #7501 fromPureSExpr sig change in 00b80b8ea3
* avoid using forwardPort in runTrigger
* push State back into DAML, so it can be excluded from the action list
* push Message back into DAML, unifying the action language for initialState and update
* bringing TriggerF into initial state
* really add TriggerF into initial state, with all ports, tested
* add ActionTrigger class, express initialState in its terms
* add all TriggerF actions to existing TriggerA
* Trigger.rule will no longer have Time argument
* rename getS, setS to get, put, matching C.M.T.State from transformers
* make high-level Rule evaluate to the underlying TriggerF sequence
* Assert's testRule doesn't have a transform yet
* move DamlTuple2 to common converter library
- suggested by @cocreature; thanks
* combine the two Frees, provide from Script
* remove time argument from integration tests
CHANGELOG_BEGIN
- [Triggers] The ``Time`` argument was removed from the trigger rule function; instead, it
can be fetched within the ``TriggerA`` ``do`` block by ``getTime``, as with ``Update``
and ``Scenario``. The ``LowLevel`` trigger interface has been redesigned; such triggers
need to be rewritten or ported to high-level triggers.
See `issue #7456 <https://github.com/digital-asset/daml/pull/7456>`_.
CHANGELOG_END
* add trigger rule simulator to support Assert module
* missed new Free module
- left in script per @cocreature
* remove retract as we ended up using foldFree for that purpose instead
- suggested by @cocreature; thanks
* throw ConverterException instead of RuntimeException
- suggested by @cocreature; thanks
* remove Time argument from coin-upgrade-trigger
* port trigger service tests
* port trigger scenario test
* put TriggerSetup and TriggerRule into LowLevel.Trigger instead of unboxed Free
- suggested by @cocreature; thanks
* remove Time argument from trigger compatibility test
* submit commands as soon as each `emitCommands` is sequenced
- we still collect a list, but only for tracking commandsInFlight
* filter out compatibility tests for triggers before now
* remove commented imports, libraries from new shared converter
* make the TriggerF interpreter tail-recursive
* remove unused compatibility trait
* add back new state logging
* remove refactoring comment
* rewrite some LowLevel initialStates in do
* hide Daml.Script.Free from docs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* remove forwardPortInitialState
- suggested by @cocreature; thanks
* manually port low-level updates
- suggested by @cocreature; thanks
* remove forwardPort
- suggested by @cocreature; thanks
* fail faster on unrecognized TriggerF
- suggested by @cocreature; thanks
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-10-02 21:18:13 +03:00
|
|
|
versions.is_at_least(sdk_version, platform_version)
|
2020-05-05 13:33:32 +03:00
|
|
|
]
|
|
|
|
|
2020-05-05 15:46:58 +03:00
|
|
|
migration_test(
|
2021-12-06 15:44:30 +03:00
|
|
|
name = "migration",
|
2021-10-14 13:12:22 +03:00
|
|
|
timeout = "eternal",
|
2021-12-01 14:00:25 +03:00
|
|
|
quick_tags = ["head-quick"],
|
2020-05-06 13:22:56 +03:00
|
|
|
# Exclusive due to hardcoded postgres ports.
|
|
|
|
tags = [
|
|
|
|
"exclusive",
|
2021-11-23 17:00:50 +03:00
|
|
|
],
|
2021-11-18 17:48:37 +03:00
|
|
|
versions = [
|
|
|
|
version
|
|
|
|
for version in stable_versions
|
|
|
|
# We skip versions before 1.6.0. These versions had a bug where ledger
|
|
|
|
# effective time was stored at higher precision than it should have
|
|
|
|
# been. See https://github.com/digital-asset/daml/pull/11512#discussion_r751041534
|
|
|
|
if versions.is_at_least("1.6.0", version)
|
|
|
|
],
|
2020-05-05 15:46:58 +03:00
|
|
|
) if not is_windows else None
|
|
|
|
|
2020-06-12 15:29:27 +03:00
|
|
|
migration_test(
|
|
|
|
name = "meta-migration-test",
|
2021-12-01 14:00:25 +03:00
|
|
|
quick_tags = [],
|
2020-06-12 15:29:27 +03:00
|
|
|
tags = [
|
|
|
|
"exclusive",
|
|
|
|
"manual",
|
|
|
|
],
|
|
|
|
versions = [
|
|
|
|
"1.0.0",
|
|
|
|
"0.0.0",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-06-12 10:48:53 +03:00
|
|
|
[
|
|
|
|
data_dependencies_coins(
|
|
|
|
sdk_version = sdk_version,
|
|
|
|
)
|
|
|
|
for sdk_version in sdk_versions
|
|
|
|
]
|
|
|
|
|
|
|
|
[
|
2020-06-12 20:21:00 +03:00
|
|
|
data_dependencies_upgrade_test(
|
2020-06-12 10:48:53 +03:00
|
|
|
new_sdk_version = new_sdk_version,
|
|
|
|
old_sdk_version = old_sdk_version,
|
|
|
|
)
|
|
|
|
for old_sdk_version in sdk_versions
|
|
|
|
for new_sdk_version in sdk_versions
|
|
|
|
# Tests that we can build a package with a newer SDK version that has
|
|
|
|
# data-dependencies on packages built with an older SDK version.
|
|
|
|
if versions.is_at_least(old_sdk_version, new_sdk_version)
|
|
|
|
]
|