Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions .github/workflows/all_plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ jobs:
with:
melos-version: '5.3.0'
- name: 'Run Analyze'
run: melos analyze-ci
run: melos analyze-ci > analyze.log || true
- name: 'Summarize analyze failures'
if: ${{ always() }}
run: ./.github/workflows/scripts/summarize_errors.sh "error •" analyze.log

# Separated from "analyse" action as pubspec_override file is not being taken into account when running `flutter pub publish --dry-run`
# This will fail on CI until this is fixed: https://github.com/invertase/melos/issues/467
Expand All @@ -52,7 +55,10 @@ jobs:
- name: 'Pub Check'
run: |
melos exec -c 1 --no-private --ignore="*example*" -- \
dart pub publish --dry-run
dart pub publish --dry-run > pub_dry_run.log || true
- name: 'Summarize pub dry run failures'
if: ${{ always() }}
run: ./.github/workflows/scripts/summarize_errors.sh "error" pub_dry_run.log

pub_get_check:
timeout-minutes: 30
Expand Down Expand Up @@ -96,15 +102,14 @@ jobs:
run: |
clang-format --version
swiftformat --version
- name: 'Dart, Java and Objective-C '
- name: 'Format'
run: |
flutter pub global run flutter_plugin_tools format
./.github/workflows/scripts/validate-formatting.sh
- name: 'Swift'
if: ${{ success() || failure() }}
run: |
swiftformat .
./.github/workflows/scripts/validate-formatting.sh
./.github/workflows/scripts/validate-formatting.sh > format.log || true
- name: 'Summarize format failures'
if: ${{ always() }}
run: ./.github/workflows/scripts/summarize_errors.sh "❌ Some files are incorrectly formatted, see above output." format.log

build_examples_dart:
timeout-minutes: 30
Expand Down Expand Up @@ -162,9 +167,12 @@ jobs:
with:
melos-version: '5.3.0'
- name: 'Flutter Test'
run: melos run test --no-select
run: melos run test --no-select > test.log || true
- name: 'Flutter Test - Web'
run: melos run test:web --no-select
run: melos run test:web --no-select > test_web.log || true
- name: 'Summarize test failures'
if: ${{ always() }}
run: ./.github/workflows/scripts/summarize_errors.sh "Some tests failed." test.log test_web.log

check-files-license-headers:
runs-on: ubuntu-latest
Expand All @@ -187,4 +195,7 @@ jobs:
run-bootstrap: false
melos-version: '5.3.0'
- name: Check license header
run: melos run check-license-header
run: melos run check-license-header > license_header.log || true
- name: 'Summarize license header failures'
if: ${{ always() }}
run: ./.github/workflows/scripts/summarize_errors.sh "failed" license_header.log
62 changes: 62 additions & 0 deletions .github/workflows/scripts/summarize_errors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

set -e

if [ "$#" -lt 2 ]; then
echo "Usage: $0 <search_pattern> <logfile1> [<logfile2> ...]"
exit 1
fi

search_pattern="$1"
shift

echo "Analyzing test logs for failures with pattern: '$search_pattern'"

for logfile in "$@"; do
if [ ! -f "$logfile" ]; then
echo "Log file not found: $logfile"
continue
fi

echo "Checking $logfile..."

# The awk script is now parameterized with the search_pattern variable.
# We use a flag `failure_found` to indicate if a failure has been detected.
# This is to prevent the script from exiting early if a failure is found.
failure_found=0
while IFS= read -r line; do
if [[ "$line" == "melos exec"* ]]; then
in_melos_block=true
package_path=""
fi

if $in_melos_block && [[ "$line" == *"└> CWD:"* ]]; then
package_path=$(echo "$line" | awk '{print $3}')
fi

if [[ "$line" =~ $search_pattern ]]; then
if [ "$failure_found" -eq 0 ]; then
echo ""
echo "================================================================="
echo " Error Summary for $logfile"
echo "================================================================="
failure_found=1
fi

if [ -n "$package_path" ]; then
echo "❌ Failure detected in package: $package_path"
else
echo "❌ Failure detected in $logfile"
fi
echo " $line"
echo ""
fi

if $in_melos_block && [[ "$line" == *"melos exec done"* ]]; then
in_melos_block=false
package_path=""
fi
done < "$logfile"
done

echo "Analysis complete."
4 changes: 2 additions & 2 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ scripts:

test:
run: |
melos exec -c 6 --fail-fast -- \
melos exec -c 6 -- \
"flutter test"
description: Run `flutter test` for a specific package.
packageFilters:
Expand All @@ -146,7 +146,7 @@ scripts:

test:web:
run: |
melos exec -c 1 --fail-fast -- \
melos exec -c 1 -- \
"flutter test --platform=chrome"
description: Run `flutter test --platform=chrome` for a specific '*web' package.
packageFilters:
Expand Down
Loading