-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (57 loc) · 2.05 KB
/
Copy pathci.yml
File metadata and controls
70 lines (57 loc) · 2.05 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
name: CI
on:
pull_request:
push:
branches: [main]
# Cancela CIs viejos del mismo branch cuando llega un push nuevo.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: lint · typecheck · test · build
runs-on: ubuntu-latest
timeout-minutes: 10
# Valores placeholder para el build/test (env.ts valida al boot).
# No son secretos reales — el deploy real usa los de Vercel.
#
# OJO: NO seteamos NODE_ENV=production aquí. Si lo hiciéramos, `npm ci`
# saltaría devDependencies (vitest, eslint, typescript, prisma CLI) y
# los scripts fallarían con exit 127. `next build` ya pone NODE_ENV
# a production internamente cuando lo necesita.
env:
DATABASE_URL: postgresql://ci:ci@localhost:5432/ci
BETTER_AUTH_SECRET: ci-secret-ci-secret-ci-secret-3232
BETTER_AUTH_URL: http://localhost:3000
NEXT_PUBLIC_APP_URL: http://localhost:3000
CODE_EXECUTOR_PROVIDER: wandbox
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
# --ignore-scripts evita el postinstall (prisma generate) hasta tener
# el cliente generado en el paso explícito de abajo. También skipea
# `husky install` que falla en CI sin .git/hooks writable.
run: npm ci --ignore-scripts
- name: Generate Prisma Client
run: npx prisma generate
- name: Cache Next.js build
uses: actions/cache@v4
with:
path: |
.next/cache
key: nextjs-${{ runner.os }}-${{ hashFiles('package-lock.json') }}-${{ hashFiles('**/*.{ts,tsx,js,jsx}') }}
restore-keys: |
nextjs-${{ runner.os }}-${{ hashFiles('package-lock.json') }}-
- name: Lint
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Unit tests
run: npm test
- name: Build
run: npx next build