This commit is contained in:
cte 2025-05-11 21:34:43 -07:00
parent c85db6b9ff
commit 42c52b0512
3 changed files with 34 additions and 59 deletions

View file

@ -7,78 +7,58 @@ on:
branches: [main]
jobs:
build:
strategy:
matrix:
node-version: [20.x, 22.6] # Need to use 22.6 due to Next.js build errors: https://github.com/vercel/next.js/issues/69263
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
name: Build with ${{ matrix.node-version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- run: npm run build
test:
strategy:
matrix:
node-version: [20.x]
name: Run all tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Retrieve Git history, needed to verify commits
- name: Use Node.js ${{ matrix.node-version }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
node-version: 20.18.1
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build Next.js for E2E tests
run: npm run build
run: pnpm build
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Linter
run: npm run lint
run: pnpm lint
- name: Type checking
run: npm run check-types
- name: Check
run: pnpm check-types
- name: Run unit tests
run: npm run test -- --coverage
run: pnpm test # -- --coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v4
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Install Playwright (used for Storybook and E2E tests)
run: npx playwright install --with-deps
# - name: Install Playwright (used for Storybook and E2E tests)
# run: pnpx playwright install --with-deps
- name: Run storybook tests
run: npm run test-storybook:ci
# - name: Run storybook tests
# run: pnpm test-storybook:ci
- name: Run E2E tests
run: npx percy exec -- npm run test:e2e
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
# - name: Run E2E tests
# run: npx percy exec -- npm run test:e2e
# env:
# PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
# CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: test-results/
retention-days: 7
# - uses: actions/upload-artifact@v4
# if: always()
# with:
# name: test-results
# path: test-results/
# retention-days: 7

View file

@ -28,7 +28,7 @@ export default [
},
},
{
ignores: ['dist/**'],
ignores: ['dist/**', '.next'],
},
{
...pluginReact.configs.flat.recommended,

View file

@ -1,5 +1,4 @@
import react from '@vitejs/plugin-react';
// import { loadEnv } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
@ -12,11 +11,7 @@ export default defineConfig({
include: ['src/**/*'],
exclude: ['src/**/*.stories.{js,jsx,ts,tsx}', '**/*.d.ts'],
},
environmentMatchGlobs: [
['**/*.test.tsx', 'jsdom'],
['src/hooks/**/*.test.ts', 'jsdom'],
],
environment: 'jsdom',
setupFiles: ['./vitest-setup.ts'],
// env: loadEnv('', process.cwd(), ''),
},
});