Skip to content

feat: Implement comprehensive tablet responsive layout fixes #144

feat: Implement comprehensive tablet responsive layout fixes

feat: Implement comprehensive tablet responsive layout fixes #144

Workflow file for this run

name: Test Coverage Report
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
coverage:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: test
POSTGRES_USER: test
POSTGRES_DB: nepa_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 Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Copy test environment
run: cp .env.test .env
- name: Wait for PostgreSQL
run: |
echo "Waiting for PostgreSQL..."
while ! pg_isready -h localhost -p 5432 -U test; do
sleep 1
done
- name: Generate Prisma client
run: npx prisma generate
- name: Run database migrations
run: npx prisma migrate deploy
env:
DATABASE_URL: postgresql://test:test@localhost:5432/nepa_test
- name: Run tests with coverage
run: npm run test:coverage
env:
NODE_ENV: test
DATABASE_URL: postgresql://test:test@localhost:5432/nepa_test
- name: Process coverage reports
run: |
npx nyc report --reporter=lcov --reporter=text-summary
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: Comment coverage on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = './coverage/coverage-summary.json';
if (fs.existsSync(path)) {
const coverage = JSON.parse(fs.readFileSync(path, 'utf8'));
const total = coverage.total;
const lines = `## 📊 Test Coverage Report
| Metric | Coverage |
|--------|----------|
| Lines | ${total.lines.pct}% |
| Functions | ${total.functions.pct}% |
| Branches | ${total.branches.pct}% |
| Statements | ${total.statements.pct}% |
**Total Coverage: ${total.lines.pct}%**
${total.lines.pct >= 80 ? '✅ Coverage meets minimum requirement (80%)' : '❌ Coverage below minimum requirement (80%)'}
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: lines
});
}
- name: Check coverage threshold
run: |
COVERAGE=$(npx nyc report --reporter=text-summary | grep "Lines" | awk '{print $2}' | sed 's/%//')
echo "Current coverage: ${COVERAGE}%"
if (( $(echo "$COVERAGE < 80" | bc -l) )); then
echo "❌ Coverage ${COVERAGE}% is below the minimum threshold of 80%"
exit 1
else
echo "✅ Coverage ${COVERAGE}% meets the minimum threshold of 80%"
fi