Skip to content

Commit e4c691f

Browse files
authored
chore(sns): Publish sns-testing bundle (#4937)
This PR adds a new Bazel target `//rs/sns/testing:sns_testing_bundle` that bundles all the files required for running sns-testing, including the binaries and canister wasms. This target's artifact is a single sns_testing_bundle.tar.gz file that should be published to the CDN (the size is around 100 MB).
1 parent 80d9fc5 commit e4c691f

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ http_file(
584584

585585
http_file(
586586
name = "cycles-ledger.wasm.gz",
587+
downloaded_file_path = "cycles-ledger.wasm.gz",
587588
sha256 = "d2aacbd214f20d752fd1696c2e36d7eceaafe07b932b3ae9e7e5564d1bda0178",
588589
url = "https://github.com/dfinity/cycles-ledger/releases/download/cycles-ledger-v1.0.3/cycles-ledger.wasm.gz",
589590
)

publish/binaries/BUILD.bazel

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ALL_BINARIES = {
4444

4545
# test binaries or binaries using test utils
4646
TESTONLY_BINARIES = [
47+
# Keep sorted
4748
"drun",
4849
"e2e-test-driver",
4950
"ic-admin",
@@ -55,8 +56,8 @@ TESTONLY_BINARIES = [
5556
"ic-starter",
5657
"ic-test-state-machine",
5758
"pocket-ic",
58-
"types-test",
5959
"replicated-state-test",
60+
"types-test",
6061
]
6162

6263
# We don't strip the more complex binaries
@@ -142,6 +143,13 @@ upload_artifacts(
142143
visibility = ["//testnet/tools:__pkg__"],
143144
)
144145

146+
upload_artifacts(
147+
name = "upload_sns_testing_bundle",
148+
testonly = True,
149+
inputs = ["//rs/sns/testing:sns_testing_bundle"],
150+
remote_subdir = "binaries/" + os_info,
151+
)
152+
145153
BINS_TO_TEST = [":" + name for name in ALL_BINARIES]
146154

147155
sh_test(

rs/sns/testing/BUILD.bazel

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_pkg//:pkg.bzl", "pkg_tar")
12
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
23
load("//bazel:canisters.bzl", "rust_canister")
34

@@ -153,3 +154,54 @@ rust_canister(
153154
"@crate_index//:serde",
154155
],
155156
)
157+
158+
genrule(
159+
name = "_sns_testing_env",
160+
testonly = True,
161+
srcs = DEV_DATA, # Include the dependencies to be resolved by rootpath in DEV_ENV.
162+
outs = ["sns_testing_env.sh"],
163+
cmd = "\n".join([
164+
'echo \'export %s="%s"\' >> $@' % (key, value)
165+
for key, value in DEV_ENV.items()
166+
]),
167+
)
168+
169+
pkg_tar(
170+
name = "sns_testing_env",
171+
testonly = True,
172+
srcs = ["_sns_testing_env"],
173+
extension = "tar",
174+
)
175+
176+
pkg_tar(
177+
name = "sns_testing_dependencies",
178+
testonly = True,
179+
srcs = DEV_DATA,
180+
extension = "tar",
181+
strip_prefix = "/",
182+
)
183+
184+
pkg_tar(
185+
name = "sns_testing_bin",
186+
testonly = True,
187+
srcs = [
188+
":sns-testing",
189+
":sns-testing-init",
190+
"dfx.json",
191+
# TODO: Add the README.md file to the tarball once if is re-written in terms of the bundle.
192+
# "README.md",
193+
],
194+
extension = "tar",
195+
)
196+
197+
pkg_tar(
198+
name = "sns_testing_bundle",
199+
testonly = True,
200+
extension = "tar.gz",
201+
strip_prefix = "/",
202+
deps = [
203+
":sns_testing_bin",
204+
":sns_testing_dependencies",
205+
":sns_testing_env",
206+
],
207+
)

0 commit comments

Comments
 (0)