diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db9f7821..82cdd5bf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -140,7 +140,7 @@ jobs: - name: Bundle Directory if: ${{ steps.prep.outputs.asset_id == '' }} - run: bash ./scripts/bundle.sh + run: bash ./scripts/bundle-win.sh - name: List Bundle Contents if: ${{ steps.prep.outputs.asset_id == '' }} @@ -211,7 +211,7 @@ jobs: - name: Bundle Directory if: ${{ steps.prep.outputs.asset_id == '' }} - run: bash ./scripts/bundle.sh + run: bash ./scripts/bundle-mac.sh - name: List Bundle Contents if: ${{ steps.prep.outputs.asset_id == '' }} diff --git a/scripts/bundle-mac.sh b/scripts/bundle-mac.sh new file mode 100644 index 00000000..f59e4315 --- /dev/null +++ b/scripts/bundle-mac.sh @@ -0,0 +1,35 @@ +set -e +echo "Using: $(which node)" +export PLAYWRIGHT_BROWSERS_PATH=$PWD/bundle/Cache/ +echo $PLAYWRIGHT_BROWSERS_PATH +NODE_VERSION=$(node --version) +NODE_URL="https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-darwin-x64.tar.gz" +NODE_TAR_FILE="node-$NODE_VERSION-darwin-x64.tar.gz" +NODE_DIR="node-$NODE_VERSION-darwin-x64" + +rm -rf ./bundle/ +mkdir ./bundle/ + +# Build src +npm ci +npm run build +cp -r ./lib/ ./bundle/lib/ + +cp -r bin/ bundle/bin/ +cp package.json bundle/package.json +cp package-lock.json bundle/package-lock.json +wget $NODE_URL +tar xf $NODE_TAR_FILE +mv $NODE_DIR bundle/node + +pushd bundle/ + +npm cache clean --force +npm ci --omit=dev + + +npx playwright install +npx playwright install-deps +npx playwright --version + +popd diff --git a/scripts/bundle.sh b/scripts/bundle-win.sh similarity index 77% rename from scripts/bundle.sh rename to scripts/bundle-win.sh index 43893a8c..0673a783 100644 --- a/scripts/bundle.sh +++ b/scripts/bundle-win.sh @@ -2,6 +2,10 @@ set -e echo "Using: $(which node)" export PLAYWRIGHT_BROWSERS_PATH=$PWD/bundle/Cache/ echo $PLAYWRIGHT_BROWSERS_PATH +NODE_VERSION=$(node --version) +NODE_URL="https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-win-x64.zip" +NODE_TAR_FILE="node-$NODE_VERSION-darwin-x64.tar.gz" +NODE_DIR="node-$NODE_VERSION-darwin-x64" rm -rf ./bundle/ mkdir ./bundle/ @@ -14,9 +18,9 @@ cp -r ./lib/ ./bundle/lib/ cp -r bin/ bundle/bin/ cp package.json bundle/package.json cp package-lock.json bundle/package-lock.json -wget "https://nodejs.org/dist/v18.17.1/node-v18.17.1-darwin-x64.tar.gz" -tar xf node-v18.17.1-darwin-x64.tar.gz -mv node-v18.17.1-darwin-x64 bundle/node +wget $NODE_URL +tar xf $NODE_TAR_FILE +mv $NODE_DIR bundle/node pushd bundle/ diff --git a/src/playwright-runner.ts b/src/playwright-runner.ts index 3c8bc60c..498ffe98 100644 --- a/src/playwright-runner.ts +++ b/src/playwright-runner.ts @@ -169,7 +169,6 @@ async function run(nodeBin: string, runCfgPath: string, suiteName: string) { console.log(`Sauce Playwright Runner ${packageInfo.version}`); console.log(`Running Playwright ${packageInfo.dependencies?.playwright || ''}`); - nodeBin = `${path.dirname(nodeBin)}/node/bin/${path.basename(nodeBin)}`; console.log('nodeBin: ', nodeBin) let result: RunResult; @@ -281,6 +280,7 @@ async function runPlaywright(nodeBin: string, runCfg: RunnerConfig): Promise