From 106c7d08c9516f32fc1db12f1a1a7333735b264f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20S=C3=B6derberg?= Date: Sat, 11 Jul 2026 18:25:30 +0200 Subject: [PATCH] Add .gitea/workflows/test-release.yaml --- .gitea/workflows/test-release.yaml | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .gitea/workflows/test-release.yaml diff --git a/.gitea/workflows/test-release.yaml b/.gitea/workflows/test-release.yaml new file mode 100644 index 0000000..e65892e --- /dev/null +++ b/.gitea/workflows/test-release.yaml @@ -0,0 +1,67 @@ +name: CI/CD Pipeline + +on: + push: + branches: ['main'] # Runs tests on every push to main + release: + types: [published] # Runs builds only when a release is published + +jobs: + # 1. Run tests on every push to main + test-backend: + if: github.event_name == 'push' + runs-on: ubuntu-latest + container: python:3.14-alpine + steps: + - uses: actions/checkout@v4 + - name: Run Tests + run: | + cd backend + pip install -r requirements.txt + pytest + + test-frontend: + if: github.event_name == 'push' + runs-on: ubuntu-latest + container: node:alpine + steps: + - uses: actions/checkout@v4 + - name: Run Tests + run: | + cd frontend + npm ci + npm test -- run --exclude "**/*.live.test.ts" + + # 2. Build Docker images only on release + build-docker: + if: github.event_name == 'release' + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + strategy: + matrix: + service: [backend, frontend] + steps: + - uses: actions/checkout@v4 + - name: Log in to Registry + uses: docker/login-action@v3 + with: + registry: git.stws.cc + username: ${{ github.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: git.stws.cc/${{ github.repository }}/${{ matrix.service }} + tags: | + type=ref,event=tag + type=raw,value=latest + - name: Build and Push + uses: docker/build-push-action@v6 + with: + context: ./${{ matrix.service }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file