diff options
| author | Jack O'Connor <[email protected]> | 2020-04-27 21:30:54 -0400 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2020-04-28 11:04:29 -0400 |
| commit | ba468fbb4f7bb8b149eea60d0eab37858d32f23c (patch) | |
| tree | a6c8acd87b78dc9846440126d4bc2fe1e1e32baf /.github/workflows/build_b3sum.py | |
| parent | fcb4b83419ceb1eff8e7a059abe70b57a2f7f387 (diff) | |
build b3sum binaries in CI for new tags
These configs and code are adapted from the CI workflow in
https://github.com/oconnor663/blake3-py, especially the
upload_github_release_asset.py script, which is copied verbatim.
Diffstat (limited to '.github/workflows/build_b3sum.py')
| -rw-r--r-- | .github/workflows/build_b3sum.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/.github/workflows/build_b3sum.py b/.github/workflows/build_b3sum.py new file mode 100644 index 0000000..e487daf --- /dev/null +++ b/.github/workflows/build_b3sum.py @@ -0,0 +1,37 @@ +#! /usr/bin/env python3 + +from pathlib import Path +import platform +import shutil +import subprocess +import sys + +ROOT = Path(__file__).parent.parent.parent +RUST_TARGET = sys.argv[1] + +subprocess.run(["cargo", "build", "--target", sys.argv[1], "--release"], + cwd=ROOT / "b3sum") + +if platform.system() == "Windows": + original_exe_name = "b3sum.exe" +else: + original_exe_name = "b3sum" + +if platform.system() == "Windows": + new_exe_name = "b3sum_windows_x64_bin.exe" +elif platform.system() == "Darwin": + new_exe_name = "b3sum_macos_x64_bin" +elif platform.system() == "Linux": + new_exe_name = "b3sum_linux_x64_bin" +else: + raise RuntimeError("Unexpected platform: " + platform.system()) + +# Copy the built binary so that it has the upload name we want. +out_dir = ROOT / "b3sum/target" / RUST_TARGET / "release" +original_exe_path = str(out_dir / original_exe_name) +new_exe_path = str(out_dir / new_exe_name) +print("copying", repr(original_exe_path), "to", repr(new_exe_path)) +shutil.copyfile(original_exe_path, new_exe_path) + +# This lets the subsequent upload step get the filepath. +print("::set-output name=bin_path::" + new_exe_path) |
