devops: make README.md to always reflect tip-of-tree (#1911)
As of today, we have tooling in place that makes sure that our main README.md **roughly** represents the state of the last release: - browser versions and browser badges are those that we released last - links to our API point to the last-released API version This tooling, however, relies on the fact that every release is a sequence of two consecutive commits: - one commit that sets `package.json` version to a released version - the following that "bumps" version to `-post`. This release process is very unfortunate, because: - it made releasing from branch impossible - it required "freezing" commits to the master branch This patch removes all the tooling and transitions `README.md` to always represent tip-of-tree state. We will fully rely on `https://playwright.dev` to show versioned docs.
This commit is contained in:
parent
2313cebdca
commit
89007c8f3d
|
|
@ -1,16 +1,16 @@
|
||||||
# 🎭 Playwright
|
# 🎭 Playwright
|
||||||
[](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge-if-release -->[](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge-if-release -->[](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> [](https://webkit.org/) [](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg)
|
[](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> [](https://webkit.org/) [](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg)
|
||||||
|
|
||||||
###### [API](https://github.com/microsoft/playwright/blob/v0.13.0/docs/api.md) | [Changelog](https://github.com/microsoft/playwright/releases) | [FAQ](#faq) | [Contributing](#contributing)
|
###### [API](https://github.com/microsoft/playwright/blob/master/docs/api.md) | [Changelog](https://github.com/microsoft/playwright/releases) | [FAQ](#faq) | [Contributing](#contributing)
|
||||||
|
|
||||||
|
|
||||||
Playwright is a Node library to automate the [Chromium](https://www.chromium.org/Home), [WebKit](https://webkit.org/) and [Firefox](https://www.mozilla.org/en-US/firefox/new/) browsers with a single API. It enables **cross-browser** web automation that is **ever-green**, **capable**, **reliable** and **fast**.
|
Playwright is a Node library to automate the [Chromium](https://www.chromium.org/Home), [WebKit](https://webkit.org/) and [Firefox](https://www.mozilla.org/en-US/firefox/new/) browsers with a single API. It enables **cross-browser** web automation that is **ever-green**, **capable**, **reliable** and **fast**.
|
||||||
|
|
||||||
| | ver | Linux | macOS | Win |
|
| | ver | Linux | macOS | Win |
|
||||||
| ---: | :---: | :---: | :---: | :---: |
|
| ---: | :---: | :---: | :---: | :---: |
|
||||||
| Chromium| <!-- GEN:chromium-version-if-release-->83.0.4101.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| Chromium| <!-- GEN:chromium-version GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||||
| WebKit | 13.0.4 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| WebKit | 13.0.4 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||||
| Firefox | <!-- GEN:firefox-version-if-release -->75.0b8<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| Firefox | <!-- GEN:firefox-version -->76.0b5<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||||
- Headless is supported for all the browsers on all platforms.
|
- Headless is supported for all the browsers on all platforms.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
# Playwright API <!-- GEN:version -->Tip-Of-Tree<!-- GEN:stop-->
|
# Playwright API <!-- GEN:version -->Tip-Of-Tree<!-- GEN:stop-->
|
||||||
<!-- GEN:empty-if-release --><!-- GEN:stop -->
|
|
||||||
|
|
||||||
##### Table of Contents
|
##### Table of Contents
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ async function run() {
|
||||||
chromiumVersion: browserVersions.chromium,
|
chromiumVersion: browserVersions.chromium,
|
||||||
firefoxVersion: browserVersions.firefox,
|
firefoxVersion: browserVersions.firefox,
|
||||||
})));
|
})));
|
||||||
messages.push(...await preprocessor.ensureReleasedAPILinks([readme], VERSION));
|
|
||||||
messages.push(...preprocessor.ensureInternalLinksAreValid([api]));
|
messages.push(...preprocessor.ensureInternalLinksAreValid([api]));
|
||||||
|
|
||||||
const browser = await playwright.chromium.launch();
|
const browser = await playwright.chromium.launch();
|
||||||
|
|
|
||||||
|
|
@ -16,21 +16,6 @@
|
||||||
|
|
||||||
const Message = require('../Message');
|
const Message = require('../Message');
|
||||||
|
|
||||||
function ensureReleasedAPILinks(sources, libversion) {
|
|
||||||
// Release version is everything that doesn't include "-".
|
|
||||||
const apiLinkRegex = /https:\/\/github.com\/microsoft\/playwright\/blob\/v[^/]*\/docs\/api.md/ig;
|
|
||||||
const lastReleasedAPI = `https://github.com/microsoft/playwright/blob/v${libversion.split('-')[0]}/docs/api.md`;
|
|
||||||
|
|
||||||
const messages = [];
|
|
||||||
for (const source of sources) {
|
|
||||||
const text = source.text();
|
|
||||||
const newText = text.replace(apiLinkRegex, lastReleasedAPI);
|
|
||||||
if (source.setText(newText))
|
|
||||||
messages.push(Message.warning(`GEN: updated ${source.projectPath()}`));
|
|
||||||
}
|
|
||||||
return messages;
|
|
||||||
};
|
|
||||||
|
|
||||||
function runCommands(sources, {libversion, chromiumVersion, firefoxVersion}) {
|
function runCommands(sources, {libversion, chromiumVersion, firefoxVersion}) {
|
||||||
// Release version is everything that doesn't include "-".
|
// Release version is everything that doesn't include "-".
|
||||||
const isReleaseVersion = !libversion.includes('-');
|
const isReleaseVersion = !libversion.includes('-');
|
||||||
|
|
@ -66,16 +51,14 @@ function runCommands(sources, {libversion, chromiumVersion, firefoxVersion}) {
|
||||||
let newText = null;
|
let newText = null;
|
||||||
if (command.name === 'version')
|
if (command.name === 'version')
|
||||||
newText = isReleaseVersion ? 'v' + libversion : 'Tip-Of-Tree';
|
newText = isReleaseVersion ? 'v' + libversion : 'Tip-Of-Tree';
|
||||||
else if (command.name === 'empty-if-release')
|
else if (command.name === 'chromium-version')
|
||||||
newText = isReleaseVersion ? '' : command.originalText;
|
newText = chromiumVersion;
|
||||||
else if (command.name === 'chromium-version-if-release')
|
else if (command.name === 'firefox-version')
|
||||||
newText = isReleaseVersion ? chromiumVersion : command.originalText;
|
newText = firefoxVersion;
|
||||||
else if (command.name === 'firefox-version-if-release')
|
else if (command.name === 'chromium-version-badge')
|
||||||
newText = isReleaseVersion ? firefoxVersion : command.originalText;
|
newText = `[](https://www.chromium.org/Home)`;
|
||||||
else if (command.name === 'chromium-version-badge-if-release')
|
else if (command.name === 'firefox-version-badge')
|
||||||
newText = isReleaseVersion ? `[](https://www.chromium.org/Home)` : command.originalText;
|
newText = `[](https://www.mozilla.org/en-US/firefox/new/)`;
|
||||||
else if (command.name === 'firefox-version-badge-if-release')
|
|
||||||
newText = isReleaseVersion ? `[](https://www.mozilla.org/en-US/firefox/new/)` : command.originalText;
|
|
||||||
else if (command.name === 'toc')
|
else if (command.name === 'toc')
|
||||||
newText = generateTableOfContents(command.source.text(), command.to, false /* topLevelOnly */);
|
newText = generateTableOfContents(command.source.text(), command.to, false /* topLevelOnly */);
|
||||||
else if (command.name === 'toc-top-level')
|
else if (command.name === 'toc-top-level')
|
||||||
|
|
@ -194,4 +177,4 @@ function generateTableOfContentsForSuperclass(text, name) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {ensureInternalLinksAreValid, runCommands, ensureReleasedAPILinks};
|
module.exports = {ensureInternalLinksAreValid, runCommands};
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const {runCommands, ensureReleasedAPILinks} = require('.');
|
const {runCommands, ensureTipOfTreeAPILinks} = require('.');
|
||||||
const Source = require('../Source');
|
const Source = require('../Source');
|
||||||
const TestRunner = require('../../testrunner/');
|
const TestRunner = require('../../testrunner/');
|
||||||
const runner = new TestRunner();
|
const runner = new TestRunner();
|
||||||
|
|
@ -24,43 +24,6 @@ const {it, fit, xit} = runner.api();
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = runner.api();
|
const {beforeAll, beforeEach, afterAll, afterEach} = runner.api();
|
||||||
const {expect} = runner.api();
|
const {expect} = runner.api();
|
||||||
|
|
||||||
describe('ensureReleasedAPILinks', function() {
|
|
||||||
it('should work with non-release version', function() {
|
|
||||||
const source = new Source('doc.md', `
|
|
||||||
[API](https://github.com/microsoft/playwright/blob/v1.1.0/docs/api.md#class-page)
|
|
||||||
`);
|
|
||||||
const messages = ensureReleasedAPILinks([source], '1.3.0-post');
|
|
||||||
expect(messages.length).toBe(1);
|
|
||||||
expect(messages[0].type).toBe('warning');
|
|
||||||
expect(messages[0].text).toContain('doc.md');
|
|
||||||
expect(source.text()).toBe(`
|
|
||||||
[API](https://github.com/microsoft/playwright/blob/v1.3.0/docs/api.md#class-page)
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
it('should work with release version', function() {
|
|
||||||
const source = new Source('doc.md', `
|
|
||||||
[API](https://github.com/microsoft/playwright/blob/v1.1.0/docs/api.md#class-page)
|
|
||||||
`);
|
|
||||||
const messages = ensureReleasedAPILinks([source], '1.3.0');
|
|
||||||
expect(messages.length).toBe(1);
|
|
||||||
expect(messages[0].type).toBe('warning');
|
|
||||||
expect(messages[0].text).toContain('doc.md');
|
|
||||||
expect(source.text()).toBe(`
|
|
||||||
[API](https://github.com/microsoft/playwright/blob/v1.3.0/docs/api.md#class-page)
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
it('should keep master links intact', function() {
|
|
||||||
const source = new Source('doc.md', `
|
|
||||||
[API](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page)
|
|
||||||
`);
|
|
||||||
const messages = ensureReleasedAPILinks([source], '1.3.0');
|
|
||||||
expect(messages.length).toBe(0);
|
|
||||||
expect(source.text()).toBe(`
|
|
||||||
[API](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page)
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('runCommands', function() {
|
describe('runCommands', function() {
|
||||||
const OPTIONS_REL = {
|
const OPTIONS_REL = {
|
||||||
libversion: '1.3.0',
|
libversion: '1.3.0',
|
||||||
|
|
@ -95,7 +58,7 @@ describe('runCommands', function() {
|
||||||
Playwright <!-- gen:version -->v1.3.0<!-- gen:stop -->
|
Playwright <!-- gen:version -->v1.3.0<!-- gen:stop -->
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
it('should work for *-post versions', function() {
|
it('should work for pre-release versions', function() {
|
||||||
const source = new Source('doc.md', `
|
const source = new Source('doc.md', `
|
||||||
Playwright <!-- gen:version -->XXX<!-- gen:stop -->
|
Playwright <!-- gen:version -->XXX<!-- gen:stop -->
|
||||||
`);
|
`);
|
||||||
|
|
@ -122,30 +85,6 @@ describe('runCommands', function() {
|
||||||
expect(messages[0].text).toContain(`Failed to find 'gen:stop'`);
|
expect(messages[0].text).toContain(`Failed to find 'gen:stop'`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('gen:empty-if-release', function() {
|
|
||||||
it('should clear text when release version', function() {
|
|
||||||
const source = new Source('doc.md', `
|
|
||||||
<!-- gen:empty-if-release -->XXX<!-- gen:stop -->
|
|
||||||
`);
|
|
||||||
const messages = runCommands([source], OPTIONS_REL);
|
|
||||||
expect(messages.length).toBe(1);
|
|
||||||
expect(messages[0].type).toBe('warning');
|
|
||||||
expect(messages[0].text).toContain('doc.md');
|
|
||||||
expect(source.text()).toBe(`
|
|
||||||
<!-- gen:empty-if-release --><!-- gen:stop -->
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
it('should keep text when non-release version', function() {
|
|
||||||
const source = new Source('doc.md', `
|
|
||||||
<!-- gen:empty-if-release -->XXX<!-- gen:stop -->
|
|
||||||
`);
|
|
||||||
const messages = runCommands([source], OPTIONS_DEV);
|
|
||||||
expect(messages.length).toBe(0);
|
|
||||||
expect(source.text()).toBe(`
|
|
||||||
<!-- gen:empty-if-release -->XXX<!-- gen:stop -->
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('gen:toc', function() {
|
describe('gen:toc', function() {
|
||||||
it('should work', () => {
|
it('should work', () => {
|
||||||
const source = new Source('doc.md', `<!-- gen:toc -->XXX<!-- gen:stop -->
|
const source = new Source('doc.md', `<!-- gen:toc -->XXX<!-- gen:stop -->
|
||||||
|
|
@ -231,7 +170,6 @@ describe('runCommands', function() {
|
||||||
it('should work with multiple commands', function() {
|
it('should work with multiple commands', function() {
|
||||||
const source = new Source('doc.md', `
|
const source = new Source('doc.md', `
|
||||||
<!-- gen:version -->xxx<!-- gen:stop -->
|
<!-- gen:version -->xxx<!-- gen:stop -->
|
||||||
<!-- gen:empty-if-release -->yyy<!-- gen:stop -->
|
|
||||||
<!-- gen:version -->zzz<!-- gen:stop -->
|
<!-- gen:version -->zzz<!-- gen:stop -->
|
||||||
`);
|
`);
|
||||||
const messages = runCommands([source], OPTIONS_REL);
|
const messages = runCommands([source], OPTIONS_REL);
|
||||||
|
|
@ -240,55 +178,34 @@ describe('runCommands', function() {
|
||||||
expect(messages[0].text).toContain('doc.md');
|
expect(messages[0].text).toContain('doc.md');
|
||||||
expect(source.text()).toBe(`
|
expect(source.text()).toBe(`
|
||||||
<!-- gen:version -->v1.3.0<!-- gen:stop -->
|
<!-- gen:version -->v1.3.0<!-- gen:stop -->
|
||||||
<!-- gen:empty-if-release --><!-- gen:stop -->
|
|
||||||
<!-- gen:version -->v1.3.0<!-- gen:stop -->
|
<!-- gen:version -->v1.3.0<!-- gen:stop -->
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
describe('gen:chromium-version-if-release', function() {
|
describe('gen:chromium-version', function() {
|
||||||
it('should work for release', function() {
|
it('should work', function() {
|
||||||
const source = new Source('doc.md', `
|
const source = new Source('doc.md', `
|
||||||
Playwright <!-- gen:chromium-version-if-release -->XXX<!-- gen:stop -->
|
Playwright <!-- gen:chromium-version -->XXX<!-- gen:stop -->
|
||||||
`);
|
`);
|
||||||
const messages = runCommands([source], OPTIONS_REL);
|
const messages = runCommands([source], OPTIONS_REL);
|
||||||
expect(messages.length).toBe(1);
|
expect(messages.length).toBe(1);
|
||||||
expect(messages[0].type).toBe('warning');
|
expect(messages[0].type).toBe('warning');
|
||||||
expect(messages[0].text).toContain('doc.md');
|
expect(messages[0].text).toContain('doc.md');
|
||||||
expect(source.text()).toBe(`
|
expect(source.text()).toBe(`
|
||||||
Playwright <!-- gen:chromium-version-if-release -->80.0.4004.0<!-- gen:stop -->
|
Playwright <!-- gen:chromium-version -->80.0.4004.0<!-- gen:stop -->
|
||||||
`);
|
|
||||||
});
|
|
||||||
it('should be noop for dev', function() {
|
|
||||||
const source = new Source('doc.md', `
|
|
||||||
Playwright <!-- gen:chromium-version-if-release -->XXX<!-- gen:stop -->
|
|
||||||
`);
|
|
||||||
const messages = runCommands([source], OPTIONS_DEV);
|
|
||||||
expect(messages.length).toBe(0);
|
|
||||||
expect(source.text()).toBe(`
|
|
||||||
Playwright <!-- gen:chromium-version-if-release -->XXX<!-- gen:stop -->
|
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('gen:firefox-version', function() {
|
describe('gen:firefox-version', function() {
|
||||||
it('should work for release', function() {
|
it('should work', function() {
|
||||||
const source = new Source('doc.md', `
|
const source = new Source('doc.md', `
|
||||||
Playwright <!-- gen:firefox-version-if-release -->XXX<!-- gen:stop -->
|
Playwright <!-- gen:firefox-version -->XXX<!-- gen:stop -->
|
||||||
`);
|
`);
|
||||||
const messages = runCommands([source], OPTIONS_REL);
|
const messages = runCommands([source], OPTIONS_REL);
|
||||||
expect(messages.length).toBe(1);
|
expect(messages.length).toBe(1);
|
||||||
expect(messages[0].type).toBe('warning');
|
expect(messages[0].type).toBe('warning');
|
||||||
expect(messages[0].text).toContain('doc.md');
|
expect(messages[0].text).toContain('doc.md');
|
||||||
expect(source.text()).toBe(`
|
expect(source.text()).toBe(`
|
||||||
Playwright <!-- gen:firefox-version-if-release -->73.0b3<!-- gen:stop -->
|
Playwright <!-- gen:firefox-version -->73.0b3<!-- gen:stop -->
|
||||||
`);
|
|
||||||
});
|
|
||||||
it('should be noop for dev', function() {
|
|
||||||
const source = new Source('doc.md', `
|
|
||||||
Playwright <!-- gen:firefox-version-if-release -->XXX<!-- gen:stop -->
|
|
||||||
`);
|
|
||||||
const messages = runCommands([source], OPTIONS_DEV);
|
|
||||||
expect(messages.length).toBe(0);
|
|
||||||
expect(source.text()).toBe(`
|
|
||||||
Playwright <!-- gen:firefox-version-if-release -->XXX<!-- gen:stop -->
|
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue