mirror of
https://github.com/hanzoai/playwright.git
synced 2026-09-24 17:01:53 +00:00
devops: remove unused driver publishing (#41518)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Skn0tt <[email protected]>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: "publish release - npm, driver, trace viewer"
|
||||
name: "publish release - npm, trace viewer"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -11,14 +11,13 @@ on:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
publish-npm-and-driver:
|
||||
name: "publish NPM and driver"
|
||||
publish-npm:
|
||||
name: "publish NPM"
|
||||
runs-on: ubuntu-24.04
|
||||
if: github.repository == 'microsoft/playwright'
|
||||
permissions:
|
||||
id-token: write # This is required for OIDC login (azure/login, NPM publish) to succeed
|
||||
id-token: write # This is required for OIDC login (NPM publish) to succeed
|
||||
contents: read # This is required for actions/checkout to succeed
|
||||
environment: allow-publish-driver-to-cdn # This is required for OIDC login (azure/login)
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-node@v6
|
||||
@@ -50,19 +49,6 @@ jobs:
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
run: utils/publish_all_packages.sh --release
|
||||
|
||||
- name: Azure Login
|
||||
uses: azure/login@v3
|
||||
with:
|
||||
client-id: ${{ secrets.AZURE_PW_CDN_CLIENT_ID }}
|
||||
tenant-id: ${{ secrets.AZURE_PW_CDN_TENANT_ID }}
|
||||
subscription-id: ${{ secrets.AZURE_PW_CDN_SUBSCRIPTION_ID }}
|
||||
- name: build & publish driver
|
||||
env:
|
||||
AZ_UPLOAD_FOLDER: ${{ github.event_name == 'release' && 'driver' || 'driver/next' }}
|
||||
run: |
|
||||
utils/build/build-playwright-driver.sh
|
||||
utils/build/upload-playwright-driver.sh
|
||||
|
||||
publish-trace-viewer:
|
||||
name: "publish Trace Viewer to trace.playwright.dev"
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
@@ -179,18 +179,6 @@ jobs:
|
||||
env:
|
||||
PWTEST_CHANNEL: ${{ matrix.channel }}
|
||||
|
||||
build-playwright-driver:
|
||||
name: "build-playwright-driver"
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: utils/build/build-playwright-driver.sh
|
||||
|
||||
test_android:
|
||||
name: Android
|
||||
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
|
||||
|
||||
@@ -17,11 +17,9 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import { PipeTransport } from '@utils/pipeTransport';
|
||||
import { gracefullyProcessExitDoNotHang } from '@utils/processLauncher';
|
||||
import { packageRoot } from '../package';
|
||||
import { playwright } from '../inprocess';
|
||||
import { PlaywrightServer } from '../remote/playwrightServer';
|
||||
import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlaywright } from '../server';
|
||||
@@ -29,11 +27,6 @@ import { DispatcherConnection, PlaywrightDispatcher, RootDispatcher, createPlayw
|
||||
import type { BrowserType } from '../client/browserType';
|
||||
import type { LaunchServerOptions } from '../client/types';
|
||||
|
||||
export function printApiJson() {
|
||||
// Note: this file is generated by build-playwright-driver.sh
|
||||
console.log(JSON.stringify(require(path.join(packageRoot, 'api.json'))));
|
||||
}
|
||||
|
||||
export function runDriver() {
|
||||
const dispatcherConnection = new DispatcherConnection();
|
||||
new RootDispatcher(dispatcherConnection, async (rootScope, { sdkLanguage }) => {
|
||||
|
||||
@@ -22,7 +22,7 @@ import { gracefullyProcessExitDoNotHang } from '@utils/processLauncher';
|
||||
import { getPackageManagerExecCommand } from '@utils/env';
|
||||
import { packageJSON } from '../package';
|
||||
import { addTraceCommands } from '../tools/trace/traceCli';
|
||||
import { runDriver, runServer, printApiJson, launchBrowserServer } from './driver';
|
||||
import { runDriver, runServer, launchBrowserServer } from './driver';
|
||||
import { markDockerImage } from './installActions';
|
||||
import { open, codegen } from './browserActions';
|
||||
import { installBrowsers, uninstallBrowsers, installDeps } from './installActions';
|
||||
@@ -194,12 +194,6 @@ export function decorateProgram(program: Command) {
|
||||
}).catch(logErrorAndExit);
|
||||
});
|
||||
|
||||
program
|
||||
.command('print-api-json', { hidden: true })
|
||||
.action(async function(options) {
|
||||
printApiJson();
|
||||
});
|
||||
|
||||
program
|
||||
.command('launch-server', { hidden: true })
|
||||
.requiredOption('--browser <browserName>', 'Browser name, one of "chromium", "firefox" or "webkit"')
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
trap "cd $(pwd -P)" EXIT
|
||||
SCRIPT_PATH="$(cd "$(dirname "$0")" ; pwd -P)"
|
||||
NODE_VERSION="24.18.0" # autogenerated via ./update-playwright-node.mjs
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
PACKAGE_VERSION=$(node -p "require('../../package.json').version")
|
||||
rm -rf ./output
|
||||
mkdir -p ./output
|
||||
|
||||
echo "Building playwright-core package"
|
||||
node ../../utils/pack_package.js playwright-core ./output/playwright-core.tgz
|
||||
|
||||
echo "Building api.json and protocol.yml"
|
||||
API_JSON_MODE=1 node ../../utils/doclint/generateApiJson.js > ./output/api.json
|
||||
node ../../utils/protocol_spec.js > ./output/protocol.yml
|
||||
|
||||
function build {
|
||||
NODE_DIR=$1
|
||||
SUFFIX=$2
|
||||
ARCHIVE=$3
|
||||
NODE_URL=https://nodejs.org/dist/v${NODE_VERSION}/${NODE_DIR}.${ARCHIVE}
|
||||
|
||||
echo "Building playwright-${PACKAGE_VERSION}-${SUFFIX}"
|
||||
|
||||
cd ${SCRIPT_PATH}
|
||||
|
||||
mkdir -p ./output/playwright-${SUFFIX}
|
||||
tar -xzf ./output/playwright-core.tgz -C ./output/playwright-${SUFFIX}/
|
||||
|
||||
curl --retry 10 --retry-all-errors ${NODE_URL} -o ./output/${NODE_DIR}.${ARCHIVE}
|
||||
NPM_PATH=""
|
||||
if [[ "${ARCHIVE}" == "zip" ]]; then
|
||||
cd ./output
|
||||
unzip -q ./${NODE_DIR}.zip
|
||||
cd ..
|
||||
cp ./output/${NODE_DIR}/node.exe ./output/playwright-${SUFFIX}/
|
||||
NPM_PATH="node_modules/npm/bin/npm-cli.js"
|
||||
elif [[ "${ARCHIVE}" == "tar.gz" ]]; then
|
||||
tar -xzf ./output/${NODE_DIR}.tar.gz -C ./output/
|
||||
cp ./output/${NODE_DIR}/bin/node ./output/playwright-${SUFFIX}/
|
||||
NPM_PATH="lib/node_modules/npm/bin/npm-cli.js"
|
||||
else
|
||||
echo "Unsupported ARCHIVE ${ARCHIVE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp ./output/${NODE_DIR}/LICENSE ./output/playwright-${SUFFIX}/
|
||||
cp ./output/api.json ./output/playwright-${SUFFIX}/package/
|
||||
cp ./output/protocol.yml ./output/playwright-${SUFFIX}/package/
|
||||
cd ./output/playwright-${SUFFIX}/package
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 node "../../${NODE_DIR}/${NPM_PATH}" install --omit=dev --ignore-scripts
|
||||
rm package-lock.json
|
||||
|
||||
cd ..
|
||||
|
||||
# NPM install does intentionally set the modification date back to 1985 for all the files. This confuses language binding
|
||||
# update mechanisms, which expect the modification date to be recent to decide which file to override. See:
|
||||
# - https://github.com/npm/npm/issues/20439#issuecomment-385121133
|
||||
# - https://github.com/microsoft/playwright-dotnet/issues/2069
|
||||
find . -type f -exec touch {} +
|
||||
|
||||
zip -q -r ../playwright-${PACKAGE_VERSION}-${SUFFIX}.zip .
|
||||
}
|
||||
|
||||
build "node-v${NODE_VERSION}-darwin-x64" "mac" "tar.gz"
|
||||
build "node-v${NODE_VERSION}-darwin-arm64" "mac-arm64" "tar.gz"
|
||||
build "node-v${NODE_VERSION}-linux-x64" "linux" "tar.gz"
|
||||
build "node-v${NODE_VERSION}-linux-arm64" "linux-arm64" "tar.gz"
|
||||
build "node-v${NODE_VERSION}-win-x64" "win32_x64" "zip"
|
||||
build "node-v${NODE_VERSION}-win-arm64" "win32_arm64" "zip"
|
||||
@@ -19,14 +19,11 @@ import path from 'path';
|
||||
import https from 'https';
|
||||
|
||||
const currentFilePath = url.fileURLToPath(import.meta.url);
|
||||
const buildFilePath = path.join(path.dirname(currentFilePath), 'build-playwright-driver.sh');
|
||||
const dockerDirectory = path.join(path.dirname(currentFilePath), '../docker');
|
||||
const dockerfilePaths = await getDockerfilePaths(dockerDirectory);
|
||||
|
||||
const latestNodeJsLts = await getLatestNodeJsVersion();
|
||||
|
||||
if (refreshBuildScriptVersionNumber(latestNodeJsLts, buildFilePath))
|
||||
console.log(`Updated build script ${path.relative(process.cwd(), buildFilePath)} to Node.js ${latestNodeJsLts}`);
|
||||
for (const dockerfilePath of dockerfilePaths) {
|
||||
const nodeMajorVersion = latestNodeJsLts.split('.')[0];
|
||||
if (refreshDockerfileVersionNumber(nodeMajorVersion, dockerfilePath))
|
||||
@@ -63,11 +60,6 @@ function replaceVersionInFile(filePath, newNodeJsVersion, replacementRegex) {
|
||||
return fileContent !== newFileContent;
|
||||
}
|
||||
|
||||
function refreshBuildScriptVersionNumber(newNodeJsVersion, buildScriptPath) {
|
||||
const replacementRegex = new RegExp(`(NODE_VERSION=")(.*)(" # autogenerated via \\.\/${path.basename(currentFilePath).replace('.', '\\.')})`);
|
||||
return replaceVersionInFile(buildScriptPath, newNodeJsVersion, replacementRegex);
|
||||
}
|
||||
|
||||
function refreshDockerfileVersionNumber(newNodeJsVersion, dockerfilePath) {
|
||||
const replacementRegex = new RegExp(`(ARG NODE_VERSION=)(.*)( # autogenerated via \\.\/${path.basename(currentFilePath).replace('.', '\\.')})`);
|
||||
return replaceVersionInFile(dockerfilePath, newNodeJsVersion, replacementRegex);
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set +x
|
||||
|
||||
trap "cd $(pwd -P)" EXIT
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
AZ_STORAGE_ACCOUNT="playwright2"
|
||||
PACKAGE_VERSION=$(node -p "require('../../package.json').version")
|
||||
|
||||
platforms=("mac" "mac-arm64" "linux" "linux-arm64" "win32_x64" "win32_arm64")
|
||||
|
||||
for platform in "${platforms[@]}"; do
|
||||
az storage blob upload -c builds --auth-mode login --account-name ${AZ_STORAGE_ACCOUNT} -f ./output/playwright-${PACKAGE_VERSION}-${platform}.zip -n "${AZ_UPLOAD_FOLDER}/playwright-${PACKAGE_VERSION}-${platform}.zip"
|
||||
done
|
||||
Reference in New Issue
Block a user