fix: update ci
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
# CI/CD Gitea Actions : tests à chaque push, puis sur `main` seulement,
|
||||
# build des images (registre de conteneurs intégré à Gitea) et déploiement
|
||||
# SSH sur le VPS.
|
||||
# CI/CD Gitea Actions : à chaque push sur `main`, build des images
|
||||
# (registre de conteneurs intégré à Gitea) puis déploiement SSH sur le VPS.
|
||||
#
|
||||
# Nécessite un runner Gitea Actions (act_runner, exécuteur "docker") attaché
|
||||
# au dépôt ou à l'organisation.
|
||||
@@ -27,72 +26,14 @@ name: ci-cd
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['**']
|
||||
branches: [main]
|
||||
|
||||
concurrency:
|
||||
group: ci-cd-${{ gitea.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
backend-test:
|
||||
runs-on: ubuntu-latest
|
||||
container: python:3.12-slim
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_USER: benevoles
|
||||
POSTGRES_PASSWORD: benevoles
|
||||
POSTGRES_DB: benevoles_test
|
||||
ports:
|
||||
- 5432:5432
|
||||
env:
|
||||
TEST_DATABASE_URL: postgresql+psycopg://benevoles:benevoles@postgres:5432/benevoles_test
|
||||
DATABASE_URL: postgresql+psycopg://benevoles:benevoles@postgres:5432/benevoles_test
|
||||
steps:
|
||||
- name: Installer git et node
|
||||
run: apt-get update && apt-get install -y --no-install-recommends git nodejs
|
||||
- uses: actions/checkout@v4
|
||||
- name: Installer uv
|
||||
run: pip install --no-cache-dir uv
|
||||
- name: Installer les dépendances
|
||||
working-directory: backend
|
||||
run: uv sync
|
||||
- name: Lint
|
||||
working-directory: backend
|
||||
run: uv run ruff check .
|
||||
- name: Migrer la base de test
|
||||
working-directory: backend
|
||||
run: uv run alembic upgrade head
|
||||
- name: Vérifier migration ↔ modèle
|
||||
working-directory: backend
|
||||
run: uv run alembic check
|
||||
- name: Tests
|
||||
working-directory: backend
|
||||
run: uv run pytest -q
|
||||
|
||||
frontend-test:
|
||||
runs-on: ubuntu-latest
|
||||
container: node:20-alpine
|
||||
steps:
|
||||
- name: Installer git et node
|
||||
run: apk add --no-cache git nodejs
|
||||
- uses: actions/checkout@v4
|
||||
- name: Installer les dépendances
|
||||
working-directory: frontend
|
||||
run: npm ci
|
||||
- name: Typecheck
|
||||
working-directory: frontend
|
||||
run: npm run typecheck
|
||||
- name: Lint
|
||||
working-directory: frontend
|
||||
run: npm run lint
|
||||
- name: Build
|
||||
working-directory: frontend
|
||||
run: npm run build
|
||||
- name: Smoke test
|
||||
working-directory: frontend
|
||||
run: npm run smoke
|
||||
|
||||
build-backend:
|
||||
needs: backend-test
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
container: docker:27
|
||||
steps:
|
||||
@@ -109,8 +50,7 @@ jobs:
|
||||
docker push "$IMAGE:latest"
|
||||
|
||||
build-frontend:
|
||||
needs: frontend-test
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
needs: build-backend # séquentiel pour ne pas saturer le CPU
|
||||
runs-on: ubuntu-latest
|
||||
container: docker:27
|
||||
steps:
|
||||
@@ -133,7 +73,6 @@ jobs:
|
||||
|
||||
deploy:
|
||||
needs: [build-backend, build-frontend]
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
container: alpine:3.20
|
||||
steps:
|
||||
@@ -157,4 +96,4 @@ jobs:
|
||||
docker compose -f docker-compose.prod.yml run --rm backend uv run alembic upgrade head
|
||||
docker compose -f docker-compose.prod.yml up -d
|
||||
docker image prune -f
|
||||
EOF
|
||||
EOF
|
||||
Reference in New Issue
Block a user