mirror of
https://github.com/vee1e/bulk-questionnaire-upload.git
synced 2026-09-01 09:50:06 +00:00
ci: split workflow into backend, frontend, and perf workflows with path filters, and configure Vercel ignoreBuildStep
This commit is contained in:
parent
39e3764e2c
commit
0c67c16552
5 changed files with 139 additions and 101 deletions
43
.github/workflows/backend.yml
vendored
Normal file
43
.github/workflows/backend.yml
vendored
Normal 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
|
||||||
101
.github/workflows/ci.yml
vendored
101
.github/workflows/ci.yml
vendored
|
|
@ -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
41
.github/workflows/frontend.yml
vendored
Normal 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
52
.github/workflows/perf.yml
vendored
Normal 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
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
"buildCommand": "npm run build",
|
"buildCommand": "npm run build",
|
||||||
"outputDirectory": "dist/mform-upload/browser",
|
"outputDirectory": "dist/mform-upload/browser",
|
||||||
"installCommand": "npm install",
|
"installCommand": "npm install",
|
||||||
|
"git": {
|
||||||
|
"ignoreBuildStep": "git log -1 --pretty=%B | grep -q '\\[skip ci\\]' || git diff --quiet HEAD^ HEAD -- ."
|
||||||
|
},
|
||||||
"rewrites": [
|
"rewrites": [
|
||||||
{ "source": "/(.*)", "destination": "/index.html" }
|
{ "source": "/(.*)", "destination": "/index.html" }
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue