From aeeacfc84bb10bb5f0797da0b5f73118260b2e37 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 20:04:47 +0000 Subject: [PATCH 1/6] Add comprehensive CI sanity checks and documentation Co-authored-by: Doezer <11655673+Doezer@users.noreply.github.com> --- .github/workflows/ci.yml | 115 +++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 20 ++++++- README.md | 17 ++++++ analysis_options.yaml | 5 ++ 4 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..68da105c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,115 @@ +name: CI - Sanity Checks + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + analyze: + name: Code Analysis + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Cache Pub dependencies + uses: actions/cache@v4 + with: + path: | + ~/.pub-cache + key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pub- + + - name: Install dependencies + run: flutter pub get + + - name: Verify formatting + run: | + # Find all Dart files excluding generated files + FILES=$(find lib test -name "*.dart" ! -name "*.g.dart" ! -name "*.freezed.dart" -type f 2>/dev/null || true) + if [ -z "$FILES" ]; then + echo "No Dart files found to format" + exit 0 + fi + echo "$FILES" | xargs dart format --output=none --set-exit-if-changed + + - name: Analyze code + run: flutter analyze + + test: + name: Unit Tests + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Cache Pub dependencies + uses: actions/cache@v4 + with: + path: | + ~/.pub-cache + key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pub- + + - name: Install dependencies + run: flutter pub get + + - name: Run tests + run: | + if [ -d "test" ] && [ "$(find test -name '*_test.dart' | wc -l)" -gt 0 ]; then + flutter test + else + echo "No tests found, skipping test execution" + fi + + dependency-check: + name: Dependency Validation + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Cache Pub dependencies + uses: actions/cache@v4 + with: + path: | + ~/.pub-cache + key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pub- + + - name: Verify dependencies + run: | + flutter pub get + flutter pub outdated diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1742ed9d..5f452b28 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,9 +10,27 @@ ## Development - Follow Dart/Flutter conventions -- Run `flutter analyze` before submitting +- Run `dart format .` to format your code +- Run `flutter analyze` before submitting to check for issues +- Run `flutter test` if tests are available - Test your changes thoroughly +### Code Quality Checks + +The project includes automated CI checks that run on all pull requests: + +1. **Code Formatting**: Ensures code follows Dart formatting standards + - Run locally: `dart format .` + - CI check excludes generated files (`.g.dart`, `.freezed.dart`) + +2. **Static Analysis**: Checks for code issues and potential bugs + - Run locally: `flutter analyze` + +3. **Tests**: Runs unit and widget tests (when available) + - Run locally: `flutter test` + +All these checks must pass before your changes can be merged. + ## Internationalization (i18n) This project uses `slang` for internationalization with JSON files. diff --git a/README.md b/README.md index e2092494..a9fff3c1 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,23 @@ flutter run ## Development +### Code Quality + +Before submitting changes, ensure your code passes all quality checks: + +```bash +# Format code +dart format . + +# Analyze code for issues +flutter analyze + +# Run tests (if available) +flutter test +``` + +These checks are automatically run in CI for all pull requests. + ### Code Generation The project uses code generation for JSON serialization. After modifying model classes, run: diff --git a/analysis_options.yaml b/analysis_options.yaml index f9b30346..2e3c70e5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1 +1,6 @@ include: package:flutter_lints/flutter.yaml + +analyzer: + exclude: + - "**/*.g.dart" + - "**/*.freezed.dart" From fd64f26c5e3205af0cadf7fb8bf7573e15944b4a Mon Sep 17 00:00:00 2001 From: Doezer Date: Thu, 13 Nov 2025 23:04:06 +0100 Subject: [PATCH 2/6] Update .github/workflows/ci.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68da105c..9b9a27ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - name: Verify formatting run: | # Find all Dart files excluding generated files - FILES=$(find lib test -name "*.dart" ! -name "*.g.dart" ! -name "*.freezed.dart" -type f 2>/dev/null || true) + FILES=$(find lib $([ -d test ] && echo test) -name "*.dart" ! -name "*.g.dart" ! -name "*.freezed.dart" -type f 2>/dev/null || true) if [ -z "$FILES" ]; then echo "No Dart files found to format" exit 0 From ce5e5d7f94ecd421db72a215dbf21ae15bbeaa59 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 22:07:01 +0000 Subject: [PATCH 3/6] Clarify documentation: explain generated file exclusions Co-authored-by: Doezer <11655673+Doezer@users.noreply.github.com> --- CONTRIBUTING.md | 8 +++++--- README.md | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5f452b28..9ce9e5e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ ## Development - Follow Dart/Flutter conventions -- Run `dart format .` to format your code +- Run `dart format .` to format your code (note: generated files like `*.g.dart` are excluded from CI checks) - Run `flutter analyze` before submitting to check for issues - Run `flutter test` if tests are available - Test your changes thoroughly @@ -20,11 +20,13 @@ The project includes automated CI checks that run on all pull requests: 1. **Code Formatting**: Ensures code follows Dart formatting standards - - Run locally: `dart format .` - - CI check excludes generated files (`.g.dart`, `.freezed.dart`) + - Run locally: `dart format .` to format all files + - Note: CI only checks non-generated files (excludes `.g.dart`, `.freezed.dart`) + - Generated files are reformatted automatically by build tools 2. **Static Analysis**: Checks for code issues and potential bugs - Run locally: `flutter analyze` + - Note: CI excludes generated files from analysis (configured in `analysis_options.yaml`) 3. **Tests**: Runs unit and widget tests (when available) - Run locally: `flutter test` diff --git a/README.md b/README.md index a9fff3c1..b74aed11 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ flutter run Before submitting changes, ensure your code passes all quality checks: ```bash -# Format code +# Format code (including generated files) dart format . # Analyze code for issues @@ -92,6 +92,8 @@ flutter analyze flutter test ``` +**Note**: CI checks exclude generated files (`.g.dart`, `.freezed.dart`) from formatting and analysis checks. You can run `dart format .` locally to format everything, but only your hand-written code will be validated in CI. + These checks are automatically run in CI for all pull requests. ### Code Generation From 6d3b68652468b590958dd3f05b89511229003ce2 Mon Sep 17 00:00:00 2001 From: Doezer Date: Fri, 14 Nov 2025 07:37:19 +0100 Subject: [PATCH 4/6] Added clean before pub get + applied suggestion --- .github/workflows/ci.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b9a27ea..f8a8b877 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,18 +35,22 @@ jobs: ${{ runner.os }}-pub- - name: Install dependencies - run: flutter pub get + run: | + flutter clean + flutter pub get - name: Verify formatting run: | # Find all Dart files excluding generated files - FILES=$(find lib $([ -d test ] && echo test) -name "*.dart" ! -name "*.g.dart" ! -name "*.freezed.dart" -type f 2>/dev/null || true) - if [ -z "$FILES" ]; then + find lib $([ -d test ] && echo test) -name "*.dart" ! -name "*.g.dart" ! -name "*.freezed.dart" -type f 2>/dev/null | while IFS= read -r file; do + files_found=true + break + done + if [ "$files_found" != "true" ]; then echo "No Dart files found to format" exit 0 fi - echo "$FILES" | xargs dart format --output=none --set-exit-if-changed - + find lib $([ -d test ] && echo test) -name "*.dart" ! -name "*.g.dart" ! -name "*.freezed.dart" -type f 2>/dev/null -print0 | xargs -0 dart format --output=none --set-exit-if-changed - name: Analyze code run: flutter analyze @@ -75,7 +79,9 @@ jobs: ${{ runner.os }}-pub- - name: Install dependencies - run: flutter pub get + run: | + flutter clean + flutter pub get - name: Run tests run: | @@ -111,5 +117,6 @@ jobs: - name: Verify dependencies run: | + flutter clean flutter pub get flutter pub outdated From 860b8bba49323462659597c1941b49f3d94d4e30 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 20:04:47 +0000 Subject: [PATCH 5/6] Add comprehensive CI sanity checks and documentation Co-authored-by: Doezer <11655673+Doezer@users.noreply.github.com> --- .github/workflows/ci.yml | 122 +++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 22 ++++++- README.md | 19 ++++++ analysis_options.yaml | 5 ++ 4 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..7d2f441d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,122 @@ +name: CI - Sanity Checks + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + analyze: + name: Code Analysis + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Cache Pub dependencies + uses: actions/cache@v4 + with: + path: | + ~/.pub-cache + key: ${{ runner.os }}-pub-v2-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pub-v2- + + - name: Install dependencies + run: | + + flutter pub get + + - name: Verify formatting + run: | + # Find all Dart files excluding generated files + find lib $([ -d test ] && echo test) -name "*.dart" ! -name "*.g.dart" ! -name "*.freezed.dart" -type f 2>/dev/null | while IFS= read -r file; do + files_found=true + break + done + if [ "$files_found" != "true" ]; then + echo "No Dart files found to format" + exit 0 + fi + find lib $([ -d test ] && echo test) -name "*.dart" ! -name "*.g.dart" ! -name "*.freezed.dart" -type f 2>/dev/null -print0 | xargs -0 dart format --output=none --set-exit-if-changed + - name: Analyze code + run: flutter analyze + + test: + name: Unit Tests + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Cache Pub dependencies + uses: actions/cache@v4 + with: + path: | + ~/.pub-cache + key: ${{ runner.os }}-pub-v2-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pub-v2- + + - name: Install dependencies + run: | + flutter clean + flutter pub get + + - name: Run tests + run: | + if [ -d "test" ] && [ "$(find test -name '*_test.dart' | wc -l)" -gt 0 ]; then + flutter test + else + echo "No tests found, skipping test execution" + fi + + dependency-check: + name: Dependency Validation + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Cache Pub dependencies + uses: actions/cache@v4 + with: + path: | + ~/.pub-cache + key: ${{ runner.os }}-pub-v2-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pub-v2- + + - name: Verify dependencies + run: | + flutter clean + flutter pub get + flutter pub outdated diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1742ed9d..9ce9e5e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,9 +10,29 @@ ## Development - Follow Dart/Flutter conventions -- Run `flutter analyze` before submitting +- Run `dart format .` to format your code (note: generated files like `*.g.dart` are excluded from CI checks) +- Run `flutter analyze` before submitting to check for issues +- Run `flutter test` if tests are available - Test your changes thoroughly +### Code Quality Checks + +The project includes automated CI checks that run on all pull requests: + +1. **Code Formatting**: Ensures code follows Dart formatting standards + - Run locally: `dart format .` to format all files + - Note: CI only checks non-generated files (excludes `.g.dart`, `.freezed.dart`) + - Generated files are reformatted automatically by build tools + +2. **Static Analysis**: Checks for code issues and potential bugs + - Run locally: `flutter analyze` + - Note: CI excludes generated files from analysis (configured in `analysis_options.yaml`) + +3. **Tests**: Runs unit and widget tests (when available) + - Run locally: `flutter test` + +All these checks must pass before your changes can be merged. + ## Internationalization (i18n) This project uses `slang` for internationalization with JSON files. diff --git a/README.md b/README.md index e2092494..b74aed11 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,25 @@ flutter run ## Development +### Code Quality + +Before submitting changes, ensure your code passes all quality checks: + +```bash +# Format code (including generated files) +dart format . + +# Analyze code for issues +flutter analyze + +# Run tests (if available) +flutter test +``` + +**Note**: CI checks exclude generated files (`.g.dart`, `.freezed.dart`) from formatting and analysis checks. You can run `dart format .` locally to format everything, but only your hand-written code will be validated in CI. + +These checks are automatically run in CI for all pull requests. + ### Code Generation The project uses code generation for JSON serialization. After modifying model classes, run: diff --git a/analysis_options.yaml b/analysis_options.yaml index f9b30346..2e3c70e5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1 +1,6 @@ include: package:flutter_lints/flutter.yaml + +analyzer: + exclude: + - "**/*.g.dart" + - "**/*.freezed.dart" From 4f5531b67c8e6bdf16fc171f9439c9781295bd2d Mon Sep 17 00:00:00 2001 From: Doezer Date: Sun, 16 Nov 2025 08:45:08 +0100 Subject: [PATCH 6/6] update the CI code analysis to not fail on 'info' and warnings --- .github/workflows/ci.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d2f441d..56a3c512 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,21 @@ jobs: fi find lib $([ -d test ] && echo test) -name "*.dart" ! -name "*.g.dart" ! -name "*.freezed.dart" -type f 2>/dev/null -print0 | xargs -0 dart format --output=none --set-exit-if-changed - name: Analyze code - run: flutter analyze + run: | + # Run flutter analyze and filter out info-level warnings + # Only fail on errors and warnings, not on info messages + flutter analyze 2>&1 | tee analyze_output.txt + # Check if there are any errors (not just info) + if grep -q "error •" analyze_output.txt; then + echo "❌ Analysis failed with errors" + exit 1 + elif grep -q "warning •" analyze_output.txt; then + echo "⚠️ Analysis completed with warnings" + exit 1 + else + echo "✅ Analysis passed (info messages are allowed)" + exit 0 + fi test: name: Unit Tests