- .gitea/workflows/test-build.yaml : construction des images et jobs de tests (back-end : ruff, migrations, pytest ; front : lint, types, tests, build) sur les pull requests - .gitea/workflows/build-and-release.yaml : publication des images sur Harbor à chaque tag - frontend/Dockerfile, nginx.conf, .dockerignore : image du front (nginx sans privilèges sur le port 8080, relais de /api, /admin et /static vers le back-end du pod) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
112 lines
3.6 KiB
YAML
112 lines
3.6 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: Log in to Docker Registry
|
|
uses: https://gitea.com/docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
|
|
with:
|
|
registry: h3m6q87t.gra7.container-registry.ovh.net
|
|
username: ${{ vars.OVH_REGISTRY_USERNAME }}
|
|
password: ${{ secrets.OVH_REGISTRY_PASSWORD }}
|
|
- 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
|