mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 03:40:37 +08:00
Update test suite to use heartwood releases instead of commits
Remove extra line at heartwood-release
This commit is contained in:
@@ -90,12 +90,12 @@
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
heartwoodRev="${heartwood.rev or "unknown"}"
|
||||
expRev=$(cat tests/support/heartwood-version)
|
||||
expRev=$(cat tests/support/heartwood-release)
|
||||
if [ "''${heartwoodRev#$expRev}" = "$heartwoodRev" ]; then
|
||||
printf "Error: Expecting heartwood binaries revision '%s', got '%s'" "$expRev" "$heartwoodRev" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo unknown > tests/support/heartwood-version
|
||||
echo unknown > tests/support/heartwood-release
|
||||
scripts/install-binaries -l ${checkBins}/bin
|
||||
scripts/check
|
||||
{
|
||||
|
||||
+27
-57
@@ -1,11 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
BINARIES=(rad rad-web radicle-node radicle-httpd git-remote-rad)
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")
|
||||
REV=$(cat "$REPO_ROOT/tests/support/heartwood-version")
|
||||
BINARY_PATH=$REPO_ROOT/tests/tmp/bin/${REV:0:7}
|
||||
USE_LOCAL_BINARIES=false
|
||||
RELEASE=$(cat "$REPO_ROOT/tests/support/heartwood-release")
|
||||
BINARY_PATH=$REPO_ROOT/tests/tmp/bin/$RELEASE
|
||||
OS=$(uname)
|
||||
|
||||
show_usage() {
|
||||
@@ -17,68 +15,40 @@ show_usage() {
|
||||
echo
|
||||
echo "OPTIONS:"
|
||||
echo " -s --show-path Print the binary path, and skip installation."
|
||||
echo " -l --local-path Use local path instead of fetching from radicle.xyz."
|
||||
echo " -h --help Print this Help."
|
||||
echo
|
||||
}
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
case "$1" in
|
||||
--show-path | -s)
|
||||
echo "$BINARY_PATH"
|
||||
exit
|
||||
;;
|
||||
--local-path | -l)
|
||||
USE_LOCAL_BINARIES=true
|
||||
SOURCE_PATH=$2
|
||||
shift 2
|
||||
;;
|
||||
--help | -h)
|
||||
show_usage
|
||||
exit
|
||||
;;
|
||||
--show-path | -s)
|
||||
echo "$BINARY_PATH"
|
||||
exit
|
||||
;;
|
||||
--help | -h)
|
||||
show_usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Using revision $REV"
|
||||
if [ "$USE_LOCAL_BINARIES" = true ]; then
|
||||
echo "Using local binaries from $SOURCE_PATH"
|
||||
if test -d "$BINARY_PATH"; then
|
||||
echo ✅ "Folder $BINARY_PATH exists already skipping download."
|
||||
else
|
||||
mkdir -p "$BINARY_PATH"
|
||||
case "$OS" in
|
||||
Darwin)
|
||||
echo Downloading "$RELEASE" from "https://files.radicle.xyz/releases/$RELEASE/radicle-aarch64-apple-darwin.tar.xz"
|
||||
curl -# -L "https://files.radicle.xyz/releases/$RELEASE/radicle-aarch64-apple-darwin.tar.xz" | tar -xJ --strip-components=2 -C "$BINARY_PATH" "radicle-$RELEASE-aarch64-apple-darwin/bin/"
|
||||
;;
|
||||
Linux)
|
||||
echo Downloading "$RELEASE" from "https://files.radicle.xyz/releases/$RELEASE/radicle-x86_64-unknown-linux-musl.tar.xz"
|
||||
curl -# -L "https://files.radicle.xyz/releases/$RELEASE/radicle-x86_64-unknown-linux-musl.tar.xz" | tar -xJ --strip-components=2 -C "$BINARY_PATH" "radicle-$RELEASE-x86_64-unknown-linux-musl/bin/"
|
||||
;;
|
||||
*)
|
||||
echo "There are no precompiled binaries for your OS: $OS, compile $RELEASE manually and make sure it's in PATH." && exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
echo
|
||||
|
||||
mkdir -p "$BINARY_PATH"
|
||||
|
||||
for BINARY_NAME in "${BINARIES[@]}"
|
||||
do
|
||||
if [ -x "$(command -v "$BINARY_PATH/$BINARY_NAME")" ]; then
|
||||
echo ✅ "$BINARY_NAME"
|
||||
elif [ "$USE_LOCAL_BINARIES" = true ]; then
|
||||
echo Copying "$BINARY_NAME" from "$SOURCE_PATH/$BINARY_NAME"
|
||||
cp "$SOURCE_PATH/$BINARY_NAME" "$BINARY_PATH/$BINARY_NAME"
|
||||
else
|
||||
# To provide deterministic Node and Repo IDs, we need a rad CLI compiled with the --debug flag.
|
||||
if [ "$BINARY_NAME" = "rad" ]; then
|
||||
DOWNLOAD_NAME=debug/rad
|
||||
elif [ "$BINARY_NAME" = "git-remote-rad" ]; then
|
||||
DOWNLOAD_NAME=debug/git-remote-rad
|
||||
else
|
||||
DOWNLOAD_NAME=$BINARY_NAME
|
||||
fi
|
||||
|
||||
case "$OS" in
|
||||
Darwin)
|
||||
echo Downloading "$BINARY_NAME" from "https://files.radicle.xyz/$REV/aarch64-apple-darwin/$DOWNLOAD_NAME"
|
||||
curl --fail -s "https://files.radicle.xyz/$REV/aarch64-apple-darwin/$DOWNLOAD_NAME" --output "$BINARY_PATH/$BINARY_NAME" || (echo "Download failed" && exit 1);;
|
||||
Linux)
|
||||
echo Downloading "$BINARY_NAME" from "https://files.radicle.xyz/$REV/x86_64-unknown-linux-musl/$DOWNLOAD_NAME"
|
||||
curl --fail -s "https://files.radicle.xyz/$REV/x86_64-unknown-linux-musl/$DOWNLOAD_NAME" --output "$BINARY_PATH/$BINARY_NAME" || (echo "Download failed" && exit 1);;
|
||||
*) echo "There are no precompiled binaries for your OS: $OS, compile $BINARY_NAME manually and make sure it's in PATH." && exit 1 ;;
|
||||
esac
|
||||
|
||||
chmod a+x "$BINARY_PATH/$BINARY_NAME"
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
|
||||
+43
-40
@@ -3,8 +3,8 @@
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
printf \
|
||||
'Update flake and heartwood-version to the requested heartwood version.
|
||||
printf \
|
||||
'Update flake and heartwood-release to the requested heartwood version.
|
||||
When called without arguments, reads HASH from tests/support/hearwood-version.
|
||||
|
||||
USAGE:
|
||||
@@ -17,20 +17,20 @@ OPTIONS:
|
||||
}
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
--help | -h)
|
||||
usage >&2
|
||||
exit
|
||||
;;
|
||||
*/*)
|
||||
hash=$(git -C "$1" rev-parse --verify HEAD)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
hash=$1
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
case $1 in
|
||||
--help | -h)
|
||||
usage >&2
|
||||
exit
|
||||
;;
|
||||
*/*)
|
||||
hash=$(git -C "$1" rev-parse --verify HEAD)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
hash=$1
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Heartwood repo id
|
||||
@@ -38,38 +38,41 @@ rid=z3gqcJUoA1n9HaHKufZs5FCSGazv5
|
||||
|
||||
# Some root detection guess work...
|
||||
root=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")
|
||||
if [ ! -e "$root/tests/support/heartwood-version" ]; then
|
||||
root=$(cd .. ; pwd)
|
||||
if [ ! -e "$root/tests/support/heartwood-release" ]; then
|
||||
root=$(
|
||||
cd ..
|
||||
pwd
|
||||
)
|
||||
fi
|
||||
|
||||
if [ -z "$hash" ]; then
|
||||
# No hash given, take from heartwood-version
|
||||
if [ -e "$root/tests/support/heartwood-version" ]; then
|
||||
hash=$(cat "$root/tests/support/heartwood-version")
|
||||
[ -n "$hash" ] || {
|
||||
printf "Error reading heartwood-version\n" >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
# No hash given, take from heartwood-release
|
||||
if [ -e "$root/tests/support/heartwood-release" ]; then
|
||||
hash=$(cat "$root/tests/support/heartwood-release")
|
||||
[ -n "$hash" ] || {
|
||||
printf "Error reading heartwood-release\n" >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
else
|
||||
printf '%s\n' "$hash" >$root/tests/support/heartwood-version
|
||||
printf '%s\n' "$hash" >$root/tests/support/heartwood-release
|
||||
fi
|
||||
|
||||
if [ -e "$root/flake.nix" ]; then
|
||||
sed -E -e '/url.*git\+https.*'"$rid"'/s/(rev=)[0-9a-f]{40,40}/\1'"$hash"'/' "$root/flake.nix" >$root/flake.nix.tmp
|
||||
sed -E -e '/url.*git\+https.*'"$rid"'/s/(rev=)[0-9a-f]{40,40}/\1'"$hash"'/' "$root/flake.nix" >$root/flake.nix.tmp
|
||||
mv "$root/flake.nix.tmp" "$root/flake.nix"
|
||||
|
||||
# If running on a nix-enabled system, also update npmDepsHash.
|
||||
if type nix >/dev/null 2>&1; then
|
||||
npmDepsHash=$(nix --experimental-features 'nix-command flakes' \
|
||||
run --inputs-from "$root" nixpkgs#prefetch-npm-deps \
|
||||
-- "$root/package-lock.json")
|
||||
sed -E -e '/npmDepsHash/s#".*"#"'"$npmDepsHash"'"#' "$root/flake.nix" >$root/flake.nix.tmp
|
||||
mv "$root/flake.nix.tmp" "$root/flake.nix"
|
||||
|
||||
# If running on a nix-enabled system, also update npmDepsHash.
|
||||
if type nix >/dev/null 2>&1; then
|
||||
npmDepsHash=$(nix --experimental-features 'nix-command flakes' \
|
||||
run --inputs-from "$root" nixpkgs#prefetch-npm-deps \
|
||||
-- "$root/package-lock.json")
|
||||
sed -E -e '/npmDepsHash/s#".*"#"'"$npmDepsHash"'"#' "$root/flake.nix" >$root/flake.nix.tmp
|
||||
mv "$root/flake.nix.tmp" "$root/flake.nix"
|
||||
|
||||
nix --experimental-features 'nix-command flakes' flake update "$root"
|
||||
else
|
||||
printf >&2 'Node dependencies may be out of date!
|
||||
nix --experimental-features 'nix-command flakes' flake update "$root"
|
||||
else
|
||||
printf >&2 'Node dependencies may be out of date!
|
||||
Re-run on a nix-enabled system to update npmDepsHash.\n'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -19,7 +19,7 @@ test("node metadata", async ({ page, peerManager }) => {
|
||||
await expect(
|
||||
page.getByText(`${shortNodeRemote}@seed.radicle.test:8123`),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText("pre-release-c6076196")).toBeVisible();
|
||||
await expect(page.getByText("1.0.0-rc.6-")).toBeVisible();
|
||||
await peer.stopHttpd();
|
||||
await peer.stopNode();
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1.0.0-rc.6
|
||||
@@ -1 +0,0 @@
|
||||
c607619683e859fd715a23377c03fb08dc8090f4
|
||||
@@ -25,11 +25,12 @@ export const tmpDir = Path.resolve(supportDir, "..", "./tmp");
|
||||
export const fixturesDir = Path.resolve(supportDir, "..", "./fixtures");
|
||||
const workspacePaths = [Path.join(tmpDir, "peers"), Path.join(tmpDir, "repos")];
|
||||
|
||||
export const heartwoodShortSha = (
|
||||
await Fs.readFile(`${supportDir}/heartwood-version`, "utf8")
|
||||
).substring(0, 7);
|
||||
export const heartwoodRelease = await Fs.readFile(
|
||||
`${supportDir}/heartwood-release`,
|
||||
"utf8",
|
||||
);
|
||||
|
||||
const binaryPath = Path.join(tmpDir, "bin", heartwoodShortSha);
|
||||
const binaryPath = Path.join(tmpDir, "bin", heartwoodRelease);
|
||||
process.env.PATH = [binaryPath, process.env.PATH].join(Path.delimiter);
|
||||
|
||||
// Assert that the `rad` CLI is installed and has the correct version.
|
||||
@@ -41,9 +42,9 @@ export async function assertRadInstalled(): Promise<void> {
|
||||
);
|
||||
}
|
||||
const { stdout: version } = await execa("rad", ["--version"]);
|
||||
if (!version.includes(heartwoodShortSha)) {
|
||||
if (!version.includes(heartwoodRelease)) {
|
||||
throw new Error(
|
||||
`rad version ${version} does not satisfy ${heartwoodShortSha}`,
|
||||
`rad version ${version} does not satisfy ${heartwoodRelease}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user