Skip to content

Commit c4d0ee8

Browse files
authored
chore: store build cache for nextjs (solana-foundation#529)
## Description This PR adds caching for nextjs into CI ## Type of change - [x] Other (please describe): CI improvement ## Checklist - [x] My code follows the project's style guidelines - [x] I have added tests that prove my fix/feature works - [x] All tests pass locally and in CI - [x] CI/CD checks pass <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Adds caching to Next.js builds in CI workflow to improve build times by storing dependencies and build artifacts. > > - **CI Improvement**: > - Adds caching to `ci.yaml` for Next.js builds using `actions/cache@v4`. > - Caches `~/.pnpm-store` and `.next/cache` directories. > - Cache key includes OS, `package-lock.json`, and TypeScript files hash. > - Adds restore-keys for partial cache hits. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=solana-foundation%2Fexplorer&utm_source=github&utm_medium=referral)<sup> for bde26eb. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
1 parent c9a34d3 commit c4d0ee8

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

.browserslistrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[production]
2+
>0.2% and supports bigint and not dead
3+
not op_mini all
4+
5+
[development]
6+
last 1 chrome version
7+
last 1 firefox version
8+
last 1 safari version
9+
supports bigint

.github/workflows/ci.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
pull_request:
77
branches: [master]
88

9+
env:
10+
# cash folder for pnpm_store, nextjs and playwright later on
11+
PW_CACHE_AFFIX: pw
12+
PW_CACHE_FOLDER: ~/.cache/ms-playwright
13+
914
jobs:
1015
Build-And-Test:
1116
runs-on: ubuntu-latest
@@ -29,6 +34,21 @@ jobs:
2934
node-version: ${{ matrix.node-version }}
3035
cache: 'pnpm'
3136

37+
- name: Setup pnpm config
38+
run: pnpm config set store-dir $PNPM_CACHE_FOLDER
39+
40+
- name: Setup Cache
41+
uses: actions/cache@v4
42+
id: pnpm_store_cache
43+
with:
44+
path: |
45+
${{ env.PW_CACHE_FOLDER }}
46+
${{ github.workspace }}/.next/cache
47+
key: ${{ runner.os }}-${{ env.PW_CACHE_AFFIX }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/.browserslistrc') }}-${{ hashFiles('**/*.ts', '**/*.tsx') }}
48+
restore-keys: |
49+
${{ runner.os }}-${{ env.PW_CACHE_AFFIX }}-
50+
${{ runner.os }}-${{ env.PW_CACHE_AFFIX }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
51+
3252
- name: Install dependencies
3353
run: pnpm install
3454

package.json

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,8 @@
118118
"tailwindcss": "3.4.17",
119119
"vitest": "^3.0.8"
120120
},
121-
"browserslist": {
122-
"production": [
123-
">0.2% and supports bigint and not dead",
124-
"not op_mini all"
125-
],
126-
"development": [
127-
"last 1 chrome version",
128-
"last 1 firefox version",
129-
"last 1 safari version",
130-
"supports bigint"
131-
]
132-
},
133121
"engines": {
134-
"node": "v20.19"
122+
"node": "^18.20 || ^20.19"
135123
},
136124
"pnpm": {
137125
"overrides": {

0 commit comments

Comments
 (0)