diff --git a/.gitea/workflows/ci-api.yml b/.gitea/workflows/ci-api.yml new file mode 100644 index 0000000..833bd0e --- /dev/null +++ b/.gitea/workflows/ci-api.yml @@ -0,0 +1,67 @@ +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/**" + - ".gitea/workflows/ci-api.yml" + pull_request: + paths: + - "control-plane/api/**" + - ".gitea/workflows/ci-api.yml" + 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: Build + run: go build ./... + + - name: Test + run: go test ./... + + publish: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build & push api + 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 diff --git a/.gitea/workflows/ci-web.yml b/.gitea/workflows/ci-web.yml new file mode 100644 index 0000000..217fc93 --- /dev/null +++ b/.gitea/workflows/ci-web.yml @@ -0,0 +1,71 @@ +name: ci-web + +# CI pour web (Vite/React) : install, typecheck, tests, build, puis publication +# de l'image Docker sur push vers main. + +on: + push: + branches: [main] + paths: + - "web/**" + - ".gitea/workflows/ci-web.yml" + pull_request: + paths: + - "web/**" + - ".gitea/workflows/ci-web.yml" + workflow_dispatch: {} + +jobs: + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: web + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + cache-dependency-path: web/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Typecheck + run: npm run typecheck + + - name: Test + run: npm test + + - name: Build + run: npm run build + + publish: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build & push web + uses: docker/build-push-action@v6 + with: + context: ./web + file: ./web/Dockerfile + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/omnex-web:latest diff --git a/.gitea/workflows/docker-publish.yml b/.gitea/workflows/docker-publish.yml deleted file mode 100644 index 122a162..0000000 --- a/.gitea/workflows/docker-publish.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: docker-publish - -# Build + push des images Docker (web, api) vers Docker Hub uniquement. -# Pas de déploiement ici. - -on: - push: - branches: [main] - paths: - - "web/**" - - "control-plane/api/**" - - ".gitea/workflows/docker-publish.yml" - workflow_dispatch: {} - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build & push web - uses: docker/build-push-action@v6 - with: - context: ./web - file: ./web/Dockerfile - push: true - tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/omnex-web:latest - - - name: Build & push api - 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