Skip to content

Commit b34ad64

Browse files
Copilot0xrinegade
andcommitted
Add comprehensive GitHub Actions workflows for Flutter SDK testing
Co-authored-by: 0xrinegade <[email protected]>
1 parent e7d359a commit b34ad64

File tree

5 files changed

+634
-2
lines changed

5 files changed

+634
-2
lines changed

.github/workflows/ci.yml

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
# JavaScript/TypeScript tests for main SDK
11+
js-tests:
12+
name: JavaScript SDK Tests
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '18'
23+
cache: 'npm'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Run linter
29+
run: npm run lint
30+
31+
- name: Build project
32+
run: npm run build
33+
34+
- name: Run tests
35+
run: npm test -- --passWithNoTests
36+
37+
# Flutter SDK tests
38+
flutter-tests:
39+
name: Flutter SDK Tests
40+
runs-on: ubuntu-latest
41+
if: contains(github.event.head_commit.modified, 'flutter_sdk/') || contains(github.event.head_commit.added, 'flutter_sdk/') || github.event_name == 'pull_request'
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
47+
- name: Setup Flutter
48+
uses: subosito/flutter-action@v2
49+
with:
50+
flutter-version: '3.24.0'
51+
channel: 'stable'
52+
53+
- name: Get Flutter dependencies
54+
working-directory: flutter_sdk
55+
run: flutter pub get
56+
57+
- name: Run Flutter analyzer
58+
working-directory: flutter_sdk
59+
run: flutter analyze --fatal-infos
60+
61+
- name: Run Flutter tests with coverage
62+
working-directory: flutter_sdk
63+
run: flutter test --coverage --reporter expanded
64+
65+
- name: Validate test coverage
66+
working-directory: flutter_sdk
67+
run: |
68+
chmod +x scripts/validate_tests.sh
69+
./scripts/validate_tests.sh
70+
71+
- name: Upload Flutter coverage
72+
uses: codecov/codecov-action@v4
73+
with:
74+
file: flutter_sdk/coverage/lcov.info
75+
flags: flutter-sdk
76+
name: flutter-sdk-coverage
77+
fail_ci_if_error: false
78+
79+
# Security and bug fix validation
80+
security-validation:
81+
name: Security & Bug Fix Validation
82+
runs-on: ubuntu-latest
83+
if: contains(github.event.head_commit.modified, 'flutter_sdk/') || contains(github.event.head_commit.added, 'flutter_sdk/') || github.event_name == 'pull_request'
84+
85+
steps:
86+
- name: Checkout repository
87+
uses: actions/checkout@v4
88+
89+
- name: Setup Flutter
90+
uses: subosito/flutter-action@v2
91+
with:
92+
flutter-version: '3.24.0'
93+
channel: 'stable'
94+
95+
- name: Get Flutter dependencies
96+
working-directory: flutter_sdk
97+
run: flutter pub get
98+
99+
- name: Run security tests
100+
working-directory: flutter_sdk
101+
run: |
102+
echo "🔒 Running security enhancement tests..."
103+
flutter test test/security_test.dart --reporter expanded
104+
105+
- name: Run critical bug fix tests
106+
working-directory: flutter_sdk
107+
run: |
108+
echo "🐛 Running critical bug fix validation..."
109+
flutter test test/bug_fixes_test.dart --reporter expanded
110+
111+
- name: Validate security compliance
112+
working-directory: flutter_sdk
113+
run: |
114+
echo "✅ Validating security compliance..."
115+
echo "Checking for OWASP Mobile Security compliance..."
116+
117+
# Verify security test coverage
118+
SECURITY_TESTS=$(grep -r "test(" test/security_test.dart | wc -l)
119+
BUG_FIX_TESTS=$(grep -r "test(" test/bug_fixes_test.dart | wc -l)
120+
121+
echo "Security tests: $SECURITY_TESTS"
122+
echo "Bug fix tests: $BUG_FIX_TESTS"
123+
124+
if [ $SECURITY_TESTS -lt 10 ]; then
125+
echo "❌ Insufficient security test coverage"
126+
exit 1
127+
fi
128+
129+
if [ $BUG_FIX_TESTS -lt 5 ]; then
130+
echo "❌ Insufficient bug fix test coverage"
131+
exit 1
132+
fi
133+
134+
echo "✅ Security validation passed!"
135+
136+
# E2E Integration tests
137+
integration-tests:
138+
name: E2E Integration Tests
139+
runs-on: ubuntu-latest
140+
needs: [flutter-tests]
141+
if: contains(github.event.head_commit.modified, 'flutter_sdk/') || contains(github.event.head_commit.added, 'flutter_sdk/') || github.event_name == 'pull_request'
142+
143+
steps:
144+
- name: Checkout repository
145+
uses: actions/checkout@v4
146+
147+
- name: Setup Flutter
148+
uses: subosito/flutter-action@v2
149+
with:
150+
flutter-version: '3.24.0'
151+
channel: 'stable'
152+
153+
- name: Get Flutter dependencies
154+
working-directory: flutter_sdk
155+
run: flutter pub get
156+
157+
- name: Run integration tests
158+
working-directory: flutter_sdk
159+
run: |
160+
echo "🔄 Running E2E integration tests..."
161+
flutter test test/integration_test.dart --reporter expanded
162+
163+
- name: Run widget tests
164+
working-directory: flutter_sdk
165+
run: |
166+
echo "🎨 Running widget tests..."
167+
flutter test test/widget_test.dart --reporter expanded
168+
169+
# Final validation
170+
validation-summary:
171+
name: Test Summary & Validation
172+
runs-on: ubuntu-latest
173+
needs: [js-tests, flutter-tests, security-validation, integration-tests]
174+
if: always()
175+
176+
steps:
177+
- name: Checkout repository
178+
uses: actions/checkout@v4
179+
180+
- name: Test Results Summary
181+
run: |
182+
echo "📊 CI/CD Test Results Summary"
183+
echo "=================================="
184+
185+
# Check job results
186+
if [ "${{ needs.js-tests.result }}" = "success" ]; then
187+
echo "✅ JavaScript SDK Tests: PASSED"
188+
else
189+
echo "❌ JavaScript SDK Tests: FAILED"
190+
fi
191+
192+
if [ "${{ needs.flutter-tests.result }}" = "success" ] || [ "${{ needs.flutter-tests.result }}" = "skipped" ]; then
193+
echo "✅ Flutter SDK Tests: PASSED"
194+
else
195+
echo "❌ Flutter SDK Tests: FAILED"
196+
fi
197+
198+
if [ "${{ needs.security-validation.result }}" = "success" ] || [ "${{ needs.security-validation.result }}" = "skipped" ]; then
199+
echo "✅ Security Validation: PASSED"
200+
else
201+
echo "❌ Security Validation: FAILED"
202+
fi
203+
204+
if [ "${{ needs.integration-tests.result }}" = "success" ] || [ "${{ needs.integration-tests.result }}" = "skipped" ]; then
205+
echo "✅ Integration Tests: PASSED"
206+
else
207+
echo "❌ Integration Tests: FAILED"
208+
fi
209+
210+
echo ""
211+
echo "🎉 CI/CD Pipeline completed!"
212+
213+
# Fail if any critical jobs failed
214+
if [ "${{ needs.js-tests.result }}" = "failure" ] || [ "${{ needs.flutter-tests.result }}" = "failure" ] || [ "${{ needs.security-validation.result }}" = "failure" ] || [ "${{ needs.integration-tests.result }}" = "failure" ]; then
215+
echo "❌ Some tests failed - please review the logs above"
216+
exit 1
217+
fi
218+
219+
echo "✅ All tests passed successfully!"
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Flutter SDK Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
paths:
7+
- 'flutter_sdk/**'
8+
- '.github/workflows/flutter-tests.yml'
9+
pull_request:
10+
branches: [ main, develop ]
11+
paths:
12+
- 'flutter_sdk/**'
13+
- '.github/workflows/flutter-tests.yml'
14+
15+
jobs:
16+
test:
17+
name: Run Flutter Tests
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Flutter
25+
uses: subosito/flutter-action@v2
26+
with:
27+
flutter-version: '3.24.0'
28+
channel: 'stable'
29+
30+
- name: Verify Flutter installation
31+
run: flutter --version
32+
33+
- name: Get Flutter dependencies
34+
working-directory: flutter_sdk
35+
run: flutter pub get
36+
37+
- name: Verify dependencies
38+
working-directory: flutter_sdk
39+
run: flutter pub deps
40+
41+
- name: Run Flutter analyzer
42+
working-directory: flutter_sdk
43+
run: flutter analyze --fatal-infos
44+
45+
- name: Run all Flutter tests
46+
working-directory: flutter_sdk
47+
run: flutter test --coverage --reporter expanded
48+
49+
- name: Upload coverage reports
50+
uses: codecov/codecov-action@v4
51+
with:
52+
file: flutter_sdk/coverage/lcov.info
53+
flags: flutter-sdk
54+
name: flutter-sdk-coverage
55+
fail_ci_if_error: false
56+
57+
security-tests:
58+
name: Security & Bug Fix Tests
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
65+
- name: Setup Flutter
66+
uses: subosito/flutter-action@v2
67+
with:
68+
flutter-version: '3.24.0'
69+
channel: 'stable'
70+
71+
- name: Get Flutter dependencies
72+
working-directory: flutter_sdk
73+
run: flutter pub get
74+
75+
- name: Run security tests
76+
working-directory: flutter_sdk
77+
run: flutter test test/security_test.dart --reporter expanded
78+
79+
- name: Run bug fix tests
80+
working-directory: flutter_sdk
81+
run: flutter test test/bug_fixes_test.dart --reporter expanded
82+
83+
- name: Run integration tests
84+
working-directory: flutter_sdk
85+
run: flutter test test/integration_test.dart --reporter expanded
86+
87+
widget-tests:
88+
name: Widget Tests
89+
runs-on: ubuntu-latest
90+
91+
steps:
92+
- name: Checkout repository
93+
uses: actions/checkout@v4
94+
95+
- name: Setup Flutter
96+
uses: subosito/flutter-action@v2
97+
with:
98+
flutter-version: '3.24.0'
99+
channel: 'stable'
100+
101+
- name: Get Flutter dependencies
102+
working-directory: flutter_sdk
103+
run: flutter pub get
104+
105+
- name: Run widget tests
106+
working-directory: flutter_sdk
107+
run: flutter test test/widget_test.dart --reporter expanded
108+
109+
comprehensive-validation:
110+
name: Comprehensive Test Validation
111+
runs-on: ubuntu-latest
112+
needs: [test, security-tests, widget-tests]
113+
114+
steps:
115+
- name: Checkout repository
116+
uses: actions/checkout@v4
117+
118+
- name: Setup Flutter
119+
uses: subosito/flutter-action@v2
120+
with:
121+
flutter-version: '3.24.0'
122+
channel: 'stable'
123+
124+
- name: Get Flutter dependencies
125+
working-directory: flutter_sdk
126+
run: flutter pub get
127+
128+
- name: Validate test completeness
129+
working-directory: flutter_sdk
130+
run: |
131+
echo "Running comprehensive test validation..."
132+
133+
# Count total tests
134+
TOTAL_TESTS=$(flutter test --dry-run 2>/dev/null | grep -c "loading.*test" || echo "0")
135+
echo "Total tests found: $TOTAL_TESTS"
136+
137+
# Verify critical test files exist
138+
echo "Verifying critical test files..."
139+
test -f test/svm_pay_test.dart && echo "✓ Core SDK tests found"
140+
test -f test/security_test.dart && echo "✓ Security tests found"
141+
test -f test/bug_fixes_test.dart && echo "✓ Bug fix tests found"
142+
test -f test/integration_test.dart && echo "✓ Integration tests found"
143+
test -f test/widget_test.dart && echo "✓ Widget tests found"
144+
145+
# Run final comprehensive test suite
146+
echo "Running final comprehensive test suite..."
147+
flutter test --reporter expanded --coverage
148+
149+
echo "✅ All Flutter SDK tests completed successfully!"

0 commit comments

Comments
 (0)