Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INFRA] Cache browsers installed by playwright when running GH workflows #2356

Open
tbouffard opened this issue Nov 16, 2022 · 0 comments
Open
Labels
chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...)

Comments

@tbouffard
Copy link
Member

tbouffard commented Nov 16, 2022

Playwright uses specific versions of these browsers (including patched versions of Firefox and Webkit) and the versions change with the version of Playwright.
Today, we are installing a fresh browser when it is needed. This means that we are downloading the same browser multiple times. It is time consuming and consumes a lot of bandwidth.

Here are typical size of the installed browsers (always more than 200MB)

215M ~/.cache/ms-playwright/firefox-1344
216M ~/.cache/ms-playwright/firefox-1322
216M ~.cache/ms-playwright/firefox-1357
224M ~/.cache/ms-playwright/webkit-1630
227M ~/.cache/ms-playwright/webkit-1699
232M ~/.cache/ms-playwright/webkit-1724
426M ~/.cache/ms-playwright/chromium-1000
426M ~/.cache/ms-playwright/chromium-1019
438M ~/.cache/ms-playwright/chromium-1028
5,6M ~/.cache/ms-playwright/ffmpeg-1007

Instead, we could download the browser once and cache it. Notice that the downloaded browser depends on the OS.

Playwright allows to download the browser in specific location. This may help to cache the directory

The node_modules folder is interesting as we already cache it. However, we must cache various flavors of the same browser for each OS.
For a dedicated folder the cache could be named with

  • playwright version (the browser version depends on this version)
  • OS or OS family (linux, macos, windows)
  • browser name

If we change the path were the browsers are stored, remember that the path must be passed when running tests. Path configuration is done by setting environment variables.

See also #2355 for other improvements about playwright browser management in GitHub workflows.

@tbouffard tbouffard added the chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...) label Nov 16, 2022
@tbouffard tbouffard added this to the 0.28.2 milestone Nov 16, 2022
@tbouffard tbouffard modified the milestones: 0.28.2, 0.28.3 Nov 28, 2022
@csouchet csouchet modified the milestones: 0.28.3, 0.29.1 Dec 12, 2022
@tbouffard tbouffard modified the milestones: 0.29.1, 0.29.2 Jan 9, 2023
@csouchet csouchet modified the milestones: 0.29.2, 0.29.3 Jan 23, 2023
@csouchet csouchet modified the milestones: 0.29.3, 0.30.1 Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...)
Projects
None yet
Development

No branches or pull requests

2 participants