Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/backend-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: backend-tests

on:
pull_request:
push:
branches: [main]
paths:
- 'backend/**'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install uv
run: pip install uv

- name: Cache uv and virtualenv
uses: actions/cache@v4
with:
path: |
~/.cache/uv
backend/.venv/
key: uv-${{ hashFiles('backend/uv.lock') }}-${{ runner.os }}

- name: Install dependencies
run: cd backend && uv sync

- name: Run tests
run: cd backend && uv run pytest -v
68 changes: 0 additions & 68 deletions .github/workflows/d4g-utils.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/frontend-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: frontend-tests

on:
pull_request:
push:
branches: [main]
paths:
- 'frontend/**'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Cache npm
uses: actions/cache@v4
with:
path: |
frontend/node_modules/
key: npm-${{ hashFiles('frontend/package-lock.json') }}-${{ runner.os }}

- name: Install dependencies
run: cd frontend && npm ci

- name: Type check
run: cd frontend && npm run type-check

- name: Lint
run: cd frontend && npm run lint

- name: Test
run: cd frontend && npm test
50 changes: 41 additions & 9 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,44 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: set PY
run: echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/action@v3.0.0
- uses: actions/checkout@v4

# --- Python (backend) ---
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install uv
run: pip install uv

- name: Cache uv and backend virtualenv
uses: actions/cache@v4
with:
path: |
~/.cache/uv
backend/.venv/
key: uv-${{ hashFiles('backend/uv.lock') }}-${{ runner.os }}

- name: Install backend dependencies
run: cd backend && uv sync

# --- NextJS (frontend) ---
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Cache npm
uses: actions/cache@v4
with:
path: |
frontend/node_modules/
key: npm-${{ hashFiles('frontend/package-lock.json') }}-${{ runner.os }}

- name: Install frontend dependencies
run: cd frontend && npm ci

# --- Exécuter pre-commit ---
- name: Run pre-commit
uses: pre-commit/action@v3.0.0
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,15 @@ dmypy.json
cython_debug/

# Precommit hooks: ruff cache
.ruff_cache
.ruff_cache

# NextJS
frontend/.next/
frontend/out/
frontend/node_modules/
frontend/.pnp/
frontend/.pnp.js
frontend/yarn-error.log

# Backend Python (déplacé dans backend/)
backend/.venv/
30 changes: 29 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
repos:
# --- Python (backend/) ---
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: "v0.2.1"
hooks:
- id: ruff
args: [--fix]
files: ^backend/

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-merge-conflict
- id: mixed-line-ending
- id: trailing-whitespace
files: ^(backend/|frontend/)

# --- TypeScript/NextJS (frontend/) ---
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
files: ^frontend/
types_or: [typescript, javascript, json, yaml, markdown, css, scss]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.56.0
hooks:
- id: eslint
files: ^frontend/
types: [typescript, javascript]

- repo: local
hooks:
- id: next-lint
name: Next.js Lint
entry: bash -c 'cd frontend && npm run lint'
language: system
pass_filenames: false
files: ^frontend/
9 changes: 8 additions & 1 deletion pyproject.toml → backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ dependencies = [
"matplotlib>=3.10.0",
"pandas>=2.2.3",
"requests>=2.32.3",
]
]

[dependency-groups]
dev = [
"black>=26.10.1",
"mypy>=2.4.1",
"pytest>=9.2.0",
]
13 changes: 13 additions & 0 deletions backend/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tox]
env = py312
skipsdist = true # Evite de créer un package (inutile ici)

[testenv]
deps =
pytest

recreate = false

commands =
uv sync
uv run pytest -vv # Utilise uv run pour être cohérent
Loading
Loading