Merge pull request #57 from OpenElementsLabs/feat/117-app-release-pro… #428
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/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| # Allow release.yml to invoke this exact build definition, so the release build and the PR build | |
| # can never drift apart. | |
| workflow_call: {} | |
| jobs: | |
| # Fast, dependency-free gate: fails the run within seconds if the app versions have drifted or been | |
| # downgraded. No `needs`, so it runs in parallel with the build jobs rather than after them. | |
| versions: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # need the full tag history for the no-downgrade rule | |
| - run: ./check-versions.sh | |
| backend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: backend | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| - run: ./mvnw clean verify | |
| frontend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: "frontend/package.json" # packageManager lives in frontend/, not repo root | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: "frontend/.nvmrc" # reads Node version from .nvmrc | |
| cache: "pnpm" | |
| cache-dependency-path: "frontend/pnpm-lock.yaml" | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm test | |
| - run: pnpm build | |
| docker: | |
| runs-on: ubuntu-latest | |
| needs: [ backend, frontend ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build backend Docker image | |
| run: docker build -t crm-backend ./backend | |
| - name: Build frontend Docker image | |
| run: docker build -t crm-frontend ./frontend | |
| - name: Test Docker Compose | |
| run: docker compose build |