Files
clawhdf5/scripts/ci-test.sh
Omar Sobh 55959b4920
CI / test (push) Failing after 15s
ci: wire up CI, fix no_std build, fix stale package names in scripts
- Add .gitea/workflows/ci.yml running scripts/ci-test.sh (fmt, clippy,
  test, no_std check) on push/PR to main.
- Fix stale rustyhdf5-py/rustyhdf5-format package names in
  ci-test.sh/check-nostd.sh, which had been silently no-op'ing those
  checks (cargo warns but doesn't fail on an unknown --exclude/-p
  target).
- With those checks actually running, fix the real issues they surface:
  - clippy: useless_conversion in chunked_write.rs, byte_char_slices in
    global_heap.rs/object_header.rs.
  - cargo fmt: apply formatting across the workspace (whitespace only).
  - no_std (thumbv7em-none-eabihf) build errors in clawhdf5-format:
    core::sync::atomic::AtomicU64 doesn't exist on that target (no
    native 64-bit atomics) — switch profiling.rs's counters to
    portable-atomic, which falls back to a CAS-based emulation there
    and is a no-op wrapper elsewhere. Add missing alloc imports for
    Box (filters.rs), Vec (filters_szip.rs), and format! (dict_encoding.rs)
    on no_std paths. Replace f64::powi (std/libm-only) with a small
    local exponentiation-by-squaring helper in the scale-offset filter.
2026-08-05 10:50:13 -07:00

67 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# CI test script — runs fmt, clippy, tests, and no_std checks.
#
# Usage:
# ./scripts/ci-test.sh
#
# Exit codes:
# 0 — all checks passed
# 1 — one or more checks failed
set -uo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PASS=0
FAIL=0
STEPS=()
run_step() {
local name="$1"
shift
echo ""
echo "==> [$name]"
if "$@" 2>&1; then
echo " ✓ PASS: $name"
PASS=$((PASS + 1))
STEPS+=("PASS: $name")
else
echo " ✗ FAIL: $name"
FAIL=$((FAIL + 1))
STEPS+=("FAIL: $name")
fi
}
# 1. Format check
run_step "cargo fmt --check" cargo fmt --check
# 2. Clippy (exclude clawhdf5-py which needs PyO3/Python)
run_step "cargo clippy" cargo clippy \
--workspace \
--exclude clawhdf5-py \
-- -D warnings
# 3. Tests (exclude clawhdf5-py)
run_step "cargo test" cargo test \
--workspace \
--exclude clawhdf5-py
# 4. no_std check
run_step "check-nostd.sh" "$SCRIPT_DIR/check-nostd.sh"
# Summary
echo ""
echo "========================================"
echo " CI Summary"
echo "========================================"
for s in "${STEPS[@]}"; do
echo " $s"
done
echo "----------------------------------------"
echo " $PASS passed, $FAIL failed"
echo "========================================"
if [ "$FAIL" -gt 0 ]; then
exit 1
fi
exit 0