Adobe Experience Platform integration docs cleanup (#7088) #6339
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: Admin UI Cypress Tests | |
| on: | |
| pull_request: | |
| merge_group: | |
| types: [checks_requested] | |
| push: | |
| branches: | |
| - "main" | |
| - "release-**" | |
| env: | |
| CI: true | |
| jobs: | |
| Check-Admin-UI-Changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| has_admin_ui_changes: ${{ steps.filter.outputs.admin_ui }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Check for Admin UI file changes | |
| uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| list-files: shell | |
| filters: | | |
| admin_ui: | |
| - 'clients/admin-ui/**' | |
| - '.github/workflows/cypress_admin-ui.yml' | |
| - name: Log changed files | |
| if: steps.filter.outputs.admin_ui == 'true' | |
| run: echo "${{ steps.filter.outputs.admin_ui_files }}" | |
| prepare-matrix: | |
| needs: Check-Admin-UI-Changes | |
| if: needs.Check-Admin-UI-Changes.outputs.has_admin_ui_changes == 'true' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| spec_groups: ${{ steps.set-matrix.outputs.spec_groups }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set matrix | |
| id: set-matrix | |
| shell: bash | |
| run: | | |
| cd clients/admin-ui/cypress/e2e | |
| # Group test files into balanced groups based on number of tests in each file | |
| echo "spec_groups=$(find . -name "*.cy.ts" | python3 -c ' | |
| import sys, os, json, math, re | |
| # Number of groups to create (adjust based on your needs) | |
| NUM_GROUPS = 5 | |
| # Get all test files with their test counts | |
| files = [] | |
| for line in sys.stdin: | |
| filepath = line.strip() | |
| if os.path.exists(filepath): | |
| # Count the number of test occurrences (it, describe, context) | |
| test_count = 0 | |
| with open(filepath, "r") as f: | |
| content = f.read() | |
| # Count occurrences of test definitions like "it(", "test(", "specify(" | |
| test_count += len(re.findall(r"\bit\s*\(", content)) | |
| test_count += len(re.findall(r"\btest\s*\(", content)) | |
| test_count += len(re.findall(r"\bspecify\s*\(", content)) | |
| # If no tests found, set minimum of 1 to ensure file is included | |
| if test_count == 0: | |
| test_count = 1 | |
| files.append((filepath.replace("./", ""), test_count)) | |
| # Sort files by test count in descending order | |
| files.sort(key=lambda x: x[1], reverse=True) | |
| # Initialize groups | |
| groups = [[] for _ in range(NUM_GROUPS)] | |
| group_counts = [0] * NUM_GROUPS | |
| # Distribute files using greedy algorithm (most tests first) | |
| for file, count in files: | |
| # Find the group with the smallest total test count | |
| min_group_idx = group_counts.index(min(group_counts)) | |
| groups[min_group_idx].append(f"cypress/e2e/{file}") | |
| group_counts[min_group_idx] += count | |
| # Format for GitHub Actions | |
| print(json.dumps([",".join(group) for group in groups])) | |
| ')" >> $GITHUB_OUTPUT | |
| Admin-UI-Cypress: | |
| needs: [Check-Admin-UI-Changes, prepare-matrix] | |
| if: needs.Check-Admin-UI-Changes.outputs.has_admin_ui_changes == 'true' | |
| strategy: | |
| fail-fast: false # We want every single job to run completely, we don't want one failing job on the matrix to stop the rest of them. | |
| matrix: | |
| spec_group: ${{ fromJson(needs.prepare-matrix.outputs.spec_groups) }} | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: clients | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20.x | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build FidesJS | |
| working-directory: clients/fides-js | |
| run: npm run build:test | |
| - name: Build NextJS | |
| working-directory: clients/admin-ui | |
| run: npm run build:test | |
| - name: Cypress Admin UI E2E Tests | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| working-directory: clients/admin-ui | |
| install: false | |
| start: npm run start | |
| wait-on: "http://localhost:3000" | |
| wait-on-timeout: 180 | |
| spec: ${{ matrix.spec_group }} | |
| - uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: cypress-videos-admin-ui-${{ strategy.job-index }} | |
| path: /home/runner/work/fides/fides/clients/admin-ui/cypress/videos/*.mp4 | |
| Admin-UI-Cypress-Summary: | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: | |
| - prepare-matrix | |
| - Admin-UI-Cypress | |
| steps: | |
| - name: Check job results | |
| run: | | |
| echo "prepare-matrix: ${{ needs.prepare-matrix.result }}" | |
| echo "Admin-UI-Cypress: ${{ needs.Admin-UI-Cypress.result }}" | |
| # Fail only if jobs failed (not if skipped) | |
| if [ "${{ needs.prepare-matrix.result }}" == "failure" ] || \ | |
| [ "${{ needs.Admin-UI-Cypress.result }}" == "failure" ]; then | |
| echo "❌ One or more required jobs failed" | |
| exit 1 | |
| fi | |
| # Check for cancelled jobs (treat as failure) | |
| if [ "${{ needs.prepare-matrix.result }}" == "cancelled" ] || \ | |
| [ "${{ needs.Admin-UI-Cypress.result }}" == "cancelled" ]; then | |
| echo "❌ One or more required jobs were cancelled" | |
| exit 1 | |
| fi | |
| echo "✅ All required Admin UI Cypress checks passed or were skipped" |