Skip to content

Add files via upload #4

Add files via upload

Add files via upload #4

Workflow file for this run

name: CodePatchwork CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check types
run: npm run typecheck
- name: Lint code
run: npm run lint
- name: Build project
run: npm run build
- name: Cache build output
uses: actions/cache@v3
with:
path: |
dist
node_modules
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-
test:
needs: build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: codepatchwork_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Restore cached build
uses: actions/cache@v3
with:
path: |
dist
node_modules
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Run database migrations
run: npm run db:push
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/codepatchwork_test
- name: Run tests
run: npm test
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/codepatchwork_test
deploy:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: test
runs-on: ubuntu-latest
steps:
- name: Deploy to production
run: echo "Ready for deployment! This step would typically deploy to your hosting provider."