Files
projet_gestion_commande/.github/workflows/backend-build.yml
T
Xor290 a7fe98830b fix(ci): adapte les pipelines Docker/OTA à la structure de la branche pre-prod
- backend-build.yml / frontend-web-build.yml: le chemin des Dockerfile était
  codé en dur sur docker-prod/..., inexistant sur pre-prod (seul
  docker-pre-prod/ existe sur cette branche) — rendu conditionnel selon la
  branche cible, comme le tag Docker l'est déjà.
- frontend-admin-build-local.yml: l'étape de publication OTA (Xavia) injectait
  une EXPO_PUBLIC_API_URL différente de celle utilisée pour builder l'APK
  (ota_api_url pointait vers https://5.181.0.112.nip.io au lieu de
  PREPROD_API_URL) — toute mise à jour OTA publiée sur le canal admin
  pre-prod embarquait donc une mauvaise URL d'API, provoquant un "Network
  Error" au login après réception de l'update, alors que l'APK fraîchement
  buildé fonctionnait. Alignée sur mobile qui n'avait pas ce bug.
2026-09-10 19:34:21 +02:00

85 lines
2.8 KiB
YAML

name: Backend - Build & Lint
on:
push:
branches: [main, pre-prod]
paths:
- "backend/**/**"
pull_request:
branches: [main, pre-prod]
paths:
- "backend/**/**"
jobs:
build:
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: golangci-lint
uses: golangci/golangci-lint-action@v6
continue-on-error: true
with:
version: latest
working-directory: backend/gestion
args: --timeout=5m
- name: Install & run gosec
working-directory: backend/gestion
continue-on-error: true
run: |
go install github.com/securego/gosec/v2/cmd/gosec@latest
gosec ./...
- 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
- name: Login to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
if: github.event_name == 'push'
uses: docker/setup-buildx-action@v3
- name: Build & push backend (runtime)
if: github.event_name == 'push'
uses: docker/build-push-action@v6
with:
context: .
file: ${{ github.ref == 'refs/heads/main' && 'docker-prod/backend/Dockerfile' || 'docker-pre-prod/backend/Dockerfile' }}
target: runtime
push: true
tags: xor1234/backend-mln:${{ github.ref == 'refs/heads/main' && 'latest' || 'pre-prod' }}
- name: Build & push WAF
if: github.event_name == 'push'
uses: docker/build-push-action@v6
with:
context: .
file: ${{ github.ref == 'refs/heads/main' && 'docker-prod/backend/Dockerfile' || 'docker-pre-prod/backend/Dockerfile' }}
target: waf
push: true
tags: xor1234/backend-mln:${{ github.ref == 'refs/heads/main' && 'waf' || 'waf-pre-prod' }}