Added github action to run tests #6
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 Pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: template | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: test | |
POSTGRES_PASSWORD: test | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd="pg_isready -U test -d postgres" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
env: | |
DATABASE_URL: postgres://test:test@localhost:5432/postgres | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install bun | |
uses: oven-sh/setup-bun@v2 | |
- name: Install dependencies | |
run: bun install | |
- name: Compile typescript | |
run: bun run compile | |
- name: Lint | |
run: bun run lint | |
- name: Wait for Database | |
run: | | |
until pg_isready -h localhost -p 5432 -U test_user -d test_db; do | |
echo "Waiting for PostgreSQL..."; | |
sleep 3; | |
done | |
- name: Run migrations | |
run: bun run db:migrate | |
- name: Run tests | |
run: bun run test:ci |