Skip to content

Commit

Permalink
Merge pull request #55 from rmohr/ppc
Browse files Browse the repository at this point in the history
Build and publish ppc builds
  • Loading branch information
rmohr authored Apr 27, 2023
2 parents fd7d7e1 + 5463805 commit 6644e35
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 22 deletions.
2 changes: 2 additions & 0 deletions cmd/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ alias(
actual = select({
"@io_bazel_rules_go//go/platform:linux_amd64": "@bazeldnf-linux-amd64//file:downloaded",
"@io_bazel_rules_go//go/platform:linux_arm64": "@bazeldnf-linux-arm64//file:downloaded",
"@io_bazel_rules_go//go/platform:linux_ppc64": "@bazeldnf-linux-ppc64//file:downloaded",
"@io_bazel_rules_go//go/platform:linux_ppc64le": "@bazeldnf-linux-ppc64le//file:downloaded",
"@io_bazel_rules_go//go/platform:darwin_amd64": "@bazeldnf-darwin-amd64//file:downloaded",
"@io_bazel_rules_go//go/platform:darwin_arm64": "@bazeldnf-darwin-arm64//file:downloaded",
"//conditions:default": "cmd",
Expand Down
12 changes: 12 additions & 0 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,15 @@ def bazeldnf_dependencies():
sha256 = "261b11758afc7ce03568026691f62a78fe63ba6e87d1fc51771d3715eec44bcd",
urls = ["https://github.com/rmohr/bazeldnf/releases/download/v0.5.6/bazeldnf-v0.5.6-darwin-arm64"],
)
http_file(
name = "bazeldnf-linux-ppc64",
executable = True,
sha256 = "d658a09108bd4c4975aa6bca5372c3a7f72ddcd4abd937f9dc882b5fada57694",
urls = ["https://github.com/rmohr/bazeldnf/releases/download/v0.5.6/bazeldnf-v0.5.6-linux-amd64"],
)
http_file(
name = "bazeldnf-linux-ppc64le",
executable = True,
sha256 = "6ad9a260655bbf7591f52553aaa20436814c1426ae37b1f26e066a257a72890c",
urls = ["https://github.com/rmohr/bazeldnf/releases/download/v0.5.6/bazeldnf-v0.5.6-linux-arm64"],
)
58 changes: 36 additions & 22 deletions hack/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,36 @@ BASE_DIR="$(
rm -rf dist
mkdir -p dist

bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd
cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-linux-amd64
bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd
cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-linux-arm64
bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd
cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-darwin-amd64
bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //cmd
cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-darwin-arm64
function build_arch() {
os=$1
arch=$2

bazel build --platforms=@io_bazel_rules_go//go/toolchain:${os}_${arch} //cmd
cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-${os}-${arch}
}

function write_arch() {
os=$1
arch=$2

DIGEST=$(sha256sum dist/bazeldnf-${VERSION}-${os}-${arch} | cut -d " " -f 1)
cat <<EOT >>./deps.bzl
http_file(
name = "bazeldnf-${os}-${arch}",
executable = True,
sha256 = "${DIGEST}",
urls = ["https://github.com/rmohr/bazeldnf/releases/download/${VERSION}/bazeldnf-${VERSION}-${os}-${arch}"],
)
EOT

}

build_arch linux amd64
build_arch linux arm64
build_arch darwin amd64
build_arch darwin arm64
build_arch linux ppc64
build_arch linux ppc64le

cat <<EOT >./deps.bzl
load(
Expand Down Expand Up @@ -51,20 +73,12 @@ xattrs = _xattrs
def bazeldnf_dependencies():
EOT

for os in linux darwin; do
for arch in amd64 arm64; do

DIGEST=$(sha256sum dist/bazeldnf-${VERSION}-${os}-${arch} | cut -d " " -f 1)
cat <<EOT >>./deps.bzl
http_file(
name = "bazeldnf-${os}-${arch}",
executable = True,
sha256 = "${DIGEST}",
urls = ["https://github.com/rmohr/bazeldnf/releases/download/${VERSION}/bazeldnf-${VERSION}-${os}-${arch}"],
)
EOT
done
done
write_arch linux amd64
write_arch linux arm64
write_arch darwin amd64
write_arch darwin arm64
write_arch linux ppc64
write_arch linux ppc64le

git commit -a -m "Bump prebuilt binary references for ${VERSION}"

Expand Down

0 comments on commit 6644e35

Please sign in to comment.