Skip to content

Mdwiltfong/issue41 #151

Mdwiltfong/issue41

Mdwiltfong/issue41 #151

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
test-front-end:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./client
strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: "npm"
cache-dependency-path: client/package-lock.json
- name: Install dependencies
run: npm ci
- name: Install Prisma Clietn
run: npm install @prisma/client
- name: Run Linter
run: npx eslint .
- name: Run FE Tests
run: npm run frontend-tests
server-tests:
runs-on: ubuntu-latest
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps TCP port 5432 on service container to the host
- 5432:5432
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432
SEND_GRID_KEY: ${{ secrets.SEND_GRID_KEY }}
SEND_GRID_EMAIL: ${{ secrets.SEND_GRID_EMAIL }}
PORT: 5432
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "20.x"
- run: npm ci
# run the migration in the test database
- run: npm run db:push
- run: npx eslint .
- run: npm run test
- run: npm run test:e2e