Merge pull request #80 from julia-shtal/PDA-FIX-POM #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [dev, main] | |
| pull_request: | |
| branches: [dev, main] | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| backend: | |
| name: Backend (build + test) | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_DB: dev_analytics | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 (Temurin) with Maven cache | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| cache: maven | |
| - name: Run backend tests | |
| working-directory: dev-analytics | |
| env: | |
| SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/dev_analytics | |
| SPRING_DATASOURCE_USERNAME: postgres | |
| SPRING_DATASOURCE_PASSWORD: postgres | |
| # --- CI-only throwaway secrets (NOT real credentials) --- | |
| # JwtService does Keys.hmacShaKeyFor(secret.getBytes()), so the secret | |
| # must be >= 32 bytes (256 bits) for HMAC-SHA. 64 ASCII chars = 64 bytes. | |
| JWT_SECRET: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef | |
| # AES-256 key: base64-encoded 32 bytes, per application.yml comment. | |
| ENCRYPTION_KEY: MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY= | |
| run: ./mvnw --batch-mode --no-transfer-progress verify | |
| frontend: | |
| name: Frontend (lint + test) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node 20 with npm cache | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: dev-analytics/frontend/package-lock.json | |
| - name: Install dependencies (clean, from lockfile) | |
| working-directory: dev-analytics/frontend | |
| run: npm ci | |
| - name: Lint | |
| working-directory: dev-analytics/frontend | |
| run: npm run lint | |
| - name: Run tests | |
| working-directory: dev-analytics/frontend | |
| run: npm run test:run |