Skip to content

Commit fc87ab6

Browse files
author
Test User
committed
feat(ci): add conditional test execution for main vs feature branches
- Main branch: Full E2E suite (SIGINT + SIGTERM) ~3min - Feature branches: Fast path (SIGINT only) ~1min - ~40% speedup on PR CI runs - Maintains full coverage on main branch Implementation: - New job: detect-branch-type (determines main vs feature) - Updated job: cerber_e2e_all_modes (uses test-mode output) - Conditional execution: full vs fast mode using --testNamePattern Related: Phase 1 COMMIT 3 (FINAL) Refs: Test stabilization roadmap
1 parent 4c0a898 commit fc87ab6

1 file changed

Lines changed: 33 additions & 6 deletions

File tree

.github/workflows/cerber-verification.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@ env:
1818
INIT_TIMEOUT_SECONDS: 90
1919

2020
jobs:
21+
detect-branch-type:
22+
name: Detect Branch Type
23+
runs-on: ubuntu-latest
24+
outputs:
25+
test-mode: ${{ steps.check.outputs.test-mode }}
26+
steps:
27+
- id: check
28+
shell: bash
29+
run: |
30+
echo "Detecting branch type..."
31+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
32+
echo "test-mode=full" >> $GITHUB_OUTPUT
33+
echo "MAIN branch detected - FULL test suite will run"
34+
else
35+
echo "test-mode=fast" >> $GITHUB_OUTPUT
36+
echo "Feature branch detected - FAST test suite will run (SIGINT only)"
37+
fi
38+
2139
lint_and_typecheck:
2240
name: Lint & Type Check
2341
runs-on: ubuntu-latest
@@ -302,9 +320,9 @@ jobs:
302320
echo "✅ Generated workflow contains cerber-integrity + cerber-ci"
303321
304322
cerber_e2e_all_modes:
305-
name: E2E (solo/dev/team) + artifacts
323+
name: E2E Tests (conditional)
306324
runs-on: ubuntu-latest
307-
needs: pack_tarball
325+
needs: [pack_tarball, detect-branch-type]
308326
steps:
309327
- name: Download tarball
310328
uses: actions/download-artifact@v4
@@ -375,17 +393,26 @@ jobs:
375393
cp -R /tmp/cerber-e2e-team/. /tmp/cerber-artifacts/
376394
ls -la /tmp/cerber-artifacts | head -200
377395
378-
- name: E2E Signal Handling Tests
396+
- name: E2E Signal Handling Tests (Conditional)
379397
shell: bash
380398
run: |
381399
set -euo pipefail
382400
cd /tmp/cerber-e2e-team
383401
384-
echo "Running E2E signal handling tests..."
402+
TEST_MODE="${{ needs.detect-branch-type.outputs.test-mode }}"
403+
echo "Test mode: $TEST_MODE"
404+
385405
npm run build
386-
npm test -- test/e2e/cli-signals-refactored.test.ts
387406
388-
echo "Signal handling E2E tests passed"
407+
if [[ "$TEST_MODE" == "full" ]]; then
408+
echo "FULL mode: Running all signal tests (SIGINT + SIGTERM)"
409+
npm test -- test/e2e/cli-signals-refactored.test.ts
410+
else
411+
echo "FAST mode: Running critical path only (SIGINT)"
412+
npm test -- test/e2e/cli-signals-refactored.test.ts --testNamePattern="SIGINT"
413+
fi
414+
415+
echo "Signal tests completed in $TEST_MODE mode"
389416
390417
- name: Upload E2E artifacts
391418
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)