From 2e63b1de603bffdc5e6e1ae3bcd1de9319360413 Mon Sep 17 00:00:00 2001 From: Adrien Cacciaguerra Date: Tue, 27 Jun 2023 11:04:52 +0200 Subject: [PATCH] fixup! feat: add a custom node script that adds codspeed v8 flags --- dist/bin/node | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dist/bin/node b/dist/bin/node index 3d48850..0948055 100755 --- a/dist/bin/node +++ b/dist/bin/node @@ -1,4 +1,5 @@ #!/bin/bash +set -eo pipefail # Custom script to replace node and run with V8 flags that make the execution of the # benchmarks more predictable. @@ -6,6 +7,11 @@ # Retrieve the original path by removing the folder containing CodSpeedHQ/action from the path. ORIGINAL_PATH=$(echo "$PATH" | tr ":" "\n" | grep -v "CodSpeedHQ/action" | tr "\n" ":") +# Check if node is in the path. +if ! command -v node &>/dev/null; then + echo "Error: node not found in PATH. There might be a problem with the node installation." + exit 1 +fi # Save the real node path. REAL_NODE_PATH=$(env PATH="$ORIGINAL_PATH" which node) @@ -36,7 +42,7 @@ if [ "$NODE_MAJOR_VERSION" -lt 20 ]; then fi echo "::debug::Running the CodSpeed node script, the node command that will be run:" -echo "::debug::node" "${V8_FLAGS[@]}" "$@" +echo "::debug::$REAL_NODE_PATH" "${V8_FLAGS[@]}" "$@" # Call the real "node" command with any arguments passed to this script. $REAL_NODE_PATH "${V8_FLAGS[@]}" "$@"