Add comprehensive CI sanity checks and documentation

Co-authored-by: Doezer <11655673+Doezer@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-13 22:57:32 +01:00
committed by Doezer
co-authored by Doezer
parent 95a15a07cc
commit aeeacfc84b
4 changed files with 156 additions and 1 deletions
+115
View File
@@ -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
+19 -1
View File
@@ -10,9 +10,27 @@
## Development ## Development
- Follow Dart/Flutter conventions - 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 - 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) ## Internationalization (i18n)
This project uses `slang` for internationalization with JSON files. This project uses `slang` for internationalization with JSON files.
+17
View File
@@ -77,6 +77,23 @@ flutter run
## Development ## 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 ### Code Generation
The project uses code generation for JSON serialization. After modifying model classes, run: The project uses code generation for JSON serialization. After modifying model classes, run:
+5
View File
@@ -1 +1,6 @@
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"