Skip to content

Commit 5d4f757

Browse files
committed
feat(dashboard): Fixes #138 - Dashboard membres
1 parent 7104bc3 commit 5d4f757

91 files changed

Lines changed: 11003 additions & 1519 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/audit.yml

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Audit des dépendances npm Backend et Frontend'
1+
name: 'Audit des dépendances npm'
22

33
on:
44
pull_request:
@@ -9,47 +9,46 @@ on:
99
- dev
1010

1111
jobs:
12-
npm-audit:
12+
audit-backend:
13+
name: 'Audit Backend'
1314
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
node-version: [18]
15+
steps:
16+
- name: 'Checkout code'
17+
uses: actions/checkout@v4
18+
19+
- name: 'Setup Node.js'
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
cache: 'npm'
24+
cache-dependency-path: saintBarthVolleyApp/backend/package-lock.json
1725

26+
- name: 'Installer les dépendances'
27+
run: npm ci
28+
working-directory: saintBarthVolleyApp/backend
29+
30+
- name: 'Audit npm backend'
31+
run: npm audit --audit-level=high --omit=dev
32+
working-directory: saintBarthVolleyApp/backend
33+
34+
audit-frontend:
35+
name: 'Audit Frontend'
36+
runs-on: ubuntu-latest
1837
steps:
1938
- name: 'Checkout code'
20-
uses: actions/checkout@v3
39+
uses: actions/checkout@v4
2140

2241
- name: 'Setup Node.js'
23-
uses: actions/setup-node@v3
42+
uses: actions/setup-node@v4
2443
with:
25-
node-version: ${{ matrix.node-version }}
26-
27-
# ----------------------
28-
# Backend audit
29-
# ----------------------
30-
- name: 'Installation des dépendances backend'
31-
run: |
32-
echo "Installation des dépendances backend"
33-
cd saintBarthVolleyApp/backend
34-
npm install
35-
36-
- name: "Lancement de l'audit npm backend"
37-
run: |
38-
echo "Audit des dépendances backend"
39-
cd saintBarthVolleyApp/backend
40-
npm audit --audit-level=high
41-
42-
# ----------------------
43-
# Frontend audit
44-
# ----------------------
45-
- name: 'Installation des dépendances frontend'
46-
run: |
47-
echo "Installation des dépendances frontend"
48-
cd saintBarthVolleyApp/frontend
49-
npm install
50-
51-
- name: "Lancement de l'audit npm frontend"
52-
run: |
53-
echo "Audit des dépendances frontend"
54-
cd saintBarthVolleyApp/frontend
55-
npm audit --audit-level=high
44+
node-version: '20'
45+
cache: 'npm'
46+
cache-dependency-path: saintBarthVolleyApp/frontend/package-lock.json
47+
48+
- name: 'Installer les dépendances'
49+
run: npm ci
50+
working-directory: saintBarthVolleyApp/frontend
51+
52+
- name: 'Audit npm frontend'
53+
run: npm audit --audit-level=high --omit=dev
54+
working-directory: saintBarthVolleyApp/frontend

.github/workflows/deploy.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: 'Deploy to VPS'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
name: 'Déploiement SaintBarth Volley'
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: 'Checkout code'
15+
uses: actions/checkout@v4
16+
17+
- name: 'Deploy via SSH'
18+
uses: appleboy/ssh-action@v1.0.3
19+
with:
20+
host: ${{ secrets.VPS_HOST }}
21+
username: ${{ secrets.VPS_USER }}
22+
key: ${{ secrets.VPS_SSH_KEY }}
23+
port: 22
24+
script: |
25+
set -e
26+
echo "🚀 Déploiement SaintBarth Volley"
27+
28+
REPO_DIR="/var/www/SaintBarthVolley"
29+
COMPOSE_FILE="/var/www/docker-compose.yml"
30+
31+
# ── Cloner ou mettre à jour le repo ──────────────────────────
32+
if [ ! -d "$REPO_DIR/.git" ]; then
33+
echo "📥 Premier déploiement — clonage du repo..."
34+
git clone https://github.com/${{ github.repository }}.git "$REPO_DIR"
35+
else
36+
echo "🔄 Mise à jour du code..."
37+
git -C "$REPO_DIR" fetch origin main
38+
git -C "$REPO_DIR" reset --hard origin/main
39+
fi
40+
echo "✅ Code à jour"
41+
42+
# ── Vérifier que le .env backend existe ───────────────────────
43+
ENV_FILE="$REPO_DIR/saintBarthVolleyApp/backend/.env"
44+
if [ ! -f "$ENV_FILE" ]; then
45+
echo "❌ Fichier .env manquant : $ENV_FILE"
46+
echo " Créez-le depuis .env.example avant de déployer."
47+
exit 1
48+
fi
49+
echo "✅ Fichier .env backend trouvé"
50+
51+
# ── Rebuild et restart uniquement les services SaintBarth ─────
52+
echo "🔨 Build des images..."
53+
docker compose -f "$COMPOSE_FILE" build --no-cache sbv-api sbv-front
54+
55+
echo "🔄 Redémarrage des containers..."
56+
docker compose -f "$COMPOSE_FILE" up -d --remove-orphans sbv-api sbv-front
57+
58+
echo "✅ Containers démarrés"
59+
60+
# ── Nettoyage des images obsolètes ────────────────────────────
61+
docker image prune -f
62+
63+
# ── Vérification finale ───────────────────────────────────────
64+
echo ""
65+
echo "📊 État des containers SaintBarth :"
66+
docker ps --filter "name=sbv-" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
67+
68+
echo ""
69+
echo "🎉 Déploiement terminé !"

.github/workflows/hotfix.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
2020
steps:
2121
- name: 'Checkout code'
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525

@@ -81,7 +81,6 @@ jobs:
8181
fi
8282
8383
CONTENT=$(echo "$SECTION" | grep -Ev '^(## |\s*$|### )')
84-
8584
if [[ -z "$CONTENT" ]]; then
8685
echo "❌ Le changelog pour la version $VERSION est vide"
8786
exit 1
@@ -107,4 +106,4 @@ jobs:
107106

108107
- name: 'PR mergée sur dev'
109108
if: github.event.pull_request.base.ref == 'dev'
110-
run: echo "PR mergée sur dev, aucune release ni tag créé."
109+
run: echo "PR mergée sur devaucune release créée."

.github/workflows/lint.yml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,35 @@ on:
1111
jobs:
1212
lint:
1313
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
node-version: [18]
1714

1815
steps:
1916
- name: 'Checkout code'
20-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
2118

2219
- name: 'Setup Node.js'
23-
uses: actions/setup-node@v3
20+
uses: actions/setup-node@v4
2421
with:
25-
node-version: ${{ matrix.node-version }}
22+
node-version: '20'
23+
cache: 'npm'
24+
cache-dependency-path: |
25+
saintBarthVolleyApp/backend/package-lock.json
26+
saintBarthVolleyApp/frontend/package-lock.json
2627
27-
- name: 'Installation ESLint & Prettier'
28-
run: |
29-
cd saintBarthVolleyApp/backend
30-
npm init -y
31-
npm install eslint prettier --save-dev
32-
cd ../frontend
33-
npm init -y
34-
npm install eslint prettier --save-dev
28+
- name: 'Installer les dépendances backend'
29+
run: npm ci
30+
working-directory: saintBarthVolleyApp/backend
3531

3632
- name: 'Lancer ESLint backend'
37-
run: |
38-
cd saintBarthVolleyApp/backend
39-
npx eslint . --ext .js,.ts || echo "✅ Pas de fichiers backend JS/TS à lint"
33+
run: npx eslint . --ext .js,.ts
34+
working-directory: saintBarthVolleyApp/backend
35+
36+
- name: 'Installer les dépendances frontend'
37+
run: npm ci
38+
working-directory: saintBarthVolleyApp/frontend
4039

4140
- name: 'Lancer ESLint frontend'
42-
run: |
43-
cd saintBarthVolleyApp/frontend
44-
npx eslint . --ext .js,.jsx || echo "✅ Pas de fichiers frontend JS/JSX à lint"
41+
run: npx eslint . --ext .js,.jsx,.ts,.tsx
42+
working-directory: saintBarthVolleyApp/frontend
4543

46-
- name: 'Lancer Prettier check'
47-
run: |
48-
npx prettier --check . || echo "✅ Pas de fichiers à formater"
44+
- name: 'Prettier check (global)'
45+
run: npx prettier --check "saintBarthVolleyApp/**/*.{js,ts,tsx,jsx,json}" --ignore-path .gitignore

.github/workflows/release.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
steps:
2121
- name: 'Checkout code'
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525

@@ -69,7 +69,6 @@ jobs:
6969
exit 1
7070
fi
7171
72-
# Extraire uniquement la section de la version
7372
SECTION=$(awk "
7473
BEGIN {found=0}
7574
/^## \\[$VERSION\\]/ {found=1}
@@ -82,21 +81,17 @@ jobs:
8281
exit 1
8382
fi
8483
85-
# Vérifier que la section contient du contenu réel
8684
CONTENT=$(echo "$SECTION" | grep -Ev '^(## |\s*$|### )')
87-
8885
if [[ -z "$CONTENT" ]]; then
8986
echo "❌ Le changelog pour la version $VERSION est vide"
9087
exit 1
9188
fi
9289
9390
echo "✅ Changelog valide pour la version $VERSION"
94-
9591
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
9692
echo "$SECTION" >> $GITHUB_OUTPUT
9793
echo "EOF" >> $GITHUB_OUTPUT
9894
99-
10095
- name: 'Créer le tag'
10196
run: |
10297
git tag "${{ steps.semver.outputs.tag }}"

.github/workflows/tests.yml

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Lancer les Tests Backend et Frontend'
1+
name: 'Tests Backend et Frontend'
22

33
on:
44
pull_request:
@@ -9,56 +9,63 @@ on:
99
- dev
1010

1111
jobs:
12-
test-backend-frontend:
12+
test-backend:
13+
name: 'Tests Backend'
1314
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
node-version: [18] # adapte selon la version Node de ton projet
15+
16+
services:
17+
mongodb:
18+
image: mongo:7
19+
ports:
20+
- 27017:27017
1721

1822
steps:
1923
- name: 'Checkout code'
20-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2125

2226
- name: 'Setup Node.js'
23-
uses: actions/setup-node@v3
27+
uses: actions/setup-node@v4
2428
with:
25-
node-version: 20.9.0
29+
node-version: '20'
30+
cache: 'npm'
31+
cache-dependency-path: saintBarthVolleyApp/backend/package-lock.json
2632

27-
# ----------------------
28-
# Backend
29-
# ----------------------
30-
- name: 'Installer les dépendances backend'
31-
run: |
32-
echo "Installation des dépendances backend"
33-
cd saintBarthVolleyApp/backend
34-
npm install
33+
- name: 'Installer les dépendances'
34+
run: npm ci
35+
working-directory: saintBarthVolleyApp/backend
3536

3637
- name: 'Lancer les tests backend'
37-
run: |
38-
echo "Lancement des tests backend"
39-
cd saintBarthVolleyApp/backend
40-
npm test
38+
run: npm test
39+
working-directory: saintBarthVolleyApp/backend
40+
env:
41+
NODE_ENV: test
42+
MONGO_URI: mongodb://localhost:27017/sbv_test
43+
JWT_SECRET: test_secret_ci
44+
PORT: 5000
45+
46+
test-frontend:
47+
name: 'Build Frontend (vérification)'
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: 'Checkout code'
52+
uses: actions/checkout@v4
4153

42-
# ----------------------
43-
# Frontend
44-
# ----------------------
45-
- name: 'Installer les dépendances frontend'
46-
run: |
47-
echo "Installation des dépendances frontend"
48-
cd saintBarthVolleyApp/frontend
49-
npm install
54+
- name: 'Setup Node.js'
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: '20'
58+
cache: 'npm'
59+
cache-dependency-path: saintBarthVolleyApp/frontend/package-lock.json
5060

51-
- name: 'Lancer les tests frontend'
52-
run: |
53-
echo "Lancement des tests frontend"
54-
cd saintBarthVolleyApp/frontend
55-
npm test
61+
- name: 'Installer les dépendances'
62+
run: npm ci
63+
working-directory: saintBarthVolleyApp/frontend
5664

57-
# ----------------------
58-
# Optional: build frontend
59-
# ----------------------
60-
- name: 'Build frontend pour vérification'
61-
run: |
62-
echo "Building du frontend"
63-
cd saintBarthVolleyApp/frontend
64-
npm run build || { echo "❌ Build frontend échoué"; exit 1; }
65+
- name: 'Build Next.js'
66+
run: npm run build
67+
working-directory: saintBarthVolleyApp/frontend
68+
env:
69+
# Pas de basePath en CI, pas besoin de l'URL de prod
70+
NEXT_BASE_PATH: ''
71+
NEXT_PUBLIC_API_URL: ''

0 commit comments

Comments
 (0)