Repair release archives and document current Sized distribution
Sized Linux checks / Linux AMD64 / Rust 1.88.0 (push) Successful in 4m52s
Sized Linux checks / Linux AMD64 / Rust 1.88.0 (pull_request) Successful in 4m56s

This commit is contained in:
2026-10-10 03:51:35 -04:00
parent 9fd4e905b0
commit 5f0b11ea2e
9 changed files with 233 additions and 148 deletions
+5
View File
@@ -13,6 +13,10 @@ check_root=$(mktemp -d /tmp/sized-check.XXXXXX)
source_root=${SIZED_TEST_SOURCE:-/source}
cp "$source_root/Cargo.toml" "$source_root/Cargo.lock" "$check_root/"
cp -R "$source_root/src" "$source_root/tests" "$source_root/benches" "$check_root/"
cp "$source_root/LICENSE" "$source_root/README.md" "$source_root/MANUAL.md" "$check_root/"
mkdir "$check_root/scripts"
cp "$source_root/scripts/release.sh" "$source_root/scripts/check-release.sh" "$check_root/scripts/"
export SIZED_SOURCE_REVISION="$(git -C "$source_root" rev-parse HEAD 2>/dev/null || printf unknown)"
cd "$check_root"
cargo fmt --all -- --check
cargo test --locked
@@ -24,4 +28,5 @@ fixture_root=$(mktemp -d /tmp/sized-release.XXXXXX)
printf 'Linux release smoke test\n' > "$fixture_root/payload"
./target/release/sized --version
./target/release/sized "$fixture_root" --threads 2 --one-file-system --apparent --format json
./scripts/check-release.sh
printf 'Linux checks passed.\n'
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root=$(cd "$(dirname "$0")/.." && pwd)
check_root=$(mktemp -d "${TMPDIR:-/tmp}/sized-package.XXXXXX")
trap 'rm -rf "$check_root"' EXIT
"$repo_root/scripts/release.sh" --output-dir "$check_root/bundle"
mkdir "$check_root/extracted" "$check_root/fixture"
tar -xzf "$check_root/bundle.tar.gz" -C "$check_root/extracted"
for required in sized sized.1 sized.bash _sized sized.fish LICENSE README.md MANUAL.md BUILD-INFO.txt; do
test -s "$check_root/extracted/$required"
done
test -x "$check_root/extracted/sized"
(
cd "$check_root"
if command -v sha256sum >/dev/null 2>&1; then
sha256sum -c bundle.tar.gz.sha256
else
shasum -a 256 -c bundle.tar.gz.sha256
fi
)
printf 'owned package fixture\n' > "$check_root/fixture/payload"
"$check_root/extracted/sized" --version
"$check_root/extracted/sized" "$check_root/fixture" --apparent --format json > "$check_root/result.json"
grep -q 'payload' "$check_root/result.json"
grep -q '"complete":true' "$check_root/result.json"
if "$repo_root/scripts/release.sh" --output-dir "$check_root/bundle" > "$check_root/repeat.log" 2>&1; then
printf 'Packaging unexpectedly replaced an existing output.\n' >&2
exit 1
fi
grep -q 'Refusing to replace' "$check_root/repeat.log"
printf 'Archive contents, checksum, extracted CLI and overwrite guard passed.\n'
+52 -49
View File
@@ -1,53 +1,56 @@
#!/bin/bash
set -e
#!/usr/bin/env bash
set -euo pipefail
VERSION=$(grep '^version =' Cargo.toml | cut -d '"' -f 2)
DIST_DIR="dist/v$VERSION"
echo "Building release assets for sized v$VERSION..."
# 1. Clean and Prepare
rm -rf "$DIST_DIR"
mkdir -p "$DIST_DIR"
# 2. Build Release Binary
cargo build --release
# 3. Generate Man Page
cargo run --release -- --generate-man-page "$DIST_DIR"
# 4. Generate Completions
cargo run --release -- --completions bash > "$DIST_DIR/sized.bash"
cargo run --release -- --completions zsh > "$DIST_DIR/_sized"
cargo run --release -- --completions fish > "$DIST_DIR/sized.fish"
# 5. Build Debian Package (if cargo-deb is installed)
if command -v cargo-deb &> /dev/null; then
echo "Building Debian package..."
# On macOS, we use --no-strip to avoid 'unrecognized option: --strip-unneeded'
# and --no-build because we already built the release binary.
cargo deb --no-build --no-strip
cp target/debian/*.deb "$DIST_DIR/"
echo "Note: .deb package contains the binary for $(uname -s)-$(uname -m)"
else
echo "Warning: cargo-deb not found. Skipping .deb packaging."
# Build a host-target archive only. No tags, uploads, installers or signing.
repo_root=$(cd "$(dirname "$0")/.." && pwd)
cd "$repo_root"
version=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml)
target=$(rustc -vV | sed -n 's/^host: //p')
revision=${SIZED_SOURCE_REVISION:-$(git rev-parse HEAD 2>/dev/null || printf unknown)}
destination="$repo_root/dist/sized-v$version-$target-${revision:0:12}"
if [[ $# == 2 && $1 == --output-dir ]]; then
destination=$2
elif [[ $# != 0 ]]; then
printf 'Usage: %s [--output-dir ABSOLUTE_PATH]\n' "$0" >&2
exit 2
fi
[[ $destination == /* ]] || { printf 'Output directory must be absolute.\n' >&2; exit 2; }
for output in "$destination" "$destination.tar.gz" "$destination.tar.gz.sha256"; do
[[ ! -e $output ]] || { printf 'Refusing to replace %s\n' "$output" >&2; exit 1; }
done
# 6. Build Alpine Package (Placeholder/Hook)
# Note: For real .apk building, one usually uses a docker container or abuild.
# This serves as a reminder for Alpine users.
if [ -f "APKBUILD" ] && command -v abuild &> /dev/null; then
echo "Building Alpine package..."
abuild -r
fi
target_dir=${CARGO_TARGET_DIR:-"$repo_root/target"}
[[ $target_dir == /* ]] || target_dir="$repo_root/$target_dir"
cargo build --locked --release --target "$target"
binary="$target_dir/$target/release/sized"
mkdir -p "$destination"
install -m 755 "$binary" "$destination/sized"
"$binary" --generate-man-page "$destination"
"$binary" --completions bash > "$destination/sized.bash"
"$binary" --completions zsh > "$destination/_sized"
"$binary" --completions fish > "$destination/sized.fish"
cp LICENSE README.md MANUAL.md "$destination/"
{
printf 'Version: %s\nTarget: %s\nSource revision: %s\n' "$version" "$target" "$revision"
printf 'Source worktree: '
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
if git diff --quiet HEAD --; then printf 'clean tracked files\n'; else printf 'modified tracked files\n'; fi
else
printf 'exported source; verify against supplied revision\n'
fi
rustc --version
cargo --version
printf 'Unsigned host build; not a notarized Mac application.\n'
} > "$destination/BUILD-INFO.txt"
# 7. Create General Release Tarball
echo "Creating release tarball..."
tar -czf "dist/sized-v$VERSION-$(uname -s)-$(uname -m).tar.gz" -C "$DIST_DIR" .
# 8. Copy Binary
cp target/release/sized "$DIST_DIR/"
echo "Success! Assets are ready in $DIST_DIR"
ls -F "$DIST_DIR"
echo "Tarball: dist/sized-v$VERSION-$(uname -s)-$(uname -m).tar.gz"
tar -czf "$destination.tar.gz" -C "$destination" .
(
cd "$(dirname "$destination")"
archive="$(basename "$destination").tar.gz"
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$archive" > "$archive.sha256"
else
shasum -a 256 "$archive" > "$archive.sha256"
fi
)
printf 'Archive: %s.tar.gz\nChecksum: %s.tar.gz.sha256\n' "$destination" "$destination"