name: Flutter Test on: pull_request: branches: - main push: branches: - "**" - "!main" jobs: test: name: Flutter Tests runs-on: ubuntu-latest container: image: ghcr.io/cirruslabs/flutter:stable defaults: run: working-directory: kell_creations_apps steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies — core run: cd packages/core && flutter pub get - name: Install dependencies — design_system run: cd packages/design_system && flutter pub get - name: Install dependencies — feature_wordpress run: cd packages/feature_wordpress && flutter pub get - name: Install dependencies — kell_web run: cd apps/kell_web && flutter pub get - name: Test — core run: | cd packages/core flutter test --reporter expanded 2>&1 | tee test_output.txt echo "" echo "=== core test summary ===" TOTAL=$(grep -cE '^\s*✓' test_output.txt || echo "0") FAILED=$(grep -cE '^\s*✗' test_output.txt || echo "0") echo " Passed: $TOTAL" echo " Failed: $FAILED" # Fail the step if any tests failed if [ "$FAILED" -gt 0 ]; then exit 1; fi - name: Test — design_system run: | cd packages/design_system flutter test --reporter expanded 2>&1 | tee test_output.txt echo "" echo "=== design_system test summary ===" TOTAL=$(grep -cE '^\s*✓' test_output.txt || echo "0") FAILED=$(grep -cE '^\s*✗' test_output.txt || echo "0") echo " Passed: $TOTAL" echo " Failed: $FAILED" if [ "$FAILED" -gt 0 ]; then exit 1; fi - name: Test — feature_wordpress run: | cd packages/feature_wordpress flutter test --reporter expanded 2>&1 | tee test_output.txt echo "" echo "=== feature_wordpress test summary ===" TOTAL=$(grep -cE '^\s*✓' test_output.txt || echo "0") FAILED=$(grep -cE '^\s*✗' test_output.txt || echo "0") echo " Passed: $TOTAL" echo " Failed: $FAILED" if [ "$FAILED" -gt 0 ]; then exit 1; fi - name: Test — kell_web run: | cd apps/kell_web flutter test --reporter expanded 2>&1 | tee test_output.txt echo "" echo "=== kell_web test summary ===" TOTAL=$(grep -cE '^\s*✓' test_output.txt || echo "0") FAILED=$(grep -cE '^\s*✗' test_output.txt || echo "0") echo " Passed: $TOTAL" echo " Failed: $FAILED" if [ "$FAILED" -gt 0 ]; then exit 1; fi - name: Aggregate test report if: always() run: | echo "" echo "╔══════════════════════════════════════╗" echo "║ Flutter Test Results Summary ║" echo "╠══════════════════════════════════════╣" echo "║ Package Pass Fail ║" echo "╠══════════════════════════════════════╣" TOTAL_PASS=0 TOTAL_FAIL=0 for pkg in packages/core packages/design_system packages/feature_wordpress apps/kell_web; do NAME=$(basename "$pkg") OUTPUT="$pkg/test_output.txt" if [ -f "$OUTPUT" ]; then PASS=$(grep -cE '^\s*✓' "$OUTPUT" || echo "0") FAIL=$(grep -cE '^\s*✗' "$OUTPUT" || echo "0") else PASS="—" FAIL="—" fi printf "║ %-20s %-7s %-7s ║\n" "$NAME" "$PASS" "$FAIL" if [ "$PASS" != "—" ]; then TOTAL_PASS=$((TOTAL_PASS + PASS)); fi if [ "$FAIL" != "—" ]; then TOTAL_FAIL=$((TOTAL_FAIL + FAIL)); fi done echo "╠══════════════════════════════════════╣" printf "║ %-20s %-7s %-7s ║\n" "TOTAL" "$TOTAL_PASS" "$TOTAL_FAIL" echo "╚══════════════════════════════════════╝" if [ "$TOTAL_FAIL" -gt 0 ]; then echo "" echo "❌ Some tests failed. See individual package results above." exit 1 else echo "" echo "✅ All $TOTAL_PASS tests passed across all packages." fi