Skip to content

fix(ci): improve cache strategy and resilience for all GitHub Actions workflows#1906

Merged
pethers merged 5 commits into
mainfrom
copilot/improve-cache-usage-for-workflows
May 8, 2026
Merged

fix(ci): improve cache strategy and resilience for all GitHub Actions workflows#1906
pethers merged 5 commits into
mainfrom
copilot/improve-cache-usage-for-workflows

Conversation

Copilot AI commented May 8, 2026

Copy link
Copy Markdown
Contributor
  • Remove redundant ~/.npm caches (setup-node handles npm caching)
  • Update all explicit cache keys with v2- prefix to expire existing caches
  • Fix Chrome install: replace deprecated apt-key add with modern gpg --dearmor method
  • Add resilience: DEBIAN_FRONTEND=noninteractive, retry flags, timeout-minutes on install steps
  • Fix Vite cache ordering: move restore step to after npm ci so the cached .vite dir is not wiped by node_modules deletion (test-and-report.yml, release.yml)
  • Update WORKFLOWS.md with cache strategy, resilience docs, and Vite ordering note
  • Fix Screenshot Analysis workflow timeout: increase Playwright install timeout from 10→20 min to handle cache-miss Chromium download (~200MB + OS deps)

Copilot AI and others added 2 commits May 8, 2026 11:39
…rome install, add resilience

Agent-Logs-Url: https://github.com/Hack23/blacktrigram/sessions/96326a48-0343-476f-bcc1-db1abda8d0a8

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

  • .github/workflows/codeql.yml

@github-actions github-actions Bot added documentation Documentation updates infrastructure CI/CD and build infrastructure security Security improvements labels May 8, 2026
Copilot finished work on behalf of pethers May 8, 2026 11:43
Copilot AI requested a review from pethers May 8, 2026 11:43
@pethers pethers marked this pull request as ready for review May 8, 2026 11:44
Copilot AI review requested due to automatic review settings May 8, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates CI workflows to reduce redundant caching, standardize cache key versioning, and harden package/browser installation steps against external registry/network failures across GitHub Actions workflows.

Changes:

  • Removed redundant explicit ~/.npm caches where actions/setup-node already provides npm caching.
  • Standardized explicit actions/cache usage (pinned SHA) and introduced v2- cache key prefixing for cache invalidation.
  • Added resilience improvements for apt/Chrome/Playwright installation (noninteractive apt, retries, and step timeouts) and documented the strategy in WORKFLOWS.md.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
WORKFLOWS.md Documents the new cache strategy and resilience measures for CI workflows.
.github/workflows/test-and-report.yml Removes redundant npm cache; versions cache keys; adds apt/Chrome install hardening and timeouts.
.github/workflows/screenshot-analysis.yml Versions cache keys; adds apt/playwright install timeouts and noninteractive apt usage.
.github/workflows/release.yml Versions cache keys; removes redundant npm cache; modernizes Chrome install with retries and adds timeouts.
.github/workflows/codeql.yml Removes redundant explicit ~/.npm cache step in favor of setup-node caching.
.github/workflows/audit-assets.yml Removes redundant explicit ~/.npm cache step in favor of setup-node caching.

Comment thread .github/workflows/test-and-report.yml Outdated
Comment on lines 63 to 72
- name: Cache Vite build cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: node_modules/.vite
key: ${{ runner.os }}-vite-${{ hashFiles('**/package-lock.json') }}
key: v2-${{ runner.os }}-vite-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-vite-
v2-${{ runner.os }}-vite-

- name: Install dependencies
run: npm ci
Comment thread .github/workflows/release.yml Outdated
Comment on lines 219 to 228
- name: Cache Vite build cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: node_modules/.vite
key: ${{ runner.os }}-vite-${{ hashFiles('**/package-lock.json') }}
key: v2-${{ runner.os }}-vite-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-vite-
v2-${{ runner.os }}-vite-

- name: Install dependencies
run: npm ci
Comment thread WORKFLOWS.md
Comment on lines +121 to +125
Explicit `actions/cache` steps are used **only** for build artifacts that `setup-node` does not cover:

| Cache | Path | Key pattern | Used in |
|---|---|---|---|
| Vite build cache | `node_modules/.vite` | `v2-{OS}-vite-{lockfile-hash}` | build-validation, release build |
@pethers

pethers commented May 8, 2026

Copy link
Copy Markdown
Member

@copilot apply changes based on the comments in this thread

Copilot AI commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot apply changes based on the comments in this thread

Fixed in 76d239e. The Vite cache restore step is now placed after npm ci in both test-and-report.yml (build-validation job) and release.yml (build job). The order is now: npm ci → restore Vite cache into the freshly-created node_modules/.vite → build. The WORKFLOWS.md docs also include a note explaining this ordering requirement.

Copilot finished work on behalf of pethers May 8, 2026 12:33
@pethers

pethers commented May 8, 2026

Copy link
Copy Markdown
Member

@copilot analyse and fix failing workflow, improve correct code, test, workflow. root cause

failing checks
Screenshot Analysis / Capture UI/UX Screenshots (pull_request)
Screenshot Analysis / Capture UI/UX Screenshots (pull_request)Failing after 11m

Copilot AI commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot analyse and fix failing workflow, improve correct code, test, workflow. root cause

failing checks
...

Root cause identified and fixed in 80a0c04.

The Install Playwright step was timing out because we added timeout-minutes: 10 in the previous commit, but on a cache miss (which always happens after the v2- cache key prefix change), npx playwright install chromium --with-deps downloads ~200 MB of Chromium plus installs OS-level apt dependencies — consistently exceeding 10 minutes on congested GitHub Actions runners.

Fix: Increased the timeout from 10 to 20 minutes, and updated the WORKFLOWS.md note to explain why 20 minutes is needed for cache-miss scenarios.

Copilot finished work on behalf of pethers May 8, 2026 13:24
@pethers pethers merged commit 4306e6a into main May 8, 2026
12 of 14 checks passed
@pethers pethers deleted the copilot/improve-cache-usage-for-workflows branch May 8, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation updates infrastructure CI/CD and build infrastructure security Security improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants