Skip to content

✨(tooling) require PR fields workflow: handle edits on project items #408

✨(tooling) require PR fields workflow: handle edits on project items

✨(tooling) require PR fields workflow: handle edits on project items #408

Workflow file for this run

name: Web
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
types: [opened, synchronize, reopened, edited]
permissions:
contents: read
jobs:
check-changes:
runs-on: ubuntu-latest
outputs:
relevant: ${{ steps.filter.outputs.relevant }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d
id: filter
with:
filters: |
relevant:
- "src/web/**"
- ".github/workflows/web.yml"
- ".github/actions/**"
build-web:
needs: check-changes
if: github.event_name == 'push' || needs.check-changes.outputs.relevant == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/web
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-uv-python
with:
service-path: src/web
- uses: ./.github/actions/setup-pnpm-node
with:
lock-file-path: src/web/pnpm-lock.yaml
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Build frontend
run: pnpm run build
lint-web:
needs: [check-changes, build-web]
if: github.event_name == 'push' || needs.check-changes.outputs.relevant == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/web
env:
WEB_SECRET_KEY: the_secret_key
WEB_DATABASE_URL: psql://web:pass@localhost:5432/web
DJANGO_SETTINGS_MODULE: config.settings.test
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-uv-python
with:
service-path: src/web
- name: Lint with Ruff
run: uv run ruff check .
- name: Lint format with Ruff
run: uv run ruff format --check .
- name: Lint with MyPy
run: uv run mypy .
- name: Lint web templates with djlint
run: uv run djlint presentation/templates --check
- uses: ./.github/actions/setup-pnpm-node
with:
lock-file-path: src/web/pnpm-lock.yaml
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Lint frontend
run: pnpm --filter csplab-frontend lint
- name: TypeScript check
run: pnpm --filter csplab-frontend build
- name: Check no migrations are missing
working-directory: ${{ github.workspace }}
run: make lint-web-migrations WEB_UV="cd src/web && uv run"
- name: Lint schema
working-directory: ${{ github.workspace }}
run: make lint-schema WEB_UV="cd src/web && uv run"
test-web:
needs: [check-changes, build-web]
if: github.event_name == 'push' || needs.check-changes.outputs.relevant == 'true'
runs-on: ubuntu-latest
services:
postgresql:
image: pgvector/pgvector:pg16
env:
POSTGRES_DB: web
POSTGRES_USER: postgres
POSTGRES_PASSWORD: pass
TEST: true
options: >-
--health-cmd "pg_isready -h localhost -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 5432:5432
qdrant:
image: qdrant/qdrant:latest
ports:
- 6333:6333
redis:
image: redis
ports:
- 6379:6379
defaults:
run:
working-directory: ./src/web
env:
WEB_SECRET_KEY: the_secret_key
WEB_DATABASE_URL: psql://postgres:pass@localhost:5432/web
WEB_QDRANT_URL: http://localhost:6333
WEB_VECTOR_DB_TYPE: QDRANT
DJANGO_SETTINGS_MODULE: config.settings.test
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-uv-python
with:
service-path: src/web
- name: Wait for Qdrant to be ready
run: |
echo "Waiting for Qdrant to be ready..."
for i in {1..30}; do
if curl -f http://localhost:6333 > /dev/null 2>&1; then
echo "✅ Qdrant is ready"
break
fi
echo "⏳ Waiting for Qdrant... (attempt $i/30)"
sleep 2
done
- name: Setup Qdrant collections
run: |
echo "Creating production collection..."
uv run python config/setup-qdrant.py
echo "Creating test collection..."
uv run python config/setup-qdrant.py --collection-name fonction_publique_test
- name: Test with pytest
run: uv run pytest -m "not accessibility and not e2e" .
- name: Install Playwright browser
run: uv run playwright install --with-deps chromium
- name: Test Web suite with coverage
run: uv run pytest -m "e2e" .
deploy-web:
needs: [check-changes, lint-web, test-web]
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.check-changes.outputs.relevant == 'true'
runs-on: ubuntu-latest
environment: production
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: ./.github/actions/scalingo-deploy
with:
branch: main-web