chore: set up daily jobs for latest Chromium builds (#8344)
This commit is contained in:
parent
25216df42b
commit
eec2bf882b
75
.github/workflows/tot.yml
vendored
Normal file
75
.github/workflows/tot.yml
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
name: run-tot-checks
|
||||||
|
# Checks Puppeteer against the latest ToT build of Chromium.
|
||||||
|
# Declare default permissions as read only.
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# * is a special character in YAML so you have to quote this string
|
||||||
|
# Supposed to be every day at 8 am (UTC).
|
||||||
|
- cron: '0 8 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linux-tot-checks:
|
||||||
|
# https://github.com/actions/virtual-environments#available-environments
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node: [16]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v3.1.1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
|
||||||
|
- name: Install dependencies and build
|
||||||
|
run: |
|
||||||
|
sudo apt-get install xvfb
|
||||||
|
# Ensure both a Chromium and a Firefox binary are available.
|
||||||
|
PUPPETEER_PRODUCT=firefox npm install
|
||||||
|
npm install
|
||||||
|
ls .local-chromium .local-firefox
|
||||||
|
REV=$(node utils/check_availability.js -p linux)
|
||||||
|
echo "Installing revision $REV"
|
||||||
|
cat src/revisions.ts | sed "s/[0-9]\{6,\}/$REV/" > src/revisions.ts.replaced
|
||||||
|
mv src/revisions.ts.replaced src/revisions.ts
|
||||||
|
npm run build
|
||||||
|
npm install
|
||||||
|
|
||||||
|
- name: Run unit tests in headless
|
||||||
|
uses: nick-invision/retry@v2
|
||||||
|
env:
|
||||||
|
CHROMIUM: true
|
||||||
|
HEADLESS: true
|
||||||
|
with:
|
||||||
|
max_attempts: 1
|
||||||
|
command: xvfb-run --auto-servernum npm run unit
|
||||||
|
timeout_minutes: 10
|
||||||
|
|
||||||
|
- name: Run unit tests in headful
|
||||||
|
uses: nick-invision/retry@v2
|
||||||
|
if: always()
|
||||||
|
needs: [job1, job2, job3]
|
||||||
|
env:
|
||||||
|
CHROMIUM: true
|
||||||
|
HEADLESS: false
|
||||||
|
with:
|
||||||
|
max_attempts: 1
|
||||||
|
command: xvfb-run --auto-servernum npm run unit
|
||||||
|
timeout_minutes: 10
|
||||||
|
|
||||||
|
- name: Run unit tests in chrome headless
|
||||||
|
uses: nick-invision/retry@v2
|
||||||
|
if: always()
|
||||||
|
needs: [job1, job2, job3]
|
||||||
|
env:
|
||||||
|
CHROMIUM: true
|
||||||
|
with:
|
||||||
|
max_attempts: 1
|
||||||
|
command: xvfb-run --auto-servernum npm run chrome-headless-unit
|
||||||
|
timeout_minutes: 10
|
@ -277,9 +277,14 @@ export class BrowserFetcher {
|
|||||||
revision
|
revision
|
||||||
);
|
);
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const request = httpRequest(url, 'HEAD', (response) => {
|
const request = httpRequest(
|
||||||
resolve(response.statusCode === 200);
|
url,
|
||||||
});
|
'HEAD',
|
||||||
|
(response) => {
|
||||||
|
resolve(response.statusCode === 200);
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
request.on('error', (error) => {
|
request.on('error', (error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
resolve(false);
|
resolve(false);
|
||||||
@ -575,7 +580,8 @@ function installDMG(dmgPath: string, folderPath: string): Promise<void> {
|
|||||||
function httpRequest(
|
function httpRequest(
|
||||||
url: string,
|
url: string,
|
||||||
method: string,
|
method: string,
|
||||||
response: (x: http.IncomingMessage) => void
|
response: (x: http.IncomingMessage) => void,
|
||||||
|
keepAlive = true
|
||||||
): http.ClientRequest {
|
): http.ClientRequest {
|
||||||
const urlParsed = URL.parse(url);
|
const urlParsed = URL.parse(url);
|
||||||
|
|
||||||
@ -589,9 +595,11 @@ function httpRequest(
|
|||||||
let options: Options = {
|
let options: Options = {
|
||||||
...urlParsed,
|
...urlParsed,
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: keepAlive
|
||||||
Connection: 'keep-alive',
|
? {
|
||||||
},
|
Connection: 'keep-alive',
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const proxyURL = getProxyForUrl(url);
|
const proxyURL = getProxyForUrl(url);
|
||||||
|
@ -22,9 +22,6 @@ const BrowserFetcher =
|
|||||||
require('../lib/cjs/puppeteer/node/BrowserFetcher.js').BrowserFetcher;
|
require('../lib/cjs/puppeteer/node/BrowserFetcher.js').BrowserFetcher;
|
||||||
|
|
||||||
const SUPPORTED_PLATFORMS = ['linux', 'mac', 'mac_arm', 'win32', 'win64'];
|
const SUPPORTED_PLATFORMS = ['linux', 'mac', 'mac_arm', 'win32', 'win64'];
|
||||||
const fetchers = SUPPORTED_PLATFORMS.map(
|
|
||||||
(platform) => new BrowserFetcher('', { platform })
|
|
||||||
);
|
|
||||||
|
|
||||||
const colors = {
|
const colors = {
|
||||||
reset: '\x1b[0m',
|
reset: '\x1b[0m',
|
||||||
@ -59,10 +56,13 @@ This script checks availability of prebuilt Chromium snapshots.
|
|||||||
Usage: node check_availability.js [<options>] [<browser version(s)>]
|
Usage: node check_availability.js [<options>] [<browser version(s)>]
|
||||||
|
|
||||||
options
|
options
|
||||||
-f full mode checks availability of all the platforms, default mode
|
-f full mode checks availability of all the platforms, default mode
|
||||||
-r roll mode checks for the most recent stable Chromium roll candidate
|
-r roll mode checks for the most recent stable Chromium roll candidate
|
||||||
-rb roll mode checks for the most recent beta Chromium roll candidate
|
-rb roll mode checks for the most recent beta Chromium roll candidate
|
||||||
-rd roll mode checks for the most recent dev Chromium roll candidate
|
-rd roll mode checks for the most recent dev Chromium roll candidate
|
||||||
|
-p $platform print the latest revision for the given platform (${SUPPORTED_PLATFORMS.join(
|
||||||
|
','
|
||||||
|
)}).
|
||||||
-h show this help
|
-h show this help
|
||||||
|
|
||||||
browser version(s)
|
browser version(s)
|
||||||
@ -108,6 +108,9 @@ function main() {
|
|||||||
case 'rd':
|
case 'rd':
|
||||||
checkRollCandidate('dev');
|
checkRollCandidate('dev');
|
||||||
return;
|
return;
|
||||||
|
case 'p':
|
||||||
|
printLatestRevisionForPlatform(args[1]);
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
console.log(helpMessage);
|
console.log(helpMessage);
|
||||||
return;
|
return;
|
||||||
@ -154,12 +157,43 @@ async function checkOmahaProxyAvailability() {
|
|||||||
])
|
])
|
||||||
).map((s) => parseInt(s, 10));
|
).map((s) => parseInt(s, 10));
|
||||||
const from = Math.max(...latestRevisions);
|
const from = Math.max(...latestRevisions);
|
||||||
checkRangeAvailability({
|
await checkRangeAvailability({
|
||||||
fromRevision: from,
|
fromRevision: from,
|
||||||
toRevision: 0,
|
toRevision: 0,
|
||||||
stopWhenAllAvailable: false,
|
stopWhenAllAvailable: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function printLatestRevisionForPlatform(platform) {
|
||||||
|
const latestRevisions = (
|
||||||
|
await Promise.all([
|
||||||
|
fetch(
|
||||||
|
'https://storage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE'
|
||||||
|
),
|
||||||
|
fetch(
|
||||||
|
'https://storage.googleapis.com/chromium-browser-snapshots/Mac_Arm/LAST_CHANGE'
|
||||||
|
),
|
||||||
|
fetch(
|
||||||
|
'https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE'
|
||||||
|
),
|
||||||
|
fetch(
|
||||||
|
'https://storage.googleapis.com/chromium-browser-snapshots/Win/LAST_CHANGE'
|
||||||
|
),
|
||||||
|
fetch(
|
||||||
|
'https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/LAST_CHANGE'
|
||||||
|
),
|
||||||
|
])
|
||||||
|
).map((s) => parseInt(s, 10));
|
||||||
|
const from = Math.max(...latestRevisions);
|
||||||
|
await checkRangeAvailability({
|
||||||
|
fromRevision: from,
|
||||||
|
toRevision: 0,
|
||||||
|
stopWhenAllAvailable: true,
|
||||||
|
printAsTable: false,
|
||||||
|
platforms: [platform],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function checkRollCandidate(channel) {
|
async function checkRollCandidate(channel) {
|
||||||
const omahaResponse = await fetch(
|
const omahaResponse = await fetch(
|
||||||
`https://omahaproxy.appspot.com/all.json?channel=${channel}&os=linux`
|
`https://omahaproxy.appspot.com/all.json?channel=${channel}&os=linux`
|
||||||
@ -193,9 +227,19 @@ async function checkRangeAvailability({
|
|||||||
fromRevision,
|
fromRevision,
|
||||||
toRevision,
|
toRevision,
|
||||||
stopWhenAllAvailable,
|
stopWhenAllAvailable,
|
||||||
|
platforms,
|
||||||
|
printAsTable = true,
|
||||||
}) {
|
}) {
|
||||||
const table = new Table([10, 7, 7, 7, 7, 7]);
|
platforms = platforms || SUPPORTED_PLATFORMS;
|
||||||
table.drawRow([''].concat(SUPPORTED_PLATFORMS));
|
let table;
|
||||||
|
if (printAsTable) {
|
||||||
|
table = new Table([10, ...platforms.map(() => 7)]);
|
||||||
|
table.drawRow([''].concat(platforms));
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchers = platforms.map(
|
||||||
|
(platform) => new BrowserFetcher('', { platform })
|
||||||
|
);
|
||||||
|
|
||||||
const inc = fromRevision < toRevision ? 1 : -1;
|
const inc = fromRevision < toRevision ? 1 : -1;
|
||||||
const revisionToStop = toRevision + inc; // +inc so the range is fully inclusive
|
const revisionToStop = toRevision + inc; // +inc so the range is fully inclusive
|
||||||
@ -204,39 +248,27 @@ async function checkRangeAvailability({
|
|||||||
revision !== revisionToStop;
|
revision !== revisionToStop;
|
||||||
revision += inc
|
revision += inc
|
||||||
) {
|
) {
|
||||||
const allAvailable = await checkAndDrawRevisionAvailability(
|
const promises = fetchers.map((fetcher) => fetcher.canDownload(revision));
|
||||||
table,
|
const availability = await Promise.all(promises);
|
||||||
'',
|
const allAvailable = availability.every((e) => !!e);
|
||||||
revision
|
if (table) {
|
||||||
);
|
const values = [
|
||||||
|
' ' +
|
||||||
|
(allAvailable ? colors.green + revision + colors.reset : revision),
|
||||||
|
];
|
||||||
|
for (let i = 0; i < availability.length; ++i) {
|
||||||
|
const decoration = availability[i] ? '+' : '-';
|
||||||
|
const color = availability[i] ? colors.green : colors.red;
|
||||||
|
values.push(color + decoration + colors.reset);
|
||||||
|
}
|
||||||
|
table.drawRow(values);
|
||||||
|
} else {
|
||||||
|
if (allAvailable) console.log(revision);
|
||||||
|
}
|
||||||
if (allAvailable && stopWhenAllAvailable) break;
|
if (allAvailable && stopWhenAllAvailable) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {!Table} table
|
|
||||||
* @param {string} name
|
|
||||||
* @param {number} revision
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
async function checkAndDrawRevisionAvailability(table, name, revision) {
|
|
||||||
const promises = fetchers.map((fetcher) => fetcher.canDownload(revision));
|
|
||||||
const availability = await Promise.all(promises);
|
|
||||||
const allAvailable = availability.every((e) => !!e);
|
|
||||||
const values = [
|
|
||||||
name +
|
|
||||||
' ' +
|
|
||||||
(allAvailable ? colors.green + revision + colors.reset : revision),
|
|
||||||
];
|
|
||||||
for (let i = 0; i < availability.length; ++i) {
|
|
||||||
const decoration = availability[i] ? '+' : '-';
|
|
||||||
const color = availability[i] ? colors.green : colors.red;
|
|
||||||
values.push(color + decoration + colors.reset);
|
|
||||||
}
|
|
||||||
table.drawRow(values);
|
|
||||||
return allAvailable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
* @returns {!Promise<?string>}
|
* @returns {!Promise<?string>}
|
||||||
|
Loading…
Reference in New Issue
Block a user