Skip to content

fix: remove format script from package.json (prettier is removed si… #472

fix: remove format script from package.json (prettier is removed si…

fix: remove format script from package.json (prettier is removed si… #472

Workflow file for this run

name: Tests the App
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-test:
name: Build and test with Node.js ${{ matrix.node-version }} and ${{ matrix.db }}
runs-on: ubuntu-latest
strategy:
# Don't cancel all the jobs if one of them fails
fail-fast: false
matrix:
node-version: [18, 20]
db: [postgresql, mysql]
include:
- db: postgresql
db-image: postgres:14
db-port: 5432
db-username: postgres
db-options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
- db: mysql
db-image: mysql:8
db-port: 3306
db-username: root
db-options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=5
services:
db:
image: ${{ matrix.db-image }}
env:
POSTGRES_USER: ${{ matrix.db-username }}
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }}
POSTGRES_DB: testdb
MYSQL_ROOT_PASSWORD: ${{ secrets.DB_PASSWORD }}
MYSQL_DATABASE: testdb
ports:
- ${{ matrix.db-port }}:${{ matrix.db-port }}
options: >-
--name db
--hostname db
${{ matrix.db-options }}
env:
DB_PROVIDER: ${{ matrix.db }}
DB_URL: ${{ matrix.db }}://${{ matrix.db-username }}:${{ secrets.DB_PASSWORD }}@localhost:${{ matrix.db-port }}/testdb
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}-${{ matrix.node-version }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}
- name: Install dependencies
run: pnpm install
- name: Run linting
run: pnpm run lint
- name: Run database migrations
run: pnpm run db:migrate
- name: Run database seed
run: pnpm run db:seed
- name: Build the app
run: pnpm run build
- name: Run unit tests
run: pnpm run test
- name: Run e2e tests
run: pnpm run test:e2e