Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
devops: start publishing canary at midnight every day (#5343)
Andrey Lushnikov1240dd48cbd0
diff --git a/.github/workflows/infra.yml b/.github/workflows/infra.ymlindex c2b32aa7e6..777efef4a7 100644--- a/.github/workflows/infra.yml+++ b/.github/workflows/infra.yml@@ -35,5 +35,5 @@ jobs:- uses: microsoft/playwright-github-action@v1- run: npm ci- run: npm run build- - run: node utils/build/update_canary_version.js+ - run: node utils/build/update_canary_version.js --today-date- run: utils/build/build-playwright-driver.shdiff --git a/.github/workflows/publish_canary_driver.yml b/.github/workflows/publish_canary_driver.ymlindex 6f4d74a4d2..96f118f23b 100644--- a/.github/workflows/publish_canary_driver.yml+++ b/.github/workflows/publish_canary_driver.yml@@ -20,7 +20,7 @@ jobs:- uses: microsoft/playwright-github-action@v1- run: npm ci- run: npm run build- - run: node utils/build/update_canary_version.js+ - run: node utils/build/update_canary_version.js --commit-timestamp- run: utils/build/build-playwright-driver.sh- run: utils/build/upload-playwright-driver.shenv:diff --git a/.github/workflows/publish_canary_npm.yml b/.github/workflows/publish_canary_npm.ymlindex a9d67c3789..64150fa1c4 100644--- a/.github/workflows/publish_canary_npm.yml+++ b/.github/workflows/publish_canary_npm.yml@@ -1,9 +1,10 @@name: "devrelease:npm"on:+ schedule:+ - cron: "10 0 * * *"push:branches:- - master- release-*jobs:@@ -20,7 +21,10 @@ jobs:- uses: microsoft/playwright-github-action@v1- run: npm ci- run: npm run build- # publish_all_packages.sh updates the version automatically+ - run: node utils/build/update_canary_version.js --today-date+ if: contains(github.ref, "master")+ - run: node utils/build/update_canary_version.js --commit-timestamp+ if: contains(github.ref, "release")- run: utils/publish_all_packages.sh --tip-of-treeenv:NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}diff --git a/utils/build/update_canary_version.js b/utils/build/update_canary_version.jsindex 582dc4d45f..337dd96cad 100755--- a/utils/build/update_canary_version.js+++ b/utils/build/update_canary_version.js@@ -19,10 +19,20 @@ const fs = require('fs');const path = require('path');const { execSync } = require('child_process');-const timestamp = execSync('git show -s --format=%ct HEAD', {- stdio: ['ignore', 'pipe', 'ignore']-}).toString('utf8').trim() + '000';const packageJSON = require('../../package.json');-packageJSON.version = packageJSON.version + '-' + timestamp;+if (process.argv[2] === '--today-date') {+ const date = new Date();+ const month = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'][date.getMonth()];+ const day = date.getDate();+ const year = date.getFullYear();+ packageJSON.version = `${packageJSON.version}-alpha-${month}-${day}-${year}`;+} else if (prcess.argv[2] === '--commit-timestamp') {+ const timestamp = execSync('git show -s --format=%ct HEAD', {+ stdio: ['ignore', 'pipe', 'ignore']+ }).toString('utf8').trim();+ packageJSON.version = `${packageJSON.version}-${timestamp}000`;+} else {+ throw new Error('This script must be run with either --timestamp or --today-date parameter');+}console.log('Setting version to ' + packageJSON.version);fs.writeFileSync(path.join(__dirname, '..', '..', 'package.json'), JSON.stringify(packageJSON, undefined, 2) + '\n');diff --git a/utils/publish_all_packages.sh b/utils/publish_all_packages.shindex 2305088e47..92bf3cfb59 100755--- a/utils/publish_all_packages.sh+++ b/utils/publish_all_packages.sh@@ -41,19 +41,15 @@ ficd ..-if [[ -n $(git status -s) ]]; then- echo "ERROR: git status is dirty; some uncommitted changes or untracked files"- exit 1-fi-NPM_PUBLISH_TAG="next"-if [[ $1 == "--tip-of-tree" ]]; then- node utils/build/update_canary_version.js-fiVERSION=$(node -e 'console.log(require("./package.json").version)')if [[ $1 == "--release" ]]; then+ if [[ -n $(git status -s) ]]; then+ echo "ERROR: git status is dirty; some uncommitted changes or untracked files"+ exit 1+ fi# Ensure package version does not contain dash.if [[ "${VERSION}" == *-* ]]; thenecho "ERROR: cannot publish pre-release version with --release flag"@@ -61,6 +57,10 @@ if [[ $1 == "--release" ]]; thenfiNPM_PUBLISH_TAG="latest"elif [[ $1 == "--tip-of-tree" ]]; then+ if [[ $(git status -s) != " M package.json" ]]; then+ echo "ERROR: git status is unexpected; some uncommitted changes or untracked files"+ exit 1+ fi# Ensure package version contains dash.if [[ "${VERSION}" != *-* ]]; thenecho "ERROR: cannot publish release version with --tip-of-tree flag"