-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (103 loc) · 4.91 KB
/
Copy pathcache-warm.yml
File metadata and controls
110 lines (103 loc) · 4.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Cache warm (develop)
# Why this exists (measured 2026-08-17).
#
# ci.yml used to run on `push: develop` as well as on pull_request; that push
# run was removed because it duplicated the release PR's run bit-for-bit.
# Removing it had an unintended second effect: GitHub Actions caches are
# SCOPED TO A REF, and a PR may read only its own scope plus its BASE branch's
# scope. With nothing running on develop, nothing was ever WRITTEN to
# refs/heads/develop, so every new PR branch started COLD and only a re-run of
# the same PR could hit. Evidence: `gh api repos/piwas-21/sofra/actions/caches`
# listed playwright/.next keys under refs/pull/*/merge ONLY, zero under
# refs/heads/develop; `playwright (login smoke)` / `next build` went 205s/62s on
# an exact hit but 234-247s/95-105s on the next fresh PR (= the pre-cache
# baseline of 231s/100s).
#
# So this workflow restores the base-branch cache scope WITHOUT restoring the
# duplicate CI run: it runs no tests, no scans and no gates — it only produces
# the three cache entries ci.yml reads, under the SAME keys. If a key here ever
# drifts from ci.yml's, this workflow silently warms caches nothing reads;
# keep the three key expressions below byte-identical to ci.yml's.
on:
push:
branches: [develop]
# Manual re-warm after a cache eviction (10GB repo cap / 7-day idle).
workflow_dispatch:
concurrency:
# One warm per develop tip; an older one is pointless once a newer sha lands.
group: cache-warm-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
next_site_cache:
name: warm .next cache (site build)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
cache: npm
- run: npm ci --ignore-scripts --prefer-offline --no-audit
# KEY MUST MATCH ci.yml job next_build.
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .next/cache
key: ${{ runner.os }}-next-site-${{ hashFiles('package-lock.json') }}-${{ hashFiles('app/**', 'components/**', 'lib/**', 'messages/**', 'next.config.ts', 'tsconfig.json') }}
restore-keys: |
${{ runner.os }}-next-site-${{ hashFiles('package-lock.json') }}-
- run: npm run build
env:
NEXT_PUBLIC_SITE_URL: https://sofrapiwas.com
next_e2e_cache:
name: warm .next cache (e2e build)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
cache: npm
- run: npm ci --ignore-scripts --prefer-offline --no-audit
# KEY MUST MATCH ci.yml job e2e_smoke. Separate prefix because that job
# bakes NEXT_PUBLIC_SITE_URL=http://localhost:3000 into the output.
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .next/cache
key: ${{ runner.os }}-next-e2e-${{ hashFiles('package-lock.json') }}-${{ hashFiles('app/**', 'components/**', 'lib/**', 'messages/**', 'next.config.ts', 'tsconfig.json') }}
restore-keys: |
${{ runner.os }}-next-e2e-${{ hashFiles('package-lock.json') }}-
# Same env as e2e_smoke's build step: no DATABASE_URL in scope, localhost
# canonical. Nothing is served or tested here — only .next/cache is kept.
- run: npm run build
env:
DATABASE_URL: ""
NEXT_PUBLIC_SITE_URL: http://localhost:3000
playwright_cache:
name: warm Playwright browser cache
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
cache: npm
- run: npm ci --ignore-scripts --prefer-offline --no-audit
- name: Resolve Playwright version
run: echo "PLAYWRIGHT_VERSION=$(node -p "require('./node_modules/@playwright/test/package.json').version")" >> "$GITHUB_ENV"
# KEY MUST MATCH ci.yml job e2e_smoke.
- name: Cache Playwright browsers
id: playwright_cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright chromium
if: steps.playwright_cache.outputs.cache-hit != 'true'
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft*.list /etc/apt/sources.list.d/*azure*.list 2>/dev/null || true
node_modules/.bin/playwright install --with-deps chromium || node_modules/.bin/playwright install chromium