Add ci #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
env: | ||
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
DATABASE_URL: "postgresql://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@localhost:5432/fact?schema=public" | ||
URL_DEV: "http://127.0.0.1" | ||
PORT: 3000 | ||
services: | ||
postgres: | ||
image: postgres:10.3 | ||
env: | ||
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
Check failure on line 30 in .github/workflows/ci.yml
|
||
--health-cmd="pg_isready -U ${{ secrets.POSTGRES_USER }}" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=5 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Generate Prisma client | ||
run: pnpm prisma generate | ||
- name: Apply Prisma migrations | ||
run: pnpm prisma migrate deploy | ||
- name: Run tests | ||
run: pnpm test |