Files
PRISM/.gitea/workflows/test-build.yaml
T
boris.waaubandClaude Sonnet 5.5 e196c92590
Test build / Front-end (qualité, tests et build) (pull_request) Successful in 35s
Test build / docker (pull_request) Successful in 43s
Test build / Back-end (qualité et tests) (pull_request) Successful in 50s
Retire la connexion au registre du build des pull requests
Ce job ne publie rien (push: false) : il n'a pas besoin d'identifiants,
et les secrets ne sont pas fournis aux pull requests venant d'un fork.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 16:03:06 +01:00

106 lines
3.3 KiB
YAML

name: Test build
run-name: Build ${{ github.ref_name }} (by ${{ gitea.actor }})
on:
pull_request:
types:
- auto_merge_enabled
- opened
- synchronize
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: https://gitea.com/actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Docker Buildx
uses: https://gitea.com/docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Build backend
uses: https://gitea.com/docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: backend
pull: true
push: false
- name: Build frontend
uses: https://gitea.com/docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: frontend
pull: true
push: false
backend-tests:
name: Back-end (qualité et tests)
runs-on: ubuntu-latest
services:
# Base des tests, joignable sous le nom « db ».
db:
image: postgres:17
env:
POSTGRES_DB: prism
POSTGRES_USER: prism
POSTGRES_PASSWORD: prism
options: >-
--health-cmd "pg_isready -U prism -d prism"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
SECRET_KEY: ci-uniquement-pas-un-secret
DEBUG: "true"
ALLOWED_HOSTS: localhost
CSRF_TRUSTED_ORIGINS: http://localhost
DATABASE_URL: postgres://prism:prism@db:5432/prism
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: https://gitea.com/actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Python
uses: https://gitea.com/actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.12"
- name: Install uv
run: python -m pip install "uv~=0.9"
- name: Install dependencies
run: uv sync --locked
- name: Wait for PostgreSQL
run: >-
uv run python -c "import socket,time,sys;
[(sys.exit(0) if socket.socket().connect_ex(('db',5432))==0 else time.sleep(1)) for _ in range(30)]"
- name: Ruff (lint)
run: uv run ruff check .
- name: Ruff (format)
run: uv run ruff format --check .
- name: Check migrations are up to date
run: uv run python manage.py makemigrations --check --dry-run
- name: Tests
run: uv run pytest
frontend-tests:
name: Front-end (qualité, tests et build)
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: https://gitea.com/actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Node
uses: https://gitea.com/actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Lint
run: |
npx oxlint .
npx eslint .
- name: Type check
run: npm run type-check
- name: Tests
run: npm run test:unit -- --run
- name: Build
run: npm run build-only