Les migrations échouaient sur une base vide (contraintes/index déjà créés par init). Le workflow deploy ne recrée plus Postgres ni ne force les entrées _prisma_migrations. Co-authored-by: Cursor <cursoragent@cursor.com>
71 lines
1.7 KiB
YAML
71 lines
1.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- "*"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
ci:
|
|
name: Lint, Test & Build
|
|
runs-on: ubuntu-24.04
|
|
services:
|
|
postgres:
|
|
image: pgvector/pgvector:pg16
|
|
env:
|
|
POSTGRES_USER: memento_test
|
|
POSTGRES_PASSWORD: memento_test
|
|
POSTGRES_DB: memento_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
defaults:
|
|
run:
|
|
working-directory: memento-note
|
|
env:
|
|
DATABASE_URL: "postgresql://memento_test:memento_test@postgres:5432/memento_test"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node 22
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: "npm"
|
|
cache-dependency-path: memento-note/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Generate Prisma client
|
|
run: npx prisma generate
|
|
|
|
- name: Setup test database
|
|
run: |
|
|
sudo apt-get update -qq && sudo apt-get install -y -qq postgresql-client
|
|
for i in $(seq 1 30); do
|
|
PGPASSWORD=memento_test pg_isready -h postgres -U memento_test -d memento_test && break
|
|
[ "$i" -eq 30 ] && exit 1
|
|
sleep 2
|
|
done
|
|
PGPASSWORD=memento_test psql -h postgres -U memento_test -d memento_test -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
|
npx prisma migrate deploy
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Unit tests
|
|
run: npm run test:unit
|
|
|
|
- name: Build
|
|
run: npm run build
|