ci: split workflow into backend, frontend, and perf workflows with path filters, and configure Vercel ignoreBuildStep

This commit is contained in:
vee1e 2026-06-11 01:57:28 +05:30
parent 39e3764e2c
commit 0c67c16552
No known key found for this signature in database
GPG key ID: EB498AFC60A7A01A
5 changed files with 139 additions and 101 deletions

43
.github/workflows/backend.yml vendored Normal file
View file

@ -0,0 +1,43 @@
name: Backend CI
on:
push:
branches: [ main ]
paths:
- 'backend/**'
- 'tests/backend/**'
- 'ruff.toml'
- 'pytest.ini'
- '.github/workflows/backend.yml'
pull_request:
branches: [ main ]
paths:
- 'backend/**'
- 'tests/backend/**'
- 'ruff.toml'
- 'pytest.ini'
- '.github/workflows/backend.yml'
jobs:
backend-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff pytest-cov
pip install -r backend/requirements.txt
- name: Lint with ruff
run: ruff check backend/ tests/backend/
- name: Run pytest
run: python -m pytest tests/backend -q --cov=backend --cov-report=term-missing

View file

@ -1,101 +0,0 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
backend-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff pytest-cov
pip install -r backend/requirements.txt
- name: Lint with ruff
run: ruff check backend/ tests/backend/
- name: Run pytest
run: python -m pytest tests/backend -q --cov=backend --cov-report=term-missing
perf-metrics:
runs-on: ubuntu-latest
needs: backend-tests
# Only run on push to main not on PRs (no live deployment to hit)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
environment: Test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install httpx pandas openpyxl
- name: Measure deployed performance
env:
BACKEND_URL: https://bulk-questionnaire-upload.onrender.com
run: python scripts/measure_perf.py
- name: Update README metrics table
run: python scripts/update_readme_metrics.py
- name: Commit updated README
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md
if git diff --cached --quiet; then
echo "No changes to README metrics."
else
git commit -m "chore: update performance metrics from CI [skip ci]"
git push
fi
frontend-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build (type-check + Angular compilation)
run: npm run build
- name: Run Vitest
run: npm run test:run

41
.github/workflows/frontend.yml vendored Normal file
View file

@ -0,0 +1,41 @@
name: Frontend CI
on:
push:
branches: [ main ]
paths:
- 'frontend/**'
- 'tests/frontend/**'
- '.github/workflows/frontend.yml'
pull_request:
branches: [ main ]
paths:
- 'frontend/**'
- 'tests/frontend/**'
- '.github/workflows/frontend.yml'
jobs:
frontend-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build (type-check + Angular compilation)
run: npm run build
- name: Run Vitest
run: npm run test:run

52
.github/workflows/perf.yml vendored Normal file
View file

@ -0,0 +1,52 @@
name: Deployed Performance Metrics CI
on:
push:
branches: [ main ]
paths:
- 'backend/**'
- 'tests/backend/**'
- 'scripts/**'
- '.github/workflows/perf.yml'
jobs:
perf-metrics:
runs-on: ubuntu-latest
permissions:
contents: write
environment: Test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install httpx pandas openpyxl
- name: Measure deployed performance
env:
BACKEND_URL: https://bulk-questionnaire-upload.onrender.com
run: python scripts/measure_perf.py
- name: Update README metrics table
run: python scripts/update_readme_metrics.py
- name: Commit updated README
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md
if git diff --cached --quiet; then
echo "No changes to README metrics."
else
git commit -m "chore: update performance metrics from CI [skip ci]"
git push
fi

View file

@ -3,6 +3,9 @@
"buildCommand": "npm run build",
"outputDirectory": "dist/mform-upload/browser",
"installCommand": "npm install",
"git": {
"ignoreBuildStep": "git log -1 --pretty=%B | grep -q '\\[skip ci\\]' || git diff --quiet HEAD^ HEAD -- ."
},
"rewrites": [
{ "source": "/(.*)", "destination": "/index.html" }
]