File tree Expand file tree Collapse file tree 4 files changed +96
-0
lines changed Expand file tree Collapse file tree 4 files changed +96
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Flutter Tests & Coverage
2
+
3
+ on :
4
+ push :
5
+ branches : [main, develop]
6
+ pull_request :
7
+ branches : [main, develop]
8
+
9
+ jobs :
10
+ test :
11
+ runs-on : ubuntu-latest
12
+
13
+ steps :
14
+ - name : Checkout code
15
+ uses : actions/checkout@v4
16
+
17
+ - name : Setup Flutter
18
+ uses : subosito/flutter-action@v2
19
+ with :
20
+ flutter-version : " 3.29.3"
21
+ architecture : " x64"
22
+
23
+ - name : Install dependencies
24
+ run : flutter pub get
25
+
26
+ - name : Verify formatting
27
+ run : dart format --set-exit-if-changed .
28
+
29
+ - name : Analyze project source
30
+ run : flutter analyze
31
+
32
+ - name : Run tests with coverage
33
+ run : flutter test --coverage
Original file line number Diff line number Diff line change
1
+ name : Validate merge source
2
+ on :
3
+ pull_request :
4
+ branches : [main]
5
+
6
+ jobs :
7
+ validate :
8
+ runs-on : ubuntu-latest
9
+ steps :
10
+ - name : Check source branch
11
+ run : |
12
+ if [ "${{ github.head_ref }}" != "develop" ]; then
13
+ echo "Error: Only develop branch can merge to main"
14
+ exit 1
15
+ fi
Original file line number Diff line number Diff line change @@ -31,13 +31,31 @@ The setup script will:
31
31
- Initialize Husky for git hooks (if present)
32
32
- Add ` .fvm/ ` to ` .gitignore ` if needed
33
33
34
+ ## Testing
35
+
36
+ ### Local Testing
37
+
38
+ Run tests with coverage locally:
39
+
40
+ ``` bash
41
+ # Using the provided script (recommended)
42
+ ./scripts/test_with_coverage.sh
43
+
44
+ # Or manually
45
+ fvm flutter test --coverage
46
+ lcov --summary coverage/lcov.info
47
+ genhtml coverage/lcov.info -o coverage/html
48
+ open coverage/html/index.html
49
+ ```
50
+
34
51
## Contributing
35
52
36
53
Contributions are welcome! Please:
37
54
38
55
- Follow the existing code style and patterns
39
56
- Write clear commit messages (Commitlint and Husky are enabled)
40
57
- Add or update tests for new features or bug fixes
58
+ - Ensure all tests pass before submitting a pull request
41
59
- Open a pull request with a clear description
42
60
43
61
## License
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Flutter Policy Engine - Test with Coverage Script
4
+ # This script runs all tests and generates coverage reports
5
+
6
+ set -e # Exit on any error
7
+
8
+ echo " 🧪 Running Flutter tests with coverage..."
9
+
10
+ # Run tests with coverage
11
+ fvm flutter test --coverage
12
+
13
+ echo " 📊 Generating coverage summary..."
14
+ lcov --summary coverage/lcov.info
15
+
16
+ echo " 🌐 Generating HTML coverage report..."
17
+ genhtml coverage/lcov.info -o coverage/html
18
+
19
+ echo " ✅ Coverage report generated successfully!"
20
+ echo " 📁 HTML report available at: coverage/html/index.html"
21
+
22
+ # Open the coverage report in browser (macOS)
23
+ if [[ " $OSTYPE " == " darwin" * ]]; then
24
+ echo " 🔗 Opening coverage report in browser..."
25
+ open coverage/html/index.html
26
+ else
27
+ echo " 📖 To view the coverage report, open: coverage/html/index.html"
28
+ fi
29
+
30
+ echo " 🎉 Test coverage process completed!"
You can’t perform that action at this time.
0 commit comments