Improve release and benchmark tooling
This commit is contained in:
@@ -12,6 +12,7 @@ normalize_os() {
|
||||
Darwin) printf '%s\n' macos ;;
|
||||
Linux) printf '%s\n' linux ;;
|
||||
FreeBSD) printf '%s\n' freebsd ;;
|
||||
MINGW*|MSYS*|CYGWIN*) printf '%s\n' windows ;;
|
||||
*) uname -s | tr '[:upper:]' '[:lower:]' ;;
|
||||
esac
|
||||
}
|
||||
@@ -27,8 +28,13 @@ normalize_arch() {
|
||||
|
||||
os="$(normalize_os)"
|
||||
arch="$(normalize_arch)"
|
||||
artifact="dosh-$os-$arch.tar.gz"
|
||||
versioned_artifact="dosh-$version-$os-$arch.tar.gz"
|
||||
if [ "$os" = "windows" ]; then
|
||||
artifact="dosh-$os-$arch.zip"
|
||||
versioned_artifact="dosh-$version-$os-$arch.zip"
|
||||
else
|
||||
artifact="dosh-$os-$arch.tar.gz"
|
||||
versioned_artifact="dosh-$version-$os-$arch.tar.gz"
|
||||
fi
|
||||
stage="$out_dir/stage/dosh"
|
||||
|
||||
cargo build --release
|
||||
@@ -42,11 +48,38 @@ for bin in dosh-client dosh-server dosh-auth dosh-bench; do
|
||||
done
|
||||
printf '%s\n' "$version" >"$stage/VERSION"
|
||||
|
||||
tar -C "$out_dir/stage" -czf "$out_dir/$artifact" dosh
|
||||
if [ "$os" = "windows" ]; then
|
||||
if command -v powershell.exe >/dev/null 2>&1; then
|
||||
powershell.exe -NoProfile -Command "Compress-Archive -Force -Path '$stage' -DestinationPath '$out_dir/$artifact'"
|
||||
elif command -v zip >/dev/null 2>&1; then
|
||||
(cd "$out_dir/stage" && zip -qr "../$artifact" dosh)
|
||||
else
|
||||
echo "windows packaging requires powershell.exe or zip" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
tar -C "$out_dir/stage" -czf "$out_dir/$artifact" dosh
|
||||
fi
|
||||
cp "$out_dir/$artifact" "$out_dir/$versioned_artifact"
|
||||
|
||||
write_sha256() {
|
||||
file="$1"
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
sha256sum "$file" >"$file.sha256"
|
||||
elif command -v shasum >/dev/null 2>&1; then
|
||||
shasum -a 256 "$file" >"$file.sha256"
|
||||
else
|
||||
echo "warning: sha256sum/shasum not found; skipping checksum for $file" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
write_sha256 "$out_dir/$artifact"
|
||||
write_sha256 "$out_dir/$versioned_artifact"
|
||||
|
||||
cat <<EOF
|
||||
Wrote:
|
||||
$out_dir/$artifact
|
||||
$out_dir/$artifact.sha256
|
||||
$out_dir/$versioned_artifact
|
||||
$out_dir/$versioned_artifact.sha256
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user