42 lines
1.9 KiB
Bash
Executable File
42 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
test "$(uname -s)" = Linux
|
|
test "$(id -u)" != 0
|
|
printf 'Linux checks: uid=%s architecture=%s\n' "$(id -u)" "$(uname -m)"
|
|
rustc --version
|
|
cargo --version
|
|
|
|
# Only source inputs are copied. Cargo output and all fixtures disappear with
|
|
# the container; the host checkout is read-only and no personal tree is scanned.
|
|
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" "$source_root/crates" "$source_root/docs" "$check_root/"
|
|
cp "$source_root/CORE-SNAPSHOT.json" "$check_root/"
|
|
if [[ -d "$source_root/vendor" ]]; then
|
|
cp -R "$source_root/vendor" "$source_root/.cargo" "$check_root/"
|
|
export CARGO_NET_OFFLINE=true
|
|
fi
|
|
cp "$source_root/LICENSE" "$source_root/README.md" "$source_root/MANUAL.md" "$check_root/"
|
|
mkdir "$check_root/scripts"
|
|
cp "$source_root"/scripts/{release.sh,check-release.sh,check-core.py,package-notices.py} "$check_root/scripts/"
|
|
export SIZED_SOURCE_REVISION="${SIZED_SOURCE_REVISION:-$(git -C "$source_root" rev-parse HEAD 2>/dev/null || printf unknown)}"
|
|
cd "$check_root"
|
|
python3 scripts/check-core.py
|
|
cargo fmt --all -- --check
|
|
cargo test --locked --workspace
|
|
cargo test --locked --workspace --test linux_mount -- --ignored
|
|
cargo clippy --locked --workspace --all-targets -- -D warnings
|
|
cargo build --locked --release
|
|
|
|
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
|
|
if [[ -n ${SIZED_RELEASE_DIR:-} ]]; then
|
|
./scripts/release.sh --output-dir "$SIZED_RELEASE_DIR/sized-v2.0.0-$(rustc -vV | sed -n 's/^host: //p')"
|
|
fi
|
|
printf 'Linux checks passed.\n'
|