chore: add CI backend
This commit is contained in:
@@ -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
|
||||||
@@ -126,7 +126,6 @@ func EndAlert(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mettre fin à l'alerte en changeant le statut à false
|
|
||||||
err = database.EndAlert(alertID)
|
err = database.EndAlert(alertID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Impossible de mettre fin à l'alerte", "details": err.Error()})
|
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) {
|
func GetMyAlerts(c *gin.Context) {
|
||||||
database := c.MustGet("database").(*db.Database)
|
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) {
|
func GetActiveAlerts(c *gin.Context) {
|
||||||
database := c.MustGet("database").(*db.Database)
|
database := c.MustGet("database").(*db.Database)
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
Reference in New Issue
Block a user