From ee59129bbd1f3fe16b4f3d3843e0305b25c35560 Mon Sep 17 00:00:00 2001 From: Xor290 Date: Tue, 24 Feb 2026 21:07:59 +0100 Subject: [PATCH] chore: add CI backend --- .github/workflows/backend-build.yml | 69 +++++++++++++++++++++++++++++ backend/gestion/handlers/alert.go | 3 -- backend/gestion/handlers/auth.go | 6 --- 3 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/backend-build.yml diff --git a/.github/workflows/backend-build.yml b/.github/workflows/backend-build.yml new file mode 100644 index 00000000..02fc32a8 --- /dev/null +++ b/.github/workflows/backend-build.yml @@ -0,0 +1,69 @@ +name: Backend - Build & Lint + +on: + push: + branches: [main] + paths: + - "backend/**" + pull_request: + branches: [main] + paths: + - "backend/**" + +jobs: + lint: + name: Lint (go vet + staticcheck) + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.24.4" + cache-dependency-path: backend/gestion/go.sum + + - name: Download dependencies + working-directory: backend/gestion + run: go mod download + + - name: go vet + working-directory: backend/gestion + run: go vet ./... + + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest + + - name: staticcheck + working-directory: backend/gestion + run: staticcheck ./... + + build: + name: Build + needs: lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.24.4" + cache-dependency-path: backend/gestion/go.sum + + - name: Download dependencies + working-directory: backend/gestion + run: go mod download + + - name: Build + working-directory: backend/gestion + run: go build -v ./... + + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: backend-binary + path: backend/gestion/gestion + retention-days: 7 diff --git a/backend/gestion/handlers/alert.go b/backend/gestion/handlers/alert.go index 34a062f3..d0436348 100644 --- a/backend/gestion/handlers/alert.go +++ b/backend/gestion/handlers/alert.go @@ -126,7 +126,6 @@ func EndAlert(c *gin.Context) { return } - // Mettre fin à l'alerte en changeant le statut à false err = database.EndAlert(alertID) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": "Impossible de mettre fin à l'alerte", "details": err.Error()}) @@ -141,7 +140,6 @@ func EndAlert(c *gin.Context) { }) } -// GetMyAlerts permet au livreur de voir ses alertes func GetMyAlerts(c *gin.Context) { database := c.MustGet("database").(*db.Database) @@ -195,7 +193,6 @@ func GetAllAlerts(c *gin.Context) { }) } -// GetActiveAlerts permet aux admins de voir toutes les alertes actives func GetActiveAlerts(c *gin.Context) { database := c.MustGet("database").(*db.Database) diff --git a/backend/gestion/handlers/auth.go b/backend/gestion/handlers/auth.go index 579e6277..59c7b6b3 100644 --- a/backend/gestion/handlers/auth.go +++ b/backend/gestion/handlers/auth.go @@ -1,9 +1,3 @@ -// ============================================ -// handlers/auth_handlers_REFACTORED.go -// ============================================ -// Version simplifiée sans les middlewares -// Les middlewares sont maintenant dans middleware/middleware_CORRIGES.go - package handlers import (