Skip to content

refactor: replace ESLint and Prettier with Biome (#440) #461

refactor: replace ESLint and Prettier with Biome (#440)

refactor: replace ESLint and Prettier with Biome (#440) #461

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: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- 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: npm ci
- name: Run linting
run: npm run lint
- name: Run database migrations
run: npm run db:migrate
- name: Run database seed
run: npm run db:seed
- name: Build the app
run: npm run build
- name: Run unit tests
run: npm run test
- name: Run e2e tests
run: npm run test:e2e