fix(ci): implement Group 5 CI strategy - eliminate redundant testing #4
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-DTE (Distributed Task Execution) | |
| # High-performance CI pipeline with Nx Cloud Distributed Task Execution | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| workflow_dispatch: | |
| inputs: | |
| distribute: | |
| description: 'Enable distributed task execution' | |
| required: false | |
| default: 'true' | |
| type: boolean | |
| agents: | |
| description: 'Number of agents for DTE' | |
| required: false | |
| default: '4' | |
| type: choice | |
| options: ['2', '3', '4', '6', '8'] | |
| permissions: | |
| actions: read | |
| contents: read | |
| env: | |
| NX_BRANCH: ${{ github.event.number || github.ref_name }} | |
| NX_RUN_GROUP: ${{ github.run_id }} | |
| HUSKY: 0 | |
| # Environment detection matching your existing setup | |
| DOCS_ENV: ${{ github.event_name == 'pull_request' && 'preview' || github.ref_name == 'main' && 'production' || github.ref_name == 'dev' && 'development' || 'development' }} | |
| SITE_TITLE: IFLA Standards Portal | |
| SITE_TAGLINE: International Federation of Library Associations and Institutions | |
| # Secrets for integration tests | |
| GOOGLE_SHEETS_API_KEY: ${{ secrets.GOOGLE_SHEETS_API_KEY }} | |
| GSHEETS_SA_KEY: ${{ secrets.GSHEETS_SA_KEY }} | |
| jobs: | |
| main: | |
| name: DTE CI Pipeline | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout [Pull Request] | |
| uses: actions/checkout@v4 | |
| if: ${{ github.event_name == 'pull_request' }} | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| filter: tree:0 | |
| - name: Checkout [Default Branch] | |
| uses: actions/checkout@v4 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| filter: tree:0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| # Enable Distributed Task Execution BEFORE dependencies | |
| - name: Start Nx Cloud DTE | |
| run: | | |
| AGENT_COUNT="${{ github.event.inputs.agents || '4' }}" | |
| pnpm dlx nx-cloud start-ci-run --distribute-on="${AGENT_COUNT} linux-medium-js" --stop-agents-after="e2e" | |
| if: github.event.inputs.distribute != 'false' | |
| - name: Setup Node.js with Cache | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Derive SHAs for Nx Affected | |
| uses: nrwl/nx-set-shas@v4 | |
| # Group 5: CI Tests - Environment/Infrastructure Focus Only | |
| - name: CI Tests - Environment/Infrastructure Focus (Group 5) | |
| run: | | |
| echo "π Running Group 5 CI tests - Environment/Infrastructure Focus" | |
| echo "π Skipping typecheck/lint/unit tests - already validated by pre-commit hooks" | |
| echo "π° Cost optimization: avoiding redundant testing of locally-validated functionality" | |
| echo "π Running CI connectivity tests..." | |
| pnpm test:ci:connectivity | |
| echo "βοΈ Running CI configuration validation..." | |
| pnpm test:ci:config | |
| echo "ποΈ Running deployment build validation..." | |
| pnpm exec nx affected -t build --parallel=4 | |
| env: | |
| NODE_OPTIONS: '--max-old-space-size=8192' | |
| # Configuration Validation (matches your existing CI) | |
| - name: Validate Site Configurations | |
| run: node scripts/test-site-builds.js --site all --env $DOCS_ENV --skip-build | |
| if: success() | |
| # E2E Tests (Distributed across agents) | |
| - name: Run E2E Tests | |
| run: pnpm exec nx affected -t e2e --parallel=3 | |
| if: success() | |
| env: | |
| NODE_OPTIONS: '--max-old-space-size=8192' | |
| # Summary | |
| - name: Nx Cloud Summary | |
| run: pnpm exec nx-cloud stop-all-agents | |
| if: always() |