Files
omnex/.gitea/workflows/ci-api.yml
T
2026-08-08 18:27:27 +02:00

67 lines
1.7 KiB
YAML

name: ci-api
# CI pour control-plane/api (Go) : build, vet, tests, puis publication de l'image
# Docker sur push vers main.
on:
push:
branches: [main]
paths:
- "control-plane/api/**"
pull_request:
paths:
- "control-plane/api/**"
workflow_dispatch: {}
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: control-plane/api
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.0"
cache-dependency-path: control-plane/api/go.sum
- name: Vet
run: go vet ./...
- name: Test
run: go test ./...
- name: Build
run: go build ./...
- name: Install & run gosec
continue-on-error: true
run: |
go install github.com/securego/gosec/v2/cmd/gosec@latest
gosec ./...
- name: Set up Docker Buildx
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & push api
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
context: ./control-plane/api
file: ./control-plane/api/Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/omnex-api:latest