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
45 changes: 0 additions & 45 deletions .github/workflows/cd.yml

This file was deleted.

80 changes: 0 additions & 80 deletions .github/workflows/ci.yml

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/frontend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Frontend CI

on:
pull_request:
branches: [ main ]
paths:
- 'frontend/**'
- '.github/workflows/frontend-ci.yml'
push:
branches: [ main ]
paths:
- 'frontend/**'
- '.github/workflows/frontend-ci.yml'
workflow_dispatch:

jobs:
test-and-build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18', '20']

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

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
working-directory: ./frontend
run: npm ci

- name: Run linting
working-directory: ./frontend
run: npm run lint

- name: Check TypeScript types (if applicable)
working-directory: ./frontend
run: |
if npm list typescript > /dev/null 2>&1; then
npx tsc --noEmit || echo "No TypeScript config found, skipping type check"
else
echo "TypeScript not installed, skipping type check"
fi

- name: Run tests
working-directory: ./frontend
run: |
if npm run | grep -q "test"; then
npm test -- --coverage --watchAll=false
else
echo "No test script found, skipping tests"
fi

- name: Build application
working-directory: ./frontend
run: npm run build

- name: Check build output
working-directory: ./frontend
run: |
ls -la dist/
echo "Build completed successfully"

- name: Run preview build test
working-directory: ./frontend
run: |
timeout 30s npm run preview &
sleep 10
curl -f http://localhost:4173 || echo "Preview server test completed"
pkill -f "vite preview" || true

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: frontend-build-node-${{ matrix.node-version }}
path: frontend/dist/
retention-days: 7

- name: Upload coverage reports (if available)
uses: actions/upload-artifact@v4
if: hashFiles('frontend/coverage/**') != ''
with:
name: frontend-coverage-node-${{ matrix.node-version }}
path: frontend/coverage/
retention-days: 7
65 changes: 65 additions & 0 deletions .github/workflows/go-backend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Go Backend CI

on:
pull_request:
branches: [ main ]
paths:
- 'backend/**'
- '.github/workflows/go-backend-ci.yml'
push:
branches: [ main ]
paths:
- 'backend/**'
- '.github/workflows/go-backend-ci.yml'
workflow_dispatch:

jobs:
test-and-build:
runs-on: ubuntu-latest

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

- name: Set up Go environment
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
cache-dependency-path: backend/go.sum

- name: Download Go dependencies
working-directory: ./backend
run: go mod download

- name: Verify Go dependencies
working-directory: ./backend
run: go mod verify

- name: Run Go vet
working-directory: ./backend
run: go vet ./...

- name: Run Go tests
working-directory: ./backend
run: go test -v -race -cover ./...

- name: Build Go application
working-directory: ./backend
run: go build -v -o privacy-copilot-api .

- name: Run Go fmt check
working-directory: ./backend
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "The following files are not formatted:"
gofmt -s -l .
exit 1
fi

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: go-backend-binary
path: backend/privacy-copilot-api
retention-days: 7
Loading