linux.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. import os
  10. from pathlib import Path
  11. from ci import tarball_uploader
  12. from ci.deploy.deploy_util import rust_version
  13. from materialize import mzbuild, spawn, ui
  14. from materialize.rustc_flags import Sanitizer
  15. from . import deploy_util
  16. def main() -> None:
  17. bazel = ui.env_is_truthy("CI_BAZEL_BUILD")
  18. bazel_remote_cache = os.getenv("CI_BAZEL_REMOTE_CACHE")
  19. bazel_lto = ui.env_is_truthy("CI_BAZEL_LTO")
  20. repo = mzbuild.Repository(
  21. Path("."),
  22. coverage=False,
  23. sanitizer=Sanitizer.none,
  24. bazel=bazel,
  25. bazel_remote_cache=bazel_remote_cache,
  26. bazel_lto=bazel_lto,
  27. )
  28. target = f"{repo.rd.arch}-unknown-linux-gnu"
  29. print("--- Building mz-debug")
  30. # The bin/ci-builder uses target-xcompile as the volume and
  31. # is where the binary release will be available.
  32. path = Path("target-xcompile") / "release" / "mz-debug"
  33. spawn.runv(
  34. ["cargo", "build", "--bin", "mz-debug", "--release"],
  35. env=dict(os.environ, RUSTUP_TOOLCHAIN=rust_version()),
  36. )
  37. mzbuild.chmod_x(path)
  38. print(f"--- Uploading {target} binary tarball")
  39. uploader = tarball_uploader.TarballUploader(
  40. package_name="mz-debug",
  41. version=deploy_util.MZ_DEBUG_VERSION,
  42. )
  43. uploader.deploy_tarball(target, path)
  44. if __name__ == "__main__":
  45. main()