Skip to content

Commit 510c828

Browse files
install amd64 version of @pact-foundation if missing
1 parent 92d4c60 commit 510c828

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/pact-tests/run-pact-tests.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ set -euo pipefail
66
# Rebuild optional native bindings for the current platform without resolving new versions.
77
npm rebuild --include=optional @pact-foundation/pact @pact-foundation/pact-core
88

9+
# CI runners can restore node_modules generated on a different architecture.
10+
# Ensure Pact's native prebuild for Linux x64 glibc is present before loading pact-core.
11+
if [[ "$(uname -s)" == "Linux" && "$(uname -m)" == "x86_64" ]]; then
12+
if ! node -e "require.resolve('@pact-foundation/pact-core-linux-x64-glibc')" >/dev/null 2>&1; then
13+
PACT_CORE_VERSION="$(node -p "(() => { try { return require('@pact-foundation/pact/node_modules/@pact-foundation/pact-core/package.json').version; } catch { return require('@pact-foundation/pact-core/package.json').version; } })()")"
14+
npm install --no-save --include=optional "@pact-foundation/pact-core-linux-x64-glibc@${PACT_CORE_VERSION}"
15+
fi
16+
fi
17+
918
# Remove old PACTs
1019
rm -rf ./.pacts
1120

0 commit comments

Comments
 (0)