diff --git a/.gitea/workflows/pipeline.yaml b/.gitea/workflows/pipeline.yaml index 0a962cc..5efbd09 100644 --- a/.gitea/workflows/pipeline.yaml +++ b/.gitea/workflows/pipeline.yaml @@ -18,101 +18,101 @@ on: - '.gitea/workflows/pipeline.yaml' jobs: -# frontend: -# runs-on: ubuntu-latest -# defaults: -# run: -# working-directory: ./legalconsenthub -# -# steps: -# - name: Checkout code -# uses: actions/checkout@v4 -# -# - name: Setup Node.js -# uses: actions/setup-node@v4 -# with: -# node-version: '22.16.0' -# -# - name: Setup Java -# uses: actions/setup-java@v4 -# with: -# distribution: 'temurin' -# java-version: '21' -# -# - name: Setup pnpm -# uses: pnpm/action-setup@v4 -# with: -# version: 10.13.1 -# run_install: false -# -# - name: Get pnpm store directory -# id: pnpm-cache -# run: | -# echo "STORE_PATH=$(pnpm store path)" >> $GITEA_OUTPUT -# -# - name: Setup pnpm cache -# uses: actions/cache@v4 -# with: -# path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} -# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} -# restore-keys: | -# ${{ runner.os }}-pnpm-store- -# -# - name: Install dependencies -# run: pnpm install --frozen-lockfile -# -# - name: Build application -# run: pnpm build -# -# - name: Run linting -# run: pnpm lint -# -# - name: Run type checking -# run: pnpm type-check -# -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v3 -# -# - name: Log in to Gitea Container Registry -# if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' -# uses: docker/login-action@v3 -# with: -# registry: gitea.lugnas.de -# username: ${{ gitea.actor }} -# password: ${{ secrets.DOCKER_PUSH_TOKEN }} -# -# - name: Extract metadata for Docker -# id: meta -# uses: docker/metadata-action@v5 -# with: -# images: gitea.lugnas.de/${{ gitea.repository_owner }}/legalconsenthub -# tags: | -# type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' }} -# type=sha,prefix=,format=long -# -# - name: Build and push Docker image -# uses: docker/build-push-action@v5 -# with: -# context: . -# file: ./legalconsenthub/Dockerfile -# push: ${{ gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' }} -# platforms: linux/amd64 -# tags: ${{ steps.meta.outputs.tags }} -# labels: ${{ steps.meta.outputs.labels }} -# cache-from: type=local,src=/tmp/.buildx-cache -# cache-to: type=local,dest=/tmp/.buildx-cache -# -# - name: Image built successfully -# if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' -# run: | -# echo "✅ Docker image built and pushed successfully" -# echo "📦 Image: gitea.lugnas.de/${{ gitea.repository_owner }}/legalconsenthub:latest" -# echo "📦 Image: gitea.lugnas.de/${{ gitea.repository_owner }}/legalconsenthub:${{ gitea.sha }}" -# -# - name: Dry-run completed -# if: gitea.event_name == 'pull_request' -# run: | -# echo "✅ Dry-run build completed successfully (image not pushed)" + frontend: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./legalconsenthub + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.16.0' + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.13.1 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITEA_OUTPUT + + - name: Setup pnpm cache + uses: actions/cache@v4 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build application + run: pnpm build + + - name: Run linting + run: pnpm lint + + - name: Run type checking + run: pnpm type-check + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Gitea Container Registry + if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' + uses: docker/login-action@v3 + with: + registry: gitea.lugnas.de + username: ${{ gitea.actor }} + password: ${{ secrets.DOCKER_PUSH_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: gitea.lugnas.de/${{ gitea.repository_owner }}/legalconsenthub + tags: | + type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' }} + type=sha,prefix=,format=long + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./legalconsenthub/Dockerfile + push: ${{ gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' }} + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Image built successfully + if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' + run: | + echo "✅ Docker image built and pushed successfully" + echo "📦 Image: gitea.lugnas.de/${{ gitea.repository_owner }}/legalconsenthub:latest" + echo "📦 Image: gitea.lugnas.de/${{ gitea.repository_owner }}/legalconsenthub:${{ gitea.sha }}" + + - name: Dry-run completed + if: gitea.event_name == 'pull_request' + run: | + echo "✅ Dry-run build completed successfully (image not pushed)" backend: runs-on: ubuntu-latest @@ -121,21 +121,6 @@ jobs: run: working-directory: ./legalconsenthub-backend - services: - postgres: - image: postgres:16-alpine - env: - POSTGRES_DB: legalconsenthub_test - POSTGRES_USER: test - POSTGRES_PASSWORD: test - ports: - - 5432:5432 - options: >- - --health-cmd "pg_isready -U test" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - steps: - name: Checkout code uses: actions/checkout@v4 @@ -150,7 +135,7 @@ jobs: uses: gradle/actions/setup-gradle@v3 - name: Build application - run: ./gradlew build --debug -x test + run: ./gradlew build -x test - name: Run ktlint check run: ./gradlew ktlintCheck @@ -158,10 +143,7 @@ jobs: - name: Run tests run: ./gradlew test env: - SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/legalconsenthub_test - SPRING_DATASOURCE_USERNAME: test - SPRING_DATASOURCE_PASSWORD: test - SPRING_JPA_HIBERNATE_DDL_AUTO: create-drop + SPRING_PROFILES_ACTIVE: testcontainers - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3