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.

chore(ci): raise storybook shards to 28 chromium and 8 webkit (#122117)

Georges-Antoine Assi9a2885917a98
diff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.yml
index f899a9f4a795..82ba7e3b0d34 100644
--- a/.github/workflows/ci-storybook.yml
+++ b/.github/workflows/ci-storybook.yml
@@ -32,6 +32,9 @@ env:
# npm's audit blocks the pnpm bootstrap. See .github/actions/pnpm-install for why.
NPM_CONFIG_AUDIT: 'false'
NPM_CONFIG_FUND: 'false'
+ # Shard counts — change here to resize the matrix. CHROMIUM_SHARDS also caps narrowed PR runs.
+ CHROMIUM_SHARDS: 28
+ WEBKIT_SHARDS: 8
jobs:
# Learning mode: nothing reads these outputs, so a recommendation cannot change what runs.
@@ -223,10 +226,6 @@ jobs:
&& startsWith(github.head_ref, 'trunk-merge/')
}}
run: |
- # Shard counts — change here to resize the matrix.
- CHROMIUM_SHARDS=16
- WEBKIT_SHARDS=4
-
shards() {
jq -cn --arg browser "$1" --argjson count "$2" \
'[range(1; $count + 1) | {browser: $browser, shard_count: $count, shard: .}]'
@@ -1401,7 +1400,7 @@ jobs:
if [[ -s /tmp/selection-result.json ]]; then
total=$(jq -r '.total_story_count // empty' /tmp/selection-result.json)
affected=$(jq -r '.affected_story_count // empty' /tmp/selection-result.json)
- shards=$(jq -r '(([.suggested_shards, 16] | min) // empty)' /tmp/selection-result.json)
+ shards=$(jq -r --argjson cap "$CHROMIUM_SHARDS" '(([.suggested_shards, $cap] | min) // empty)' /tmp/selection-result.json)
fi
{
echo "narrowed=$1"
@@ -1446,7 +1445,7 @@ jobs:
# Size the narrowed matrix from the estimated affected workload.
AFFECTED_FILES_JSON=$(jq -c '.affected_stories' /tmp/selection-result.json)
- SHARDS=$(jq -r '[.suggested_shards, 16] | min' /tmp/selection-result.json)
+ SHARDS=$(jq -r --argjson cap "$CHROMIUM_SHARDS" '[.suggested_shards, $cap] | min' /tmp/selection-result.json)
MATRIX=$(jq -cn --argjson count "$SHARDS" \
'{include: [range(1; $count + 1) | {browser: "chromium", shard_count: $count, shard: .}]}')
echo "mode=selective" >> "$GITHUB_OUTPUT"
@@ -1454,11 +1453,11 @@ jobs:
echo "should_run=true" >> "$GITHUB_OUTPUT"
echo "affected_files_json=$AFFECTED_FILES_JSON" >> "$GITHUB_OUTPUT"
- # Est. minutes saved vs the full 16-shard run — same formula as the
- # "Write summary" step (CURRENT_SHARDS=16, SHARD_OVERHEAD_MINUTES=3).
+ # Est. minutes saved vs the full chromium run — same formula as the
+ # "Write summary" step (SHARD_OVERHEAD_MINUTES=3).
AFFECTED_DUR=$(jq -r '.affected_duration_seconds' /tmp/selection-result.json)
TOTAL_DUR=$(jq -r '.total_duration_seconds' /tmp/selection-result.json)
- FULL_MINUTES=$(( (16 * 3) + (TOTAL_DUR / 60) ))
+ FULL_MINUTES=$(( (CHROMIUM_SHARDS * 3) + (TOTAL_DUR / 60) ))
SELECTIVE_MINUTES=$(( (SHARDS * 3) + (AFFECTED_DUR / 60) ))
emit_metrics true "" "$(( FULL_MINUTES - SELECTIVE_MINUTES ))"
echo "Selective mode: $COUNT affected story files across $SHARDS shard(s)"
@@ -1467,7 +1466,7 @@ jobs:
if: steps.selection.outcome == 'success'
env:
RESULT: ${{ steps.selection.outputs.result }}
- CURRENT_SHARDS: 16
+ CURRENT_SHARDS: ${{ env.CHROMIUM_SHARDS }}
SHARD_OVERHEAD_MINUTES: 3
run: |
MODE=$(echo "$RESULT" | jq -r '.mode')
@@ -1477,7 +1476,7 @@ jobs:
COUNT=$(echo "$RESULT" | jq -r '.affected_story_count')
AFFECTED_DUR=$(echo "$RESULT" | jq -r '.affected_duration_seconds')
TOTAL_DUR=$(echo "$RESULT" | jq -r '.total_duration_seconds')
- SHARDS=$(echo "$RESULT" | jq -r '[.suggested_shards, 16] | min')
+ SHARDS=$(echo "$RESULT" | jq -r --argjson cap "$CURRENT_SHARDS" '[.suggested_shards, $cap] | min')
SAVED_STORIES=$((TOTAL - COUNT))
SAVED_SHARDS=$((CURRENT_SHARDS - SHARDS))