CI: caching tune (part one - relocate playwright caching) (#49081)

In this PR we ar relocating playwright downloads caching into the monorepo action (behind input parameter). That consolidates monorepo-related caching and also reduces the time fetching the cache action in external workflows.
This commit is contained in:
Vladimir Reznichenko 2024-07-04 06:55:24 +02:00 committed by GitHub
parent 7aa42a6d76
commit f8c95a8db8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 9 deletions

View File

@ -10,6 +10,9 @@ inputs:
build:
description: 'Given a boolean or PNPM filter, runs the build command for monorepo project(s).'
default: false
pull-playwright-cache:
description: 'Given a boolean value, invokes Playwright dependencies caching.'
default: false
runs:
using: 'composite'
steps:
@ -40,6 +43,13 @@ runs:
path: '~/.cache/composer/files'
key: "${{ runner.os }}-composer-${{ hashFiles( '**/composer.lock' ) }}"
restore-keys: '${{ runner.os }}-composer-'
- name: 'Cache: playwright downloads'
if: ${{ inputs.pull-playwright-cache != 'false' }}
uses: 'actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319'
with:
path: '~/.cache/ms-playwright/'
key: "${{ runner.os }}-playwright-${{ hashFiles( '**/pnpm-lock.yaml' ) }}"
restore-keys: '${{ runner.os }}-playwright-'
- name: 'Parse Project Filters'
id: 'project-filters'
shell: 'bash'

View File

@ -119,6 +119,7 @@ jobs:
with:
install: '${{ matrix.projectName }}...'
build: 'false'
pull-playwright-cache: ${{ matrix.testEnv.shouldCreate && matrix.testType == 'e2e' }}
- uses: './.github/actions/setup-woocommerce-monorepo'
if: ${{ github.ref_type != 'tag' }}
@ -136,15 +137,6 @@ jobs:
working-directory: ${{ matrix.projectPath }}
run: node ./tests/e2e-pw/bin/override-wp-env-plugins.js
- name: 'Cache Playwright Downloads'
id: 'cache-playwright-downloads'
if: ${{ matrix.testEnv.shouldCreate }}
uses: 'actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319'
with:
path: '~/.cache/ms-playwright/'
key: "${{ runner.os }}-playwright-${{ hashFiles( '**/pnpm-lock.yaml' ) }}"
restore-keys: '${{ runner.os }}-playwright-'
- name: 'Start Test Environment'
id: 'prepare-test-environment'
if: ${{ matrix.testEnv.shouldCreate }}

View File

@ -51,6 +51,7 @@ jobs:
with:
install: '@woocommerce/plugin-woocommerce...'
build: '@woocommerce/plugin-woocommerce'
pull-playwright-cache: true
- name: Install Playwright dependencies
run: pnpm exec playwright install chromium --with-deps

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
CI: tuning deps caching for playwright.