Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ci): shard jest 4 ways and use all runner cores (#68143)

Thomas Obermüller49a92541bed2
diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.yml
index e1ba5721e8b6..a29fa4a0c7c8 100644
--- a/.github/workflows/ci-frontend.yml
+++ b/.github/workflows/ci-frontend.yml
@@ -625,7 +625,7 @@ jobs:
# or skip jest entirely (should_run=false) when selection can't be
# trusted. On ready PRs, master push, and merge_group it's skipped, so
# we fall back to the full FOSS×EE × chunk fanout (the merge gate).
- matrix: ${{ fromJson(needs.select-jest-tests.outputs.matrix || '{"segment":["FOSS","EE"],"chunk":[1,2]}') }}
+ matrix: ${{ fromJson(needs.select-jest-tests.outputs.matrix || '{"segment":["FOSS","EE"],"chunk":[1,2,3,4]}') }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -643,7 +643,10 @@ jobs:
env:
NODE_OPTIONS: --max-old-space-size=16384
SHARD_INDEX: ${{ matrix.chunk }}
- SHARD_COUNT: 2
+ # Keep shard runtime well under timeout-minutes: the EE suite at 2
+ # shards ran 13-15 min on the 2-worker config and regularly died at
+ # the 15-min timeout, failing the whole run.
+ SHARD_COUNT: 4
MODE: ${{ needs.select-jest-tests.outputs.mode }}
CHANGED_FILES: ${{ needs.select-jest-tests.outputs.changed_files }}
run: |
@@ -665,7 +668,9 @@ jobs:
--passWithNoTests \
--findRelatedTests $CHANGED_FILES
else
- bin/turbo run test --filter=@posthog/frontend -- --maxWorkers=2
+ # 100% = one worker per available core. Public-repo ubuntu-latest
+ # runners have 4 vCPUs; a hardcoded 2 left half the machine idle.
+ bin/turbo run test --filter=@posthog/frontend -- --maxWorkers=100%
fi
calculate-running-time: