Skip to content
Open
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
95 changes: 95 additions & 0 deletions .github/workflows/build.yml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is beyond the scope of issue #191. Please remove

Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build and Deploy

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/geev_test
JWT_SECRET: test-secret-key
NODE_ENV: test
runs-on: ubuntu-latest

defaults:
run:
working-directory: app

services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: geev_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

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

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

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

- name: Install dependencies
run: pnpm install

- name: Generate Prisma Client
run: |
echo "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/geev_test" > .env
npx prisma generate

- name: Run database migrations
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/geev_test
run: npx prisma migrate deploy

- name: Seed database with badges
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/geev_test
run: npx prisma db seed

- name: Run ESLint
run: pnpm run lint

- name: Build Next.js application
run: pnpm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-files
path: app/.next
retention-days: 1

deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'

steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-files
path: app/.next

- name: Deploy to production
run: |
echo "Deployment step would go here"
echo "Configure for your deployment target (Vercel, Netlify, AWS, etc.)"
31 changes: 18 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,27 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

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

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

- name: Install dependencies
- name: Create .env file for CI
run: |
if [ -e yarn.lock ]; then
yarn install --no-frozen-lockfile
elif [ -e pnpm-lock.yaml ]; then
pnpm install --no-frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
echo "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/geev_test" > .env
echo "JWT_SECRET=test-secret-key" >> .env
echo "NODE_ENV=test" >> .env

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

- name: Generate Prisma Client
run: |
npx prisma format
echo "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/geev_test" > .env
npx prisma generate

- name: Run database migrations
Expand All @@ -69,11 +70,15 @@ jobs:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/geev_test
JWT_SECRET: test-secret-key
NODE_ENV: test
run: npm run test:ci
run: |
echo "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/geev_test" > .env
echo "JWT_SECRET=test-secret-key" >> .env
echo "NODE_ENV=test" >> .env
pnpm run test:ci

- name: Upload coverage reports
uses: codecov/codecov-action@v3
if: always()
if: always() && hashFiles('./app/coverage/coverage-final.json') != ''
with:
files: ./app/coverage/coverage-final.json
flags: unittests
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
.turbo
yarn.lock
package-lock.json
pnpm-lock.yaml
wave-*.md

# testing
Expand Down
Loading
Loading