chore: add CI backend

This commit is contained in:
2026-02-24 21:07:59 +01:00
parent b05f844940
commit ee59129bbd
3 changed files with 69 additions and 9 deletions
+69
View File
@@ -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
-3
View File
@@ -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)
-6
View File
@@ -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 (