Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/test-and-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,33 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}

# Browser Run tests in `packages/miniflare/test/plugins/browser/index.spec.ts`
# and the `fixtures/browser-run` fixture use `@puppeteer/browsers` to
# download Chrome into the global Wrangler cache. Caching that binary
# across CI runs avoids ~150 MB of repeat downloads per run and reduces
# the surface area for the intermittent partial-extraction race that
# surfaces as `The browser folder (...) exists but the executable (...)
# is missing` (see #13971, #13980).
#
# The Browser Run fixture is skipped on Ubuntu (AppArmor), but the
# miniflare browser spec runs everywhere, so the cache is needed on all
# three OSes for `packages-and-tools` and on Windows + macOS for
# `fixtures`.
- name: Restore Chrome browser cache (Browser Run)
if: steps.changes.outputs.everything_but_markdown == 'true' && (matrix.suite == 'packages-and-tools' || (matrix.suite == 'fixtures' && matrix.os != 'ubuntu-latest'))
uses: actions/cache@v4
with:
# The Chrome version lives in
# `packages/miniflare/src/plugins/browser-rendering/browser-version.ts`.
# Bumping that constant invalidates this cache automatically via
# `hashFiles()` — a cache miss only triggers a fresh download, no
# functional impact.
key: chrome-${{ runner.os }}-${{ hashFiles('packages/miniflare/src/plugins/browser-rendering/browser-version.ts') }}
path: |
~/.cache/.wrangler/chrome
~/Library/Caches/.wrangler/chrome
~/AppData/Local/xdg.cache/.wrangler/chrome

- name: Run tests (tools only)
# tools _only_ needs to be tested on Linux because they're only intended to run in CI
if: steps.changes.outputs.everything_but_markdown == 'true' && matrix.suite == 'packages-and-tools' && matrix.os == 'ubuntu-latest'
Expand Down
9 changes: 2 additions & 7 deletions packages/miniflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import {
WORKFLOWS_PLUGIN_NAME,
} from "./plugins";
import { RPC_PROXY_SERVICE_NAME } from "./plugins/assets/constants";
import { BROWSER_VERSION } from "./plugins/browser-rendering/browser-version";
import {
CUSTOM_SERVICE_KNOWN_OUTBOUND,
CustomServiceKind,
Expand Down Expand Up @@ -1550,13 +1551,7 @@ export class Miniflare {
);
const { sessionId, browserProcess, startTime, wsEndpoint } =
await launchBrowser({
// Puppeteer v22.13.1 supported chrome version:
// https://pptr.dev/supported-browsers#supported-browser-version-list
//
// It should match the supported chrome version for the upstream puppeteer
// version from which @cloudflare/puppeteer branched off, which is specified in:
// https://github.com/cloudflare/puppeteer/?tab=readme-ov-file#workers-version-of-puppeteer-core
browserVersion: "126.0.6478.182",
browserVersion: BROWSER_VERSION,
log: this.#log,
tmpPath: this.#tmpPath,
headful,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* The Chrome browser version downloaded by Miniflare's Browser Run binding.
*
* Puppeteer v22.13.1 supported chrome version:
* https://pptr.dev/supported-browsers#supported-browser-version-list
*
* It should match the supported chrome version for the upstream puppeteer
* version from which @cloudflare/puppeteer branched off, which is specified in:
* https://github.com/cloudflare/puppeteer/?tab=readme-ov-file#workers-version-of-puppeteer-core
*
* Bumping this value also invalidates the Chrome binary cache in
* `.github/workflows/test-and-check.yml` (which uses `hashFiles()` on this file).
*/
export const BROWSER_VERSION = "126.0.6478.182";
Loading