Skip to content

Commit c24d3f6

Browse files
authored
Merge pull request #416 from ixartz/unlighthouse
feat: add unlighthouse in CI
2 parents 7e20197 + 1acbda5 commit c24d3f6

File tree

10 files changed

+5191
-43
lines changed

10 files changed

+5191
-43
lines changed

β€Ž.github/actions/setup-project/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ inputs:
55
node-version:
66
description: Node.js version
77
required: true
8+
restore-nextjs-cache:
9+
description: Whether to restore Next.js build cache
10+
required: false
11+
default: 'false'
812

913
runs:
1014
using: composite
@@ -26,3 +30,12 @@ runs:
2630
if: steps.cache-node-modules.outputs.cache-hit != 'true'
2731
shell: bash
2832
run: npm ci
33+
34+
- name: Restore Next.js build output
35+
if: inputs.restore-nextjs-cache == 'true'
36+
uses: actions/cache/restore@v4
37+
with:
38+
path: |
39+
.next
40+
key: nextjs-build-${{ inputs.node-version }}-${{ github.sha }}
41+
fail-on-cache-miss: true

β€Ž.github/workflows/CI.yml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,6 @@ jobs:
9696
with:
9797
node-version: ${{ matrix.node-version }}
9898

99-
- name: Restore Next.js build output
100-
uses: actions/cache/restore@v4
101-
with:
102-
path: |
103-
.next
104-
key: nextjs-build-${{ matrix.node-version }}-${{ github.sha }}
105-
fail-on-cache-miss: true
106-
10799
- name: Run unit tests
108100
uses: docker://mcr.microsoft.com/playwright:v1.53.1
109101
with:
@@ -131,14 +123,6 @@ jobs:
131123
with:
132124
node-version: ${{ matrix.node-version }}
133125

134-
- name: Restore Next.js build output
135-
uses: actions/cache/restore@v4
136-
with:
137-
path: |
138-
.next
139-
key: nextjs-build-${{ matrix.node-version }}-${{ github.sha }}
140-
fail-on-cache-miss: true
141-
142126
- name: Run storybook tests
143127
uses: docker://mcr.microsoft.com/playwright:v1.53.1
144128
with:
@@ -162,14 +146,7 @@ jobs:
162146
uses: ./.github/actions/setup-project
163147
with:
164148
node-version: ${{ matrix.node-version }}
165-
166-
- name: Restore Next.js build output
167-
uses: actions/cache/restore@v4
168-
with:
169-
path: |
170-
.next
171-
key: nextjs-build-${{ matrix.node-version }}-${{ github.sha }}
172-
fail-on-cache-miss: true
149+
restore-nextjs-cache: true
173150

174151
- name: Run E2E tests
175152
uses: docker://mcr.microsoft.com/playwright:v1.53.1
@@ -198,6 +175,28 @@ jobs:
198175
path: test-results/
199176
retention-days: 7
200177

178+
lighthouse:
179+
strategy:
180+
matrix:
181+
node-version: [22.x]
182+
183+
name: Run unlighthouse
184+
runs-on: ubuntu-latest
185+
needs: [build]
186+
187+
steps:
188+
- uses: actions/checkout@v4
189+
190+
- name: Set up Node.js environment
191+
uses: ./.github/actions/setup-project
192+
with:
193+
node-version: ${{ matrix.node-version }}
194+
restore-nextjs-cache: true
195+
196+
- name: Run unlighthouse
197+
run: |
198+
npm run test:lighthouse
199+
201200
synchronize-with-crowdin:
202201
name: GitHub PR synchronize with Crowdin
203202
runs-on: ubuntu-latest

β€Ž.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# testing
1414
/coverage
1515
/vitest-test-results
16+
.unlighthouse
1617

1718
# next.js
1819
/.next/

β€ŽREADME.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ Developer experience first, extremely flexible code structure and only keep what
145145
- πŸ‘€ Passwordless Authentication with Magic Links, Multi-Factor Auth (MFA), Social Auth (Google, Facebook, Twitter, GitHub, Apple, and more), Passwordless login with Passkeys, User Impersonation
146146
- πŸ“¦ Type-safe ORM with DrizzleORM, compatible with PostgreSQL, SQLite, and MySQL
147147
- πŸ’½ Offline and local development database with PGlite
148-
- 🌐 Multi-language (i18n) with [next-intl](https://next-intl-docs.vercel.app/) and [Crowdin](https://l.crowdin.com/next-js)
148+
- ☁️ Remote and production database with [Prisma Postgres](https://www.prisma.io/?via=nextjs-boilerplate)
149+
- 🌐 Multi-language (i18n) with next-intl and [Crowdin](https://l.crowdin.com/next-js)
149150
- ♻️ Type-safe environment variables with T3 Env
150151
- ⌨️ Form handling with React Hook Form
151152
- πŸ”΄ Validation library with Zod
@@ -177,9 +178,9 @@ Developer experience first, extremely flexible code structure and only keep what
177178
- πŸ—ΊοΈ Sitemap.xml and robots.txt
178179
- πŸ‘· Automatic dependency updates with Dependabot
179180
- ⌘ Database exploration with Drizzle Studio and CLI migration tool with Drizzle Kit
180-
- βš™οΈ [Bundler Analyzer](https://www.npmjs.com/package/@next/bundle-analyzer)
181+
- βš™οΈ Bundler Analyzer
181182
- 🌈 Include a FREE minimalist theme
182-
- πŸ’― Maximize lighthouse score
183+
- πŸ’― Maximize lighthouse score with Unlighthouse
183184

184185
Built-in feature from Next.js:
185186

β€Žknip.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { KnipConfig } from 'knip';
33
const config: KnipConfig = {
44
ignore: [
55
'checkly.config.ts',
6+
'unlighthouse.config.ts',
67
'src/libs/I18n.ts',
78
'src/types/I18n.ts',
89
'tests/**/*.ts',

0 commit comments

Comments
Β (0)