Skip to content

add cypress and workflow #11

add cypress and workflow

add cypress and workflow #11

Workflow file for this run

name: Pipeline
on:
push:
jobs:
tests:
runs-on: ubuntu-latest
container: cypress/browsers:latest
env:
# database
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_HOSTNAME: postgres
POSTGRES_PORT: 5432
# next-auth
SECRET: nextAuthSecret
# host
PROTOCOL: http
HOSTNAME: localhost
PORT: 3000
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Expand env variables
run: |
echo "DATABASE_URL=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOSTNAME:$POSTGRES_PORT/$POSTGRES_DB?schema=public" >> $GITHUB_ENV
echo "NEXTAUTH_URL=$PROTOCOL://$HOSTNAME:$PORT" >> $GITHUB_ENV
echo "CYPRESS_BASE_URL=$PROTOCOL://$HOSTNAME:$PORT" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: npm install
- name: Migrate prisma schema
run: npm run migrate
- name: Run lint
run: npm run lint
- name: Build app
run: npm run build
- name: Run jest tests
run: (npm run start&) && npm run jest
- name: Run cypress tests
uses: cypress-io/github-action@v5
with:
start: npm run start
wait-on: http://localhost:3000
config-file: test/cypress/cypress.config.ts