* fix(ci): skip yarn install in deps job when cache is hit The Install Dependencies / Yarn install & cache step in pr.yml is primarily for populating the cache when nothing is cached. When cache keys are found, we can skip the actual yarn install and let the workflow carry on quickly. This adds a skip-install-if-cache-hit parameter to the yarn-install action that allows skipping the install when node_modules cache is hit. This is enabled for the deps job in yarn-install.yml but not for other jobs that actually need node_modules for their work. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(ci): also skip playwright install in deps job when cache is hit Extends the skip-install-if-cache-hit parameter to the yarn-playwright-install action as well, so both yarn install and playwright install are skipped in the deps job when their respective caches are hit. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(ci): use lookup-only cache check to avoid downloading 1.2GB When skip-install-if-cache-hit is true, use actions/cache/restore@v4 with lookup-only: true to check if caches exist without downloading them. This avoids downloading ~1.2GB of cache data when we just want to verify caches exist in the deps job. The flow is now: 1. If skip-install-if-cache-hit is true, run lookup-only checks for all caches 2. If all caches hit, skip the entire restore + install flow (no downloads) 3. If any cache misses, fall back to normal restore + install + save behavior This optimization only applies when skip-install-if-cache-hit is set to true, so other jobs that need node_modules continue to work normally. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Apply suggestion from @keithwillcode * Apply suggestion from @keithwillcode * Apply suggestion from @keithwillcode * Apply suggestion from @keithwillcode * fix(ci): address @cubic-dev-ai feedback on cache conditions 1. yarn-install: Add 'all-caches-check' step to compute whether all three caches hit (not just node_modules). This ensures we only bail out when everything is cached, matching the PR description. 2. yarn-playwright-install: Fix backward compatibility for install step. In default mode, check playwright-cache.outputs.cache-hit (the restore step). In skip mode, check playwright-cache-check.outputs.cache-hit (lookup-only). Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
47 lines
2.1 KiB
YAML
47 lines
2.1 KiB
YAML
name: Install playwright binaries
|
|
description: "Install playwright, cache and restore if necessary"
|
|
inputs:
|
|
skip-install-if-cache-hit:
|
|
description: "Skip playwright install if cache is hit. Use this for jobs that only need to check that cache exists."
|
|
required: false
|
|
default: "false"
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Get installed Playwright version
|
|
shell: bash
|
|
id: playwright-version
|
|
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@playwright/test'])")" >> $GITHUB_ENV
|
|
|
|
# When skip-install-if-cache-hit is true, first check if cache exists without downloading (lookup-only mode)
|
|
- name: Check playwright cache (lookup-only)
|
|
if: ${{ inputs.skip-install-if-cache-hit == 'true' }}
|
|
id: playwright-cache-check
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
~/Library/Caches/ms-playwright
|
|
~/.cache/ms-playwright
|
|
${{ github.workspace }}/node_modules/playwright
|
|
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
|
lookup-only: true
|
|
|
|
# Only restore cache if not in skip mode, or if skip mode but cache check missed
|
|
- name: Cache playwright binaries
|
|
if: ${{ inputs.skip-install-if-cache-hit != 'true' || steps.playwright-cache-check.outputs.cache-hit != 'true' }}
|
|
id: playwright-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/Library/Caches/ms-playwright
|
|
~/.cache/ms-playwright
|
|
${{ github.workspace }}/node_modules/playwright
|
|
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
|
|
|
# In default mode: run if playwright-cache missed
|
|
# In skip mode: run if playwright-cache-check missed (but cache restore step was also skipped)
|
|
- name: Yarn playwright install
|
|
if: ${{ (inputs.skip-install-if-cache-hit != 'true' && steps.playwright-cache.outputs.cache-hit != 'true') || (inputs.skip-install-if-cache-hit == 'true' && steps.playwright-cache-check.outputs.cache-hit != 'true') }}
|
|
shell: bash
|
|
run: yarn playwright install --with-deps
|