mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
ci: download latest Canary build (#11918)
This commit is contained in:
parent
58e7e4fcef
commit
72726e6e11
2
.github/workflows/canary.yml
vendored
2
.github/workflows/canary.yml
vendored
@ -53,7 +53,7 @@ jobs:
|
||||
run: npm run build --workspace @puppeteer-test/test
|
||||
- name: Install Chrome Canary
|
||||
id: browser
|
||||
run: node tools/download_chrome_bidi.mjs $HOME/.cache/puppeteer/chrome-canary
|
||||
run: node tools/download_chrome_canary.mjs $HOME/.cache/puppeteer/chrome-canary
|
||||
- name: Run all tests (for non-Linux)
|
||||
if: ${{ matrix.os != 'ubuntu-latest' }}
|
||||
run: npm run test -- --shard '${{ matrix.shard }}' --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json
|
||||
|
51
tools/download_chrome_canary.mjs
Normal file
51
tools/download_chrome_canary.mjs
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
/**
|
||||
* @fileoverview Installs the latest Chrome Canary using
|
||||
* `@puppeteer/browsers` to the directory provided as the first argument
|
||||
* (default: cwd). The executable path is written to the `executablePath` output
|
||||
* param for GitHub actions.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* - `node tools/download_chrome_canary.mjs`
|
||||
* - `node tools/download_chrome_canary.mjs /tmp/cache`
|
||||
*/
|
||||
import actions from '@actions/core';
|
||||
|
||||
import {
|
||||
Browser,
|
||||
computeExecutablePath,
|
||||
install,
|
||||
resolveBuildId,
|
||||
detectBrowserPlatform,
|
||||
} from '@puppeteer/browsers';
|
||||
|
||||
try {
|
||||
const cacheDir = process.argv[2] || process.cwd();
|
||||
const browser = Browser.CHROME;
|
||||
const platform = detectBrowserPlatform();
|
||||
const buildId = await resolveBuildId(browser, platform, 'canary');
|
||||
await install({
|
||||
browser,
|
||||
buildId,
|
||||
cacheDir,
|
||||
});
|
||||
const executablePath = computeExecutablePath({
|
||||
cacheDir,
|
||||
browser,
|
||||
buildId,
|
||||
});
|
||||
if (process.argv.indexOf('--shell') === -1) {
|
||||
actions.setOutput('executablePath', executablePath);
|
||||
}
|
||||
console.log(executablePath);
|
||||
} catch (err) {
|
||||
actions.setFailed(`Failed to download the browser: ${err.message}`);
|
||||
}
|
Loading…
Reference in New Issue
Block a user