|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: tests-${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + unit-tests: |
| 14 | + name: Unit & Integration Tests |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - uses: actions/setup-java@v4 |
| 20 | + with: |
| 21 | + distribution: temurin |
| 22 | + java-version: 21 |
| 23 | + |
| 24 | + - uses: gradle/actions/setup-gradle@v4 |
| 25 | + |
| 26 | + - name: Run tests |
| 27 | + run: ./gradlew test |
| 28 | + |
| 29 | + - name: Upload test report |
| 30 | + if: failure() |
| 31 | + uses: actions/upload-artifact@v4 |
| 32 | + with: |
| 33 | + name: gradle-test-report |
| 34 | + path: build/reports/tests/test/ |
| 35 | + |
| 36 | + playwright-tests: |
| 37 | + name: Playwright E2E Tests |
| 38 | + runs-on: ubuntu-latest |
| 39 | + services: |
| 40 | + mariadb: |
| 41 | + image: mariadb:12.2 |
| 42 | + env: |
| 43 | + MARIADB_DATABASE: springuser |
| 44 | + MARIADB_USER: springuser |
| 45 | + MARIADB_PASSWORD: springuser |
| 46 | + MARIADB_ROOT_PASSWORD: rootpassword |
| 47 | + ports: |
| 48 | + - 3306:3306 |
| 49 | + options: >- |
| 50 | + --health-cmd="healthcheck.sh --connect --innodb_initialized" |
| 51 | + --health-interval=10s |
| 52 | + --health-timeout=5s |
| 53 | + --health-retries=5 |
| 54 | + env: |
| 55 | + # The MariaDB service container replaces Spring Boot's Docker Compose integration |
| 56 | + SPRING_DOCKER_COMPOSE_ENABLED: "false" |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - uses: actions/setup-java@v4 |
| 61 | + with: |
| 62 | + distribution: temurin |
| 63 | + java-version: 21 |
| 64 | + |
| 65 | + - uses: gradle/actions/setup-gradle@v4 |
| 66 | + |
| 67 | + - name: Build application |
| 68 | + run: ./gradlew assemble |
| 69 | + |
| 70 | + - uses: actions/setup-node@v4 |
| 71 | + with: |
| 72 | + node-version: 20 |
| 73 | + cache: npm |
| 74 | + cache-dependency-path: playwright/package-lock.json |
| 75 | + |
| 76 | + - name: Install Playwright dependencies |
| 77 | + working-directory: playwright |
| 78 | + run: | |
| 79 | + npm ci |
| 80 | + npx playwright install --with-deps chromium |
| 81 | +
|
| 82 | + - name: Run E2E tests (MFA disabled) |
| 83 | + working-directory: playwright |
| 84 | + env: |
| 85 | + SPRING_PROFILES: playwright-test |
| 86 | + run: npx playwright test --project=chromium |
| 87 | + |
| 88 | + - name: Run E2E tests (MFA enabled) |
| 89 | + working-directory: playwright |
| 90 | + env: |
| 91 | + SPRING_PROFILES: playwright-test,mfa |
| 92 | + run: npx playwright test --project=chromium-mfa |
| 93 | + |
| 94 | + - name: Upload Playwright report |
| 95 | + if: failure() |
| 96 | + uses: actions/upload-artifact@v4 |
| 97 | + with: |
| 98 | + name: playwright-report |
| 99 | + path: playwright/reports/ |
0 commit comments