Skip to content
Open
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
71 changes: 33 additions & 38 deletions .github/workflows/check-settings-view-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ jobs:
lfs: true
fetch-depth: 0

- name: Install runner system packages
run: |
set -eux
# Ensure tools required by the tests and LFS are present on the runner
sudo apt-get update
sudo apt-get install -y --no-install-recommends git-lfs poppler-utils xz-utils curl ca-certificates
# Initialize git-lfs so later git lfs commands work reliably
git lfs install --system || true
shell: bash

- name: Ensure LFS assets are present (diagnostic)
run: |
# Sometimes LFS pointers are fetched but not checked out into working tree;
Expand Down Expand Up @@ -58,46 +68,31 @@ jobs:
echo "Font present; no pubspec change needed"
fi

- name: Install Flutter SDK (manual)
run: |
set -eux
# Download and extract a pinned Flutter SDK to avoid action resolution issues
FLUTTER_VERSION=3.9.2
FLUTTER_ARCHIVE=flutter_linux_${FLUTTER_VERSION}-stable.tar.xz
FLUTTER_URL="https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/${FLUTTER_ARCHIVE}"
echo "Downloading Flutter from $FLUTTER_URL"
# -f: fail on HTTP errors, -S: show errors, -L: follow redirects
set +e
curl -fSL -o /tmp/${FLUTTER_ARCHIVE} "$FLUTTER_URL"
CURL_EXIT=$?
set -e
if [ $CURL_EXIT -eq 0 ]; then
echo "Downloaded archive:" && ls -lh /tmp/${FLUTTER_ARCHIVE} || true
echo "File type:" && file /tmp/${FLUTTER_ARCHIVE} || true
# Verify we actually downloaded an xz-compressed archive and not an HTML error page
if file /tmp/${FLUTTER_ARCHIVE} | grep -qi 'XZ compressed'; then
echo "Extracting downloaded Flutter archive"
tar -xJf /tmp/${FLUTTER_ARCHIVE} -C $HOME
else
echo "Downloaded file is not an xz archive; will fall back to git-clone method" >&2
fi
else
echo "curl failed with exit code $CURL_EXIT; will fall back to git-clone method" >&2
fi
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

# If extraction did not produce $HOME/flutter, fall back to a shallow git clone of the tagged release
if [ ! -d "$HOME/flutter/bin" ]; then
echo "Falling back to git clone of flutter repo (tag: $FLUTTER_VERSION)"
# Clone the stable branch as a fallback (tag/archived release may not be present)
git clone --depth 1 --branch stable https://github.com/flutter/flutter.git $HOME/flutter
fi
- name: Setup Flutter (action)
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

# Persist flutter/bin to following steps by writing to $GITHUB_PATH
echo "$HOME/flutter/bin" >> $GITHUB_PATH
echo "Flutter installed at $HOME/flutter"
# Use the explicit path in this step (GITHUB_PATH only affects later steps)
$HOME/flutter/bin/flutter --version
shell: bash
- name: Verify Flutter
run: flutter --version

- name: Cache Pub packages
uses: actions/cache@v4
with:
path: |
~/.pub-cache
~/.pub-cache/hosted
~/.pub-cache/git
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-pub-

- name: Install dependencies
run: flutter pub get
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/coverage-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Cache Pub packages
uses: actions/cache@v4
with:
path: |
~/.pub-cache
~/.pub-cache/hosted
~/.pub-cache/git
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Install chrome
run: |
sudo apt update
Expand All @@ -22,8 +32,26 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y poppler-utils
- name: Install lcov (for genhtml)
run: |
sudo apt-get update
sudo apt-get install -y lcov
- name: Verify installed tools
run: |
echo "Flutter:" && flutter --version || true
echo "pdftotext (poppler):" && pdftotext -v || echo "pdftotext not present"
echo "git-lfs:" && git lfs --version || echo "git-lfs not present"
- name: Get packages
run: flutter pub get
- name: Ensure lcov present (defensive)
run: |
if ! command -v lcov >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y lcov
else
echo "lcov present: $(lcov --version)"
fi

- name: Run coverage script
run: |
chmod +x ./scripts/collect_coverage.sh
Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ jobs:
- name: Verify Flutter
run: flutter --version

- name: Debug: print environment and tools
run: |
set -eux
echo "===== ENV ====="
uname -a || true
echo "JAVA_HOME=$JAVA_HOME"
java -version || true
javac -version || true
echo "Flutter:" && flutter --version || true
echo "Which flutter: $(which flutter || true)"
echo "pdftotext:" && pdftotext -v || echo "pdftotext not installed"
echo "git-lfs:" && git lfs --version || echo "git-lfs not installed"
echo "lcov:" && lcov --version || echo "lcov not installed"
echo "genhtml:" && genhtml --version || echo "genhtml not installed"
echo "which chrome: $(which google-chrome || which google-chrome-stable || true)"

- name: Install dependencies
run: flutter pub get

Expand All @@ -52,11 +68,20 @@ jobs:
sudo apt-get install -y poppler-utils

- name: Install lcov (for genhtml)
run: sudo apt-get install -y lcov
run: |
sudo apt-get update
sudo apt-get install -y lcov

- name: Run coverage script (VM + Chrome)
env:
CHROME_BIN: /usr/bin/google-chrome-stable
run: |
chmod +x ./scripts/collect_coverage.sh
# Defensive: ensure lcov is present before running the collection script
if ! command -v lcov >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y lcov
fi
./scripts/collect_coverage.sh

- name: Upload coverage HTML
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/flutter-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ jobs:
channel: 'stable'
- name: Verify Flutter
run: flutter --version
- name: Debug: print environment and tools
run: |
set -eux
echo "===== ENV ====="
uname -a || true
echo "JAVA_HOME=$JAVA_HOME"
java -version || true
javac -version || true
echo "Flutter:" && flutter --version || true
echo "Which flutter: $(which flutter || true)"
echo "pdftotext:" && pdftotext -v || echo "pdftotext not installed"
echo "git-lfs:" && git lfs --version || echo "git-lfs not installed"
echo "lcov:" && lcov --version || echo "lcov not installed"
- name: Cache Flutter Pub packages
uses: actions/cache@v4
with:
Expand All @@ -42,11 +55,18 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y poppler-utils
- name: Verify installed tools
run: |
echo "Flutter:" && flutter --version || true
echo "pdftotext (poppler):" && pdftotext -v || echo "pdftotext not present"
echo "git-lfs:" && git lfs --version || echo "git-lfs not present"
- name: Run tests with coverage
run: flutter test --coverage --no-shard

- name: Install lcov (for genhtml)
run: sudo apt-get update && sudo apt-get install -y lcov
run: |
sudo apt-get update
sudo apt-get install -y lcov

- name: Filter LCOV (remove non-web IO-only entries)
run: |
Expand Down
55 changes: 50 additions & 5 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ jobs:
else
echo "No font downloader script found at tool/download_fonts.sh; continuing"
fi
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
Expand All @@ -30,12 +36,23 @@ jobs:
# concrete Flutter SDK (avoids treating 'stable' as a literal
# version string).
channel: stable

- name: Setup JDK 21
uses: actions/setup-java@v4
- name: Cache Pub packages
uses: actions/cache@v4
with:
distribution: temurin
java-version: 21
path: |
~/.pub-cache
~/.pub-cache/hosted
~/.pub-cache/git
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Verify installed tools (Linux)
if: runner.os == 'Linux'
run: |
echo "Flutter:" && flutter --version || true
echo "pdftotext (poppler):" && pdftotext -v || echo "pdftotext not present"
echo "git-lfs:" && git lfs --version || echo "git-lfs not present"

- name: Debug: show Java/Gradle info
run: |
echo "JAVA_HOME=$JAVA_HOME"
Expand All @@ -55,6 +72,12 @@ jobs:
sudo apt-get update
sudo apt-get install -y google-chrome-stable

- name: Install lcov (for genhtml)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y lcov

- name: Enable web support
run: flutter config --enable-web

Expand Down Expand Up @@ -87,10 +110,32 @@ jobs:
echo "No font downloader script found at tool/download_fonts.sh; continuing"
fi

- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Cache Pub packages (macOS)
if: runner.os == 'macOS'
uses: actions/cache@v4
with:
path: |
~/.pub-cache
~/.pub-cache/hosted
~/.pub-cache/git
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Verify installed tools (macOS)
if: runner.os == 'macOS'
run: |
echo "Flutter:" && flutter --version || true
if command -v pdftotext >/dev/null 2>&1; then pdftotext -v; else brew list --versions poppler || echo "pdftotext/poppler not present"; fi
echo "git-lfs:" && git lfs --version || echo "git-lfs not present"

- name: Setup JDK 21
uses: actions/setup-java@v4
Expand Down
8 changes: 3 additions & 5 deletions tools/check_settings_view_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ if [ ! -f "$LCOV_FILE" ]; then
exit 2
fi

# Find the LF and LH values for the settings_view.dart record.
# Match any SF line that ends with lib/views/settings_view.dart (absolute or relative path).
set -eu

LCOV_FILE="coverage/lcov.info"
if [ ! -f "$LCOV_FILE" ]; then
echo "Coverage file not found: $LCOV_FILE"
exit 2
fi

# Robustly extract LF and LH for the settings_view.dart SF record.
# Accept SF:lib/... or SF:/absolute/path/.../lib/... so we match any SF line that
# ends with lib/views/settings_view.dart
read -r LF LH <<EOF
$(awk '/^SF:lib\/views\/settings_view.dart/{f=1;next} f&&/^LF:/{lf=substr($0,4)} f&&/^LH:/{lh=substr($0,4); print lf " " lh; exit}' "$LCOV_FILE")
$(awk '/^SF:.*lib\/views\/settings_view\.dart$/ { in_record=1; next } in_record && /^LF:/ { lf=substr($0,4) } in_record && /^LH:/ { lh=substr($0,4); print lf " " lh; exit }' "$LCOV_FILE")
EOF

if [ -z "$LF" ] || [ -z "$LH" ]; then
Expand Down