Skip to content

feat: add Vite, @vitejs/plugin-react, and jsdom to dev dependencies. #7

feat: add Vite, @vitejs/plugin-react, and jsdom to dev dependencies.

feat: add Vite, @vitejs/plugin-react, and jsdom to dev dependencies. #7

Workflow file for this run

name: CI
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
env:
NODE_VERSION: '20'
jobs:
# Job 1: Code quality checks
lint:
name: Lint and Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Run TypeScript type check
run: npx tsc --noEmit
# Job 2: Run tests
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test
env:
CI: true
- name: Upload coverage reports
uses: codecov/codecov-action@v4
if: success()
with:
file: ./coverage/coverage-final.json
flags: unittests
name: codecov-umbrella
continue-on-error: true
# Job 3: Build check
build:
name: Build Application
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
env:
# Mock environment variables for build
DATABASE_URL: postgresql://mock:mock@localhost:5432/mock
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: pk_test_mock
CLERK_SECRET_KEY: sk_test_mock
- name: Check build output
run: |
if [ ! -d ".next" ]; then
echo "Build failed: .next directory not found"
exit 1
fi
echo "Build successful"
# Job 4: Database migrations check
migrations:
name: Check Database Migrations
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check for migration conflicts
run: |
if [ -d "drizzle" ]; then
echo "Checking migration files..."
ls -la drizzle/
else
echo "No migrations directory found"
fi
# Job 5: Security audit
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Run npm audit
run: npm audit --audit-level=moderate
continue-on-error: true
- name: Check for known vulnerabilities
run: |
npx audit-ci --moderate
continue-on-error: true
# Job 6: Notify on failure (optional)
notify:
name: Notify on Failure
runs-on: ubuntu-latest
needs: [lint, test, build]
if: failure()
steps:
- name: Send notification
run: |
echo "CI pipeline failed. Workflow: ${{ github.workflow }}"
echo "Commit: ${{ github.sha }}"
echo "Author: ${{ github.actor }}"