* ci: add PR wrapper command surface * ci: collect wrapper timing in PR checks * docs: record initial CI wrapper measurements * ci: add manual measurement workflow * ci: allow branch measurement dispatch * ci: keep measuring independent commands after failures * docs: record branch-dispatched CI measurement * ci: keep measuring package suites after failures * docs: record CI measurement batch * fix: repair CI-measured test failures * test: make local Go gates hermetic * ci: add sharded integration measurement lane * test: fix internal beads integration TestMain * docs: record fixed integration shard measurement * ci: add hybrid integration sharding measurement * ci: speed up cmd/bd test shard discovery * ci: add 16-way integration sharding measurement * ci: measure prebuilt cmd bd sharding * docs: record prebuilt sharding measurement * docs: design CI build artifact stage * docs: record repeat prebuilt integration measurement * ci: add build artifact stage * ci: reuse build artifact in linux test lane * ci: promote main linux integration shards * ci: gate legacy platform tests to main * ci: satisfy workflow shell lint * ci: ignore archived migrations in duplicate check * ci: add package gate wrappers * test: clean up testing short boundaries * ci: allow unreleased version docs lag * ci: gate releases on package checks * ci: split workflow by tier * ci: add aggregate PR gates
72 lines
1.5 KiB
Bash
Executable file
72 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# npm package gate.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
NPM_DIR="$REPO_ROOT/npm-package"
|
|
NPM_BIN="$NPM_DIR/bin/bd"
|
|
|
|
# shellcheck source=../../.buildflags
|
|
source "$REPO_ROOT/.buildflags"
|
|
# shellcheck source=lib/timing.sh
|
|
source "$REPO_ROOT/scripts/ci/lib/timing.sh"
|
|
|
|
backup_bin=""
|
|
created_bin=0
|
|
|
|
cleanup() {
|
|
if [[ "$created_bin" -eq 1 ]]; then
|
|
rm -f "$NPM_BIN"
|
|
fi
|
|
if [[ -n "$backup_bin" && -f "$backup_bin" ]]; then
|
|
mv -f "$backup_bin" "$NPM_BIN"
|
|
fi
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
prepare_bd_binary() {
|
|
mkdir -p "$NPM_DIR/bin"
|
|
|
|
if [[ -e "$NPM_BIN" ]]; then
|
|
backup_bin="$(mktemp)"
|
|
mv -f "$NPM_BIN" "$backup_bin"
|
|
fi
|
|
|
|
if [[ -n "${BEADS_TEST_BD_BINARY:-}" ]]; then
|
|
cp "$BEADS_TEST_BD_BINARY" "$NPM_BIN"
|
|
else
|
|
go build -o "$NPM_BIN" ./cmd/bd
|
|
fi
|
|
|
|
chmod +x "$NPM_BIN"
|
|
created_bin=1
|
|
"$NPM_BIN" version
|
|
}
|
|
|
|
npm_install() {
|
|
cd "$NPM_DIR"
|
|
npm install
|
|
}
|
|
|
|
npm_test_all() {
|
|
cd "$NPM_DIR"
|
|
npm run test:all
|
|
}
|
|
|
|
npm_pack_dry_run() {
|
|
cd "$NPM_DIR"
|
|
npm pack --dry-run
|
|
}
|
|
|
|
cd "$REPO_ROOT"
|
|
|
|
# The package postinstall script downloads the latest published release when
|
|
# CI is not set. Package gates validate the candidate binary prepared above.
|
|
export CI="${CI:-1}"
|
|
|
|
ci_time "prepare bd for npm package" -- prepare_bd_binary
|
|
ci_time "npm package install" -- npm_install
|
|
ci_time "npm package test:all" -- npm_test_all
|
|
ci_time "npm package pack dry-run" -- npm_pack_dry_run
|