Skip to content

Commit

Permalink
feat: package and release auditor binary
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin authored and joshuef committed May 15, 2024
1 parent fe3f0c1 commit 6e87253
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 35 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,22 @@ jobs:
# from S3, using that version number. Uploading the binaries to S3 before publishing
# ensures that they will exist after the new crate has been published.
just package-release-assets "faucet"
just package-release-assets "node-launchpad"
just package-release-assets "safe"
just package-release-assets "safenode"
just package-release-assets "faucet"
just package-release-assets "safenode_rpc_client"
just package-release-assets "safenode-manager"
just package-release-assets "safenodemand"
just package-release-assets "node-launchpad"
just package-release-assets "sn_auditor"
just upload-release-assets-to-s3 "faucet"
just upload-release-assets-to-s3 "node-launchpad"
just upload-release-assets-to-s3 "safe"
just upload-release-assets-to-s3 "safenode"
just upload-release-assets-to-s3 "safenode-manager"
just upload-release-assets-to-s3 "safenodemand"
just upload-release-assets-to-s3 "faucet"
just upload-release-assets-to-s3 "safenode_rpc_client"
just upload-release-assets-to-s3 "node-launchpad"
just upload-release-assets-to-s3 "sn_auditor"
# The `release-plz` command publishes crates which had their versions bumped, and also
# creates Github releases. The binaries are then attached to the releases in the
Expand All @@ -187,20 +189,22 @@ jobs:
# Now upload the 'latest' versions to S3. This can be done later because the node manager
# does not depend on these existing.
just package-release-assets "faucet" "latest"
just package-release-assets "node-launchpad" "latest"
just package-release-assets "safe" "latest"
just package-release-assets "safenode" "latest"
just package-release-assets "faucet" "latest"
just package-release-assets "safenode_rpc_client" "latest"
just package-release-assets "safenode-manager" "latest"
just package-release-assets "safenodemand" "latest"
just package-release-assets "node-launchpad"
just package-release-assets "sn_auditor" "latest"
just upload-release-assets-to-s3 "node-launchpad"
just upload-release-assets-to-s3 "faucet"
just upload-release-assets-to-s3 "safe"
just upload-release-assets-to-s3 "safenode"
just upload-release-assets-to-s3 "safenode-manager"
just upload-release-assets-to-s3 "safenodemand"
just upload-release-assets-to-s3 "faucet"
just upload-release-assets-to-s3 "safenode_rpc_client"
just upload-release-assets-to-s3 "node-launchpad"
just upload-release-assets-to-s3 "sn_auditor"
- name: post notification to slack on failure
if: ${{ failure() }}
Expand Down
66 changes: 40 additions & 26 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,23 @@ build-release-artifacts arch:

if [[ $arch == arm* || $arch == armv7* || $arch == aarch64* ]]; then
cargo install cross
cross build --release --target $arch --bin faucet --features=distribution
cross build --release --target $arch --bin node-launchpad
cross build --release --features="network-contacts,distribution" --target $arch --bin safe
cross build --release --features=network-contacts --target $arch --bin safenode
cross build --release --target $arch --bin safenode-manager
cross build --release --target $arch --bin safenodemand
cross build --release --target $arch --bin faucet --features=distribution
cross build --release --target $arch --bin safenode_rpc_client
cross build --release --target $arch --bin node-launchpad
cross build --release --target $arch --bin sn_auditor
else
cargo build --release --target $arch --bin faucet --features=distribution
cargo build --release --target $arch --bin node-launchpad
cargo build --release --features="network-contacts,distribution" --target $arch --bin safe
cargo build --release --features=network-contacts --target $arch --bin safenode
cargo build --release --target $arch --bin safenode-manager
cargo build --release --target $arch --bin safenodemand
cargo build --release --target $arch --bin faucet --features=distribution
cargo build --release --target $arch --bin safenode_rpc_client
cargo build --release --target $arch --bin node-launchpad
cross build --release --target $arch --bin sn_auditor
fi

find target/$arch/release -maxdepth 1 -type f -exec cp '{}' artifacts \;
Expand Down Expand Up @@ -172,19 +174,26 @@ package-release-assets bin version="":
bin="{{bin}}"

supported_bins=(\
"faucet" \
"node-launchpad" \
"safe" \
"safenode" \
"safenode-manager" \
"safenodemand" \
"faucet" \
"safenode_rpc_client" \
"node-launchpad")
"sn_auditor")
crate_dir_name=""

# In the case of the node manager, the actual name of the crate is `sn-node-manager`, but the
# directory it's in is `sn_node_manager`.
bin="{{bin}}"
case "$bin" in
faucet)
crate_dir_name="sn_faucet"
;;
node-launchpad)
crate_dir_name="node-launchpad"
;;
safe)
crate_dir_name="sn_cli"
;;
Expand All @@ -197,14 +206,11 @@ package-release-assets bin version="":
safenodemand)
crate_dir_name="sn_node_manager"
;;
faucet)
crate_dir_name="sn_faucet"
;;
safenode_rpc_client)
crate_dir_name="sn_node_rpc_client"
;;
node-launchpad)
crate_dir_name="node-launchpad"
sn_auditor)
crate_dir_name="sn_auditor"
;;

*)
Expand Down Expand Up @@ -243,12 +249,13 @@ upload-github-release-assets:
set -e
binary_crates=(
"sn_faucet"
"node-launchpad"
"sn_cli"
"sn_node"
"sn-node-manager"
"sn_faucet"
"sn_node_rpc_client"
"node-launchpad"
"sn_auditor"
)

commit_msg=$(git log -1 --pretty=%B)
Expand All @@ -265,6 +272,14 @@ upload-github-release-assets:
for binary_crate in "${binary_crates[@]}"; do
if [[ "$crate" == "$binary_crate" ]]; then
case "$crate" in
sn_faucet)
bin_name="faucet"
bucket="sn-faucet"
;;
node-launchpad)
bin_name="node-launchpad"
bucket="node-launchpad"
;;
sn_cli)
bin_name="safe"
bucket="sn-cli"
Expand All @@ -277,17 +292,13 @@ upload-github-release-assets:
bin_name="safenode-manager"
bucket="sn-node-manager"
;;
sn_faucet)
bin_name="faucet"
bucket="sn-faucet"
;;
sn_node_rpc_client)
bin_name="safenode_rpc_client"
bucket="sn-node-rpc-client"
;;
node-launchpad)
bin_name="node-launchpad"
bucket="node-launchpad"
sn_auditor)
bin_name="sn_auditor"
bucket="sn-auditor"
;;
*)
echo "The $crate crate is not supported"
Expand All @@ -301,7 +312,7 @@ upload-github-release-assets:
if [[ $crate_with_version == $crate-v* ]]; then
(
cd deploy/$bin_name
if [[ "$crate" == "sn_cli" || "$crate" == "sn_node" || "$crate" == "sn-node-manager" || "$crate" == "node-launchpad" ]]; then
if [[ "$crate" == "node-launchpad" || "$crate" == "sn_cli" || "$crate" == "sn_node" || "$crate" == "sn-node-manager" || "$crate" == "sn_auditor" ]]; then
echo "Uploading $bin_name assets to $crate_with_version release..."
ls | xargs gh release upload $crate_with_version --repo {{release_repo}}
fi
Expand All @@ -317,6 +328,12 @@ upload-release-assets-to-s3 bin_name:
set -e
case "{{bin_name}}" in
faucet)
bucket="sn-faucet"
;;
node-launchpad)
bucket="node-launchpad"
;;
safe)
bucket="sn-cli"
;;
Expand All @@ -329,14 +346,11 @@ upload-release-assets-to-s3 bin_name:
safenodemand)
bucket="sn-node-manager"
;;
faucet)
bucket="sn-faucet"
;;
safenode_rpc_client)
bucket="sn-node-rpc-client"
;;
node-launchpad)
bucket="node-launchpad"
sn_auditor)
bucket="sn-auditor"
;;
*)
echo "The {{bin_name}} binary is not supported"
Expand Down
2 changes: 1 addition & 1 deletion release-plz.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ release = false
[[package]]
name = "sn_auditor"
changelog_update = true
git_release_enable = false
git_release_enable = true
release = true

[[package]]
Expand Down

0 comments on commit 6e87253

Please sign in to comment.