Skip to content

Commit

Permalink
fixup! feat: add a custom node script that adds codspeed v8 flags
Browse files Browse the repository at this point in the history
  • Loading branch information
adriencaccia committed Jun 27, 2023
1 parent a059d30 commit 2e63b1d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dist/bin/node
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#!/bin/bash
set -eo pipefail

# Custom script to replace node and run with V8 flags that make the execution of the
# benchmarks more predictable.
# Depending on the version of node, some flags may be deprecated.

# 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)

Expand Down Expand Up @@ -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[@]}" "$@"

0 comments on commit 2e63b1d

Please sign in to comment.