Skip to content

Commit 7ae6f94

Browse files
authored
Merge pull request #406 from ixartz/update-github-action
Update GitHub action to Node.js 22
2 parents 4093561 + 6ae38b4 commit 7ae6f94

File tree

8 files changed

+620
-865
lines changed

8 files changed

+620
-865
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Setup Node.js and dependencies
2+
description: Setup Node.js environment with npm dependencies
3+
4+
inputs:
5+
node-version:
6+
description: Node.js version
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Use Node.js ${{ inputs.node-version }}
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: ${{ inputs.node-version }}
16+
cache: npm
17+
18+
- name: Restore or cache node_modules
19+
id: cache-node-modules
20+
uses: actions/cache@v4
21+
with:
22+
path: node_modules
23+
key: node-modules-${{ inputs.node-version }}-${{ hashFiles('package-lock.json') }}
24+
25+
- name: Install dependencies
26+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
27+
shell: bash
28+
run: npm ci

β€Ž.github/workflows/CI.yml

Lines changed: 126 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,58 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
node-version: [20.x, 22.x]
13+
node-version: [22.x, 24.x]
1414
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
1515

1616
name: Build with ${{ matrix.node-version }}
1717
runs-on: ubuntu-latest
1818

1919
steps:
2020
- uses: actions/checkout@v4
21-
- name: Use Node.js ${{ matrix.node-version }}
22-
uses: actions/setup-node@v4
21+
22+
- name: Set up Node.js environment
23+
uses: ./.github/actions/setup-project
2324
with:
2425
node-version: ${{ matrix.node-version }}
25-
cache: npm
26-
- run: npm ci
27-
- run: npm run build
2826

29-
test:
27+
- name: Restore or cache Next.js build
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
.next/cache
32+
# Generate a new cache whenever packages or source files change.
33+
key: nextjs-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**') }}
34+
35+
- name: Build Next.js
36+
run: npm run build
37+
env:
38+
NEXT_PUBLIC_SENTRY_DISABLED: 'true' # Only upload Sentry source maps in deployment
39+
40+
- if: matrix.node-version == '22.x' && success()
41+
name: Cache Next.js build output
42+
uses: actions/cache/save@v4
43+
with:
44+
path: |
45+
.next
46+
key: nextjs-build-${{ matrix.node-version }}-${{ github.sha }}
47+
48+
static:
3049
strategy:
3150
matrix:
32-
node-version: [20.x]
51+
node-version: [22.x]
3352

34-
name: Run all tests
53+
name: Run static checks
3554
runs-on: ubuntu-latest
3655

3756
steps:
3857
- uses: actions/checkout@v4
3958
with:
4059
fetch-depth: 0 # Retrieve Git history, needed to verify commits
41-
- name: Use Node.js ${{ matrix.node-version }}
42-
uses: actions/setup-node@v4
60+
61+
- name: Set up Node.js environment
62+
uses: ./.github/actions/setup-project
4363
with:
4464
node-version: ${{ matrix.node-version }}
45-
cache: npm
46-
- run: npm ci
47-
48-
- name: Build Next.js for E2E tests
49-
run: npm run build
50-
env:
51-
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
5265

5366
- if: github.event_name == 'pull_request'
5467
name: Validate all commits from PR
@@ -60,32 +73,119 @@ jobs:
6073
- name: Type checking
6174
run: npm run check-types
6275

63-
- name: Install Playwright (used for Storybook and E2E tests)
64-
run: npx playwright install --with-deps
76+
unit:
77+
strategy:
78+
matrix:
79+
node-version: [22.x]
80+
81+
name: Run unit tests
82+
runs-on: ubuntu-latest
83+
needs: [build]
84+
85+
steps:
86+
- uses: actions/checkout@v4
87+
88+
- name: Set up Node.js environment
89+
uses: ./.github/actions/setup-project
90+
with:
91+
node-version: ${{ matrix.node-version }}
92+
93+
- name: Restore Next.js build output
94+
uses: actions/cache/restore@v4
95+
with:
96+
path: |
97+
.next
98+
key: nextjs-build-${{ matrix.node-version }}-${{ github.sha }}
99+
fail-on-cache-miss: true
65100

66101
- name: Run unit tests
67-
run: npm run test -- --coverage
102+
uses: docker://mcr.microsoft.com/playwright:v1.52.0
103+
with:
104+
args: npm run test -- --coverage
68105

69106
- name: Upload coverage reports to Codecov
70107
uses: codecov/codecov-action@v5
71108
env:
72109
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
73110

111+
storybook:
112+
strategy:
113+
matrix:
114+
node-version: [22.x]
115+
116+
name: Run Storybook
117+
runs-on: ubuntu-latest
118+
needs: [build]
119+
120+
steps:
121+
- uses: actions/checkout@v4
122+
123+
- name: Set up Node.js environment
124+
uses: ./.github/actions/setup-project
125+
with:
126+
node-version: ${{ matrix.node-version }}
127+
128+
- name: Restore Next.js build output
129+
uses: actions/cache/restore@v4
130+
with:
131+
path: |
132+
.next
133+
key: nextjs-build-${{ matrix.node-version }}-${{ github.sha }}
134+
fail-on-cache-miss: true
135+
74136
- name: Run storybook tests
75-
run: npm run test-storybook:ci
137+
uses: docker://mcr.microsoft.com/playwright:v1.52.0
138+
with:
139+
args: npm run test-storybook:ci
140+
141+
e2e:
142+
strategy:
143+
matrix:
144+
node-version: [22.x]
145+
146+
name: Run E2E tests
147+
runs-on: ubuntu-latest
148+
needs: [build]
149+
150+
steps:
151+
- uses: actions/checkout@v4
152+
with:
153+
fetch-depth: 0 # For chromatic
154+
155+
- name: Set up Node.js environment
156+
uses: ./.github/actions/setup-project
157+
with:
158+
node-version: ${{ matrix.node-version }}
159+
160+
- name: Restore Next.js build output
161+
uses: actions/cache/restore@v4
162+
with:
163+
path: |
164+
.next
165+
key: nextjs-build-${{ matrix.node-version }}-${{ github.sha }}
166+
fail-on-cache-miss: true
76167

77168
- name: Run E2E tests
78-
run: npm run test:e2e
169+
uses: docker://mcr.microsoft.com/playwright:v1.52.0
170+
with:
171+
args: sh -c "HOME=/root npm run test:e2e" # Set HOME to /root to avoid Playwright error with Firebox
79172
env:
80173
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
81174

175+
- name: Fix test results permission # Give permissions to test results needed by Chromatic
176+
run: |
177+
sudo chmod -R 777 test-results
178+
82179
- name: Run visual regression tests
83180
uses: chromaui/action@v12
84181
with:
85182
playwright: true
183+
exitOnceUploaded: true # Speed up by skipping the build results
184+
outputDir: storybook-static
86185
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
87186

88-
- uses: actions/upload-artifact@v4
187+
- name: Upload test results
188+
uses: actions/upload-artifact@v4
89189
if: always()
90190
with:
91191
name: test-results
@@ -96,7 +196,7 @@ jobs:
96196
name: GitHub PR synchronize with Crowdin
97197
runs-on: ubuntu-latest
98198

99-
needs: [build, test]
199+
needs: [build, static]
100200
if: github.event_name == 'pull_request'
101201

102202
steps:
@@ -105,7 +205,7 @@ jobs:
105205
ref: ${{ github.event.pull_request.head.sha }} # Crowdin Actions needs to push commits to the PR branch, checkout HEAD commit instead of merge commit
106206
fetch-depth: 0
107207

108-
- name: crowdin action
208+
- name: Crowdin action
109209
uses: crowdin/github-action@v2
110210
with:
111211
upload_sources: true

β€Ž.github/workflows/checkly.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
test-e2e:
1212
strategy:
1313
matrix:
14-
node-version: [20.x]
14+
node-version: [22.x]
1515
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
1616

1717
# Only run when the deployment was successful
@@ -30,21 +30,10 @@ jobs:
3030
- name: Set branch name # workaround to detect branch name in "deployment_status" actions
3131
run: echo "CHECKLY_TEST_REPO_BRANCH=$(git show -s --pretty=%D HEAD | tr -s ',' '\n' | sed 's/^ //' | grep -e 'origin/' | head -1 | sed 's/\origin\///g')" >> $GITHUB_ENV
3232

33-
- uses: actions/setup-node@v4
33+
- name: Set up Node.js environment
34+
uses: ./.github/actions/setup-project
3435
with:
3536
node-version: ${{ matrix.node-version }}
36-
cache: npm
37-
38-
- name: Restore or cache node_modules
39-
id: cache-node-modules
40-
uses: actions/cache@v4
41-
with:
42-
path: node_modules
43-
key: node-modules-${{ hashFiles('package-lock.json') }}
44-
45-
- name: Install dependencies
46-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
47-
run: npm ci
4837

4938
- name: Run checks # run the checks passing in the ENVIRONMENT_URL and recording a test session.
5039
id: run-checks

β€Ž.github/workflows/crowdin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18-
- name: crowdin action
18+
- name: Crowdin action
1919
uses: crowdin/github-action@v2
2020
with:
2121
upload_sources: true

β€Ž.github/workflows/release.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
release:
1313
strategy:
1414
matrix:
15-
node-version: [20.x]
15+
node-version: [22.x]
1616

1717
name: Create a new release
1818
runs-on: ubuntu-latest
@@ -26,14 +26,16 @@ jobs:
2626
- uses: actions/checkout@v4
2727
with:
2828
fetch-depth: 0
29-
- name: Use Node.js ${{ matrix.node-version }}
30-
uses: actions/setup-node@v4
29+
30+
- name: Set up Node.js environment
31+
uses: ./.github/actions/setup-project
3132
with:
3233
node-version: ${{ matrix.node-version }}
33-
cache: npm
34-
- run: npm ci
34+
35+
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
36+
run: npm audit signatures
3537

3638
- name: Release
39+
run: npx semantic-release
3740
env:
3841
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
run: npx semantic-release

β€ŽREADME.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</a>
1111
</p>
1212

13-
πŸš€ Boilerplate and Starter for Next.js with App Router, Tailwind CSS, and TypeScript ⚑️ Prioritizing developer experience first: Next.js, TypeScript, ESLint, Prettier, Husky, Lint-Staged, Vitest (replacing Jest), Testing Library, Playwright, Commitlint, VSCode, Tailwind CSS, Authentication with [Clerk](https://clerk.com?utm_source=github&utm_medium=sponsorship&utm_campaign=nextjs-boilerplate), Database with DrizzleORM (PostgreSQL, SQLite, and MySQL), Error Monitoring with [Sentry](https://sentry.io/for/nextjs/?utm_source=github&utm_medium=paid-community&utm_campaign=general-fy25q1-nextjs&utm_content=github-banner-nextjsboilerplate-logo), Logging with Pino.js and Log Management, Monitoring as Code, Storybook, Multi-language (i18n), AI-powered code reviews with [CodeRabbit](https://www.coderabbit.ai?utm_source=next_js_starter&utm_medium=github&utm_campaign=next_js_starter_oss_2025), Secure with [Arcjet](https://launch.arcjet.com/Q6eLbRE) (Bot detection, Rate limiting, Attack protection, etc.) and more.
13+
πŸš€ Boilerplate and Starter for Next.js with App Router, Tailwind CSS, and TypeScript ⚑️ Prioritizing developer experience first: Next.js, TypeScript, ESLint, Prettier, Lefthook (replacing Husky), Lint-Staged, Vitest (replacing Jest), Testing Library, Playwright, Commitlint, VSCode, Tailwind CSS, Authentication with [Clerk](https://clerk.com?utm_source=github&utm_medium=sponsorship&utm_campaign=nextjs-boilerplate), Database with DrizzleORM (PostgreSQL, SQLite, and MySQL), Error Monitoring with [Sentry](https://sentry.io/for/nextjs/?utm_source=github&utm_medium=paid-community&utm_campaign=general-fy25q1-nextjs&utm_content=github-banner-nextjsboilerplate-logo), Logging with Pino.js and Log Management, Monitoring as Code, Storybook, Multi-language (i18n), AI-powered code reviews with [CodeRabbit](https://www.coderabbit.ai?utm_source=next_js_starter&utm_medium=github&utm_campaign=next_js_starter_oss_2025), Secure with [Arcjet](https://launch.arcjet.com/Q6eLbRE) (Bot detection, Rate limiting, Attack protection, etc.) and more.
1414

1515
Clone this project and use it to create your own Next.js project. You can check out the live demo at [Next.js Boilerplate](https://demo.nextjs-boilerplate.com), which includes a working authentication system.
1616

@@ -151,11 +151,11 @@ Developer experience first, extremely flexible code structure and only keep what
151151
- πŸ”΄ Validation library with Zod
152152
- πŸ“ Linter with [ESLint](https://eslint.org) (default Next.js, Next.js Core Web Vitals, Tailwind CSS and Antfu configuration)
153153
- πŸ’– Code Formatter with [Prettier](https://prettier.io)
154-
- 🦊 Husky for Git Hooks
154+
- 🦊 Husky for Git Hooks (replaced by Lefthook)
155155
- 🚫 Lint-staged for running linters on Git staged files
156156
- πŸš“ Lint git commit with Commitlint
157157
- πŸ““ Write standard compliant commit messages with Commitizen
158-
- 🦺 Unit Testing with Vitest and React Testing Library
158+
- 🦺 Unit Testing with Vitest and Browser mode (replacing React Testing Library)
159159
- πŸ§ͺ Integration and E2E Testing with Playwright
160160
- πŸ‘· Run tests on pull request with GitHub Actions
161161
- πŸŽ‰ Storybook for UI development
@@ -197,7 +197,7 @@ Built-in feature from Next.js:
197197

198198
### Requirements
199199

200-
- Node.js 20+ and npm
200+
- Node.js 22+ and npm
201201

202202
### Getting started
203203

@@ -248,7 +248,6 @@ After defining the environment variables in your GitHub Actions, your localizati
248248
.
249249
β”œβ”€β”€ README.md # README file
250250
β”œβ”€β”€ .github # GitHub folder
251-
β”œβ”€β”€ .husky # Husky configuration
252251
β”œβ”€β”€ .storybook # Storybook folder
253252
β”œβ”€β”€ .vscode # VSCode configuration
254253
β”œβ”€β”€ migrations # Database migrations
@@ -267,7 +266,6 @@ After defining the environment variables in your GitHub Actions, your localizati
267266
β”œβ”€β”€ tests
268267
β”‚ β”œβ”€β”€ e2e # E2E tests, also includes Monitoring as Code
269268
β”‚ └── integration # Integration tests
270-
β”œβ”€β”€ tailwind.config.js # Tailwind CSS configuration
271269
└── tsconfig.json # TypeScript configuration
272270
```
273271

0 commit comments

Comments
Β (0)