Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CI

on:
pull_request:
branches: [master]

jobs:
ci:
name: Lint, Test & Build
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16
env:
POSTGRES_USER: classification_user
POSTGRES_PASSWORD: classification_password
POSTGRES_DB: classification_db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run migrations
run: |
psql postgresql://classification_user:classification_password@localhost:5432/classification_db \
-f migrations/002_create_classifications_table.sql
psql postgresql://classification_user:classification_password@localhost:5432/classification_db \
-f migrations/003_create_users_and_sessions.sql

- name: Seed database
run: pnpm seed
env:
CLASSIFY_DB_URL: postgresql://classification_user:classification_password@localhost:5432/classification_db
NODE_ENV: test

- name: Lint
run: pnpm format --check

- name: Test
run: pnpm test
env:
CLASSIFY_DB_URL: postgresql://classification_user:classification_password@localhost:5432/classification_db
GITHUB_CLIENT_ID: test_client_id
GITHUB_CLI_CLIENT_ID: test_cli_client_id
GITHUB_SECRET: test_secret
GITHUB_CLI_SECRET: test_cli_secret
GITHUB_CALLBACK_URL: http://localhost:3001/auth/github/callback
GITHUB_CLI_CALLBACK_URL: http://127.0.0.1:9876/callback
JWT_SECRET: test_jwt_secret_for_ci
JWT_EXPIRY: 3m
REFRESH_TOKEN_EXPIRY: 5m
WEB_PORTAL_URL: http://localhost:3000
NODE_ENV: test

- name: Build
run: pnpm build
Loading
Loading