From 7d8859d93ed12ab3585f0d539ab52cc64e494221 Mon Sep 17 00:00:00 2001 From: seanlandsman Date: Wed, 20 May 2026 07:17:52 +0100 Subject: [PATCH] Reduce Grid CI time to < ~10m (#13794) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Reduce warm CI time from ~15m to <10m Decouple init job from critical path — format_lint_build, docs, and calc_matrix no longer wait for init's 4.6m yarn install. On warm cache the RO restore in each job is sufficient (22s vs 256s). Init still runs in parallel to keep the cache warm for future runs. Skip link checking on PRs — CHECK_LINKS/CHECK_REDIRECTS only set on push events. Push-to-latest still catches broken links before staging deploy. Expected new critical path: detect-changes (0.3m) → docs (~5-6m) → report (0.8m) ≈ 7m * Run link checks on PRs with documentation changes Enable CHECK_LINKS/CHECK_REDIRECTS when detect-changes finds docs content changes (run_docs_ci == true). Code-only PRs still skip link checking for speed. * Merge calc_matrix into init, split lint from build 1. Merge calc_matrix into init: eliminates a redundant job with its own setup-nx overhead (~1m). Init already has Nx configured, so the matrix calculation adds negligible time. Matches the ag-charts pattern where init handles both cache warming and matrix computation. 2. Split format_lint_build into separate lint and build jobs: lint runs for all PRs (including drafts) giving fast feedback; build only runs when code changes are detected. Matches ag-charts' independent lint job pattern. test/e2e now depend on init (which includes matrix outputs). For the typical PR critical path (docs ~7m), this has no impact since init (~4m) + test (~2m) = ~6m finishes before docs. --- .github/workflows/ci.yml | 115 ++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 460910a5aa8..ab787f59e43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -133,34 +133,6 @@ jobs: nx_base: ${{ steps.setup.outputs.base }} build_type: ${{ steps.setup.outputs.type }} snapshot_branch: ${{ steps.snapshot-prepare.outputs.branch }} - runs-on: ubuntu-latest - steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 1 # shallow copy - - - name: Fetch Refs - run: | - git fetch origin --depth 1 latest - git fetch origin --depth 1 tag latest-success - - - name: Setup - id: setup - uses: ./.github/actions/setup-nx - with: - cache_mode: 'rw' - - - name: Prepare Snapshot Branch - uses: ./.github/actions/snapshot-prepare - id: snapshot-prepare - - calc_matrix: - name: Calculate Github Matrix - needs: [ detect-changes, init ] - if: needs.detect-changes.outputs.run_code_ci == 'true' - outputs: test_count: ${{ steps.matrix.outputs.test_count }} test_matrix: ${{ steps.matrix.outputs.test_matrix }} test_pkg_matrix: ${{ steps.matrix.outputs.pkg_matrix }} @@ -185,7 +157,11 @@ jobs: id: setup uses: ./.github/actions/setup-nx with: - cache_mode: ro + cache_mode: 'rw' + + - name: Prepare Snapshot Branch + uses: ./.github/actions/snapshot-prepare + id: snapshot-prepare - name: Calculate Matrix id: matrix @@ -228,15 +204,14 @@ jobs: test: runs-on: ubuntu-24.04 name: Unit Tests (${{ matrix.shard }}/${{ strategy.job-total }}) - needs: [ detect-changes, calc_matrix ] + needs: [ detect-changes, init ] if: needs.detect-changes.outputs.run_code_ci == 'true' && - needs.calc_matrix.outputs.test_count > 0 + needs.init.outputs.test_count > 0 strategy: - matrix: ${{ fromJson(needs.calc_matrix.outputs.test_matrix )}} + matrix: ${{ fromJson(needs.init.outputs.test_matrix )}} fail-fast: false env: NX_PARALLEL: 1 - NX_BASE: ${{ needs.init.outputs.nx_base }} steps: - name: Checkout id: checkout @@ -288,15 +263,14 @@ jobs: e2e: runs-on: ubuntu-latest name: e2e Tests - needs: [ detect-changes, calc_matrix ] + needs: [ detect-changes, init ] if: needs.detect-changes.outputs.run_code_ci == 'true' && - needs.calc_matrix.outputs.e2e_test_count > 0 + needs.init.outputs.e2e_test_count > 0 strategy: - matrix: ${{ fromJson(needs.calc_matrix.outputs.e2e_test_matrix )}} + matrix: ${{ fromJson(needs.init.outputs.e2e_test_matrix )}} fail-fast: false env: NX_PARALLEL: 1 - NX_BASE: ${{ needs.init.outputs.nx_base }} steps: - name: Checkout id: checkout @@ -323,16 +297,14 @@ jobs: path: | reports/ - format_lint_build: + lint: runs-on: ubuntu-latest - name: Format, Lint and Build - needs: [ detect-changes, init ] - if: ${{ always() && needs.detect-changes.result == 'success' && - (needs.init.result == 'success' || needs.init.result == 'skipped') }} + name: Lint & Format Check + needs: [ detect-changes ] + if: ${{ always() && needs.detect-changes.result == 'success' }} outputs: format: ${{ steps.format.outcome || '' }} lint: ${{ steps.lint.outcome || '' }} - build: ${{ steps.build.outcome || '' }} steps: - name: Checkout id: checkout @@ -361,23 +333,41 @@ jobs: run: | yarn nx lint + build: + runs-on: ubuntu-latest + name: Build + needs: [ detect-changes ] + if: needs.detect-changes.outputs.run_code_ci == 'true' && + github.event.pull_request.draft == false + outputs: + build: ${{ steps.build.outcome || '' }} + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 # shallow copy + + - name: Setup + id: setup + uses: ./.github/actions/setup-nx + with: + cache_mode: ro + - name: nx build id: build - if: needs.detect-changes.outputs.run_code_ci == 'true' run: | yarn nx run-many --t build -c staging --exclude ag-grid-docs --exclude all docs: runs-on: ubuntu-latest name: Docs Build & Link Checker - needs: [ detect-changes, init ] + needs: [ detect-changes ] if: ${{ (needs.detect-changes.outputs.run_code_ci == 'true' || - needs.detect-changes.outputs.run_docs_ci == 'true') && needs.init.result - == 'success' && !inputs.skip_docs }} + needs.detect-changes.outputs.run_docs_ci == 'true') && + github.event.pull_request.draft == false && !inputs.skip_docs }} strategy: fail-fast: false - env: - NX_BASE: ${{ needs.init.outputs.nx_base }} outputs: docs_deployed: ${{ steps.deploy_to_staging.outcome }} steps: @@ -400,8 +390,11 @@ jobs: run: node scripts/deployments/validateGridModulesList.js - name: docs build and link checker - run: CHECK_LINKS=true CHECK_REDIRECTS=true yarn nx run ag-grid-docs:build -c - staging + run: | + if [[ "${{ github.event_name }}" != "pull_request" ]] || [[ "${{ needs.detect-changes.outputs.run_docs_ci }}" == "true" ]]; then + export CHECK_LINKS=true CHECK_REDIRECTS=true + fi + yarn nx run ag-grid-docs:build -c staging - name: validate base url run: node scripts/deployments/sanityCheckBaseUrl.js staging @@ -434,12 +427,12 @@ jobs: name: Framework Package Tests (${{ matrix.framework }}) permissions: contents: write - needs: [ calc_matrix, init ] + needs: [ init ] if: (needs.init.outputs.build_type == 'latest' || needs.init.outputs.build_type == 'release') || inputs.run_package_tests strategy: fail-fast: false - matrix: ${{ fromJson(needs.calc_matrix.outputs.test_pkg_matrix )}} + matrix: ${{ fromJson(needs.init.outputs.test_pkg_matrix )}} env: NX_BASE: ${{ needs.init.outputs.nx_base }} steps: @@ -480,9 +473,9 @@ jobs: init, test, e2e, - format_lint_build, + lint, + build, docs, - calc_matrix, fw_pkg_test, sonar_community, sonar_enterprise, @@ -546,13 +539,13 @@ jobs: WORKFLOW_STATUS="success" if [[ "${{ needs.init.result }}" == "failure" ]] ; then WORKFLOW_STATUS="failure" - elif [[ "${{ needs.calc_matrix.result }}" == "failure" ]] ; then - WORKFLOW_STATUS="failure" elif [ "${{ needs.test.result }}" == "failure" ] ; then WORKFLOW_STATUS="failure" elif [ "${{ needs.e2e.result }}" == "failure" ] ; then WORKFLOW_STATUS="failure" - elif [ "${{ needs.format_lint_build.result }}" == "failure" ] ; then + elif [ "${{ needs.lint.result }}" == "failure" ] ; then + WORKFLOW_STATUS="failure" + elif [ "${{ needs.build.result }}" == "failure" ] ; then WORKFLOW_STATUS="failure" elif [ "${{ needs.docs.result }}" == "failure" ] ; then WORKFLOW_STATUS="failure" @@ -633,9 +626,9 @@ jobs: "changedState": ${{ steps.lastJobStatus.outputs.changedState == 'true' }}, "jobStatuses": { - "Format": "${{ needs.format_lint_build.outputs.format }}", - "Lint": "${{ needs.format_lint_build.outputs.lint }}", - "Build": "${{ needs.format_lint_build.outputs.build }}", + "Format": "${{ needs.lint.outputs.format }}", + "Lint": "${{ needs.lint.outputs.lint }}", + "Build": "${{ needs.build.outputs.build }}", "Test": "${{ needs.test.result }}", "e2e": "${{ needs.e2e.result }}", "FW_Pkg": "${{ needs.fw_pkg_test.result }}",