Files
factory-droid[bot] 13e7c0d0b0 feat: Add comprehensive integration tests with real Sintel magnet link for GitHub Actions
Integration Testing Infrastructure:
- Add real magnet link test using Sintel (Creative Commons licensed film)
- Create comprehensive torrent integration tests that work in GitHub Actions
- Add CI environment detection and validation tests
- Enable integration test execution in GitHub Actions workflow

Sintel Integration Test (test/integration/torrent_integration_test.dart):
- Uses official Sintel magnet link from Blender Foundation
- Tests real magnet link parsing and validation
- Covers all torrent operations: add, pause, resume, remove
- Tests file priority management and video file detection
- Includes performance tests and timeout handling
- Validates torrent hash extraction and state management
- Works with mock platform channel (no real downloads)

CI Environment Test (test/integration/ci_environment_test.dart):
- Detects GitHub Actions and CI environments
- Validates Dart/Flutter environment in CI
- Tests network connectivity gracefully
- Verifies test infrastructure availability

GitHub Actions Integration:
- Add integration test step to test.yml workflow
- Set CI and GITHUB_ACTIONS environment variables
- Use --reporter=expanded for detailed test output
- Run after unit tests but before coverage upload

Key Features:
- Mock platform channel prevents real downloads
- Works on any platform (Linux/macOS/Windows)
- Fast execution suitable for CI pipelines
- Uses only open source, legally free content
- Comprehensive error handling and timeouts
- Environment-aware test configuration

Documentation:
- Detailed README for integration tests
- Troubleshooting guide for CI issues
- Explanation of mock vs real testing approach
- Security and licensing considerations

This enables thorough testing of torrent functionality
in GitHub Actions while respecting copyright and
maintaining fast CI execution times.
2025-10-03 07:29:28 +00:00

148 lines
3.4 KiB
YAML

name: Test and Analyze
on:
push:
branches:
- main
- dev
- 'feature/**'
- 'torrent-engine-downloads'
pull_request:
branches:
- main
- dev
jobs:
flutter-analyze:
name: Flutter Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.6'
channel: 'stable'
cache: true
- name: Get dependencies
run: flutter pub get
- name: Run code generation
run: |
dart run build_runner build --delete-conflicting-outputs || true
- name: Run Flutter Analyze
run: flutter analyze --no-fatal-infos
- name: Check formatting
run: dart format --set-exit-if-changed .
flutter-test:
name: Flutter Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.35.5'
channel: 'stable'
cache: true
- name: Get dependencies
run: flutter pub get
- name: Run tests
run: flutter test --coverage
- name: Run Integration tests
run: flutter test test/integration/ --reporter=expanded
env:
# Mark that we're running in CI
CI: true
GITHUB_ACTIONS: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
fail_ci_if_error: false
if: always()
android-lint:
name: Android Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.35.5'
channel: 'stable'
cache: true
- name: Get dependencies
run: flutter pub get
- name: Run Android Lint
run: |
cd android
chmod +x gradlew
./gradlew lint
- name: Upload lint reports
uses: actions/upload-artifact@v4
with:
name: android-lint-reports
path: |
android/app/build/reports/lint-*.html
android/torrentengine/build/reports/lint-*.html
retention-days: 7
if: always()
build-debug:
name: Build Debug APK
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/dev'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.35.5'
channel: 'stable'
cache: true
- name: Get dependencies
run: flutter pub get
- name: Build Debug APK
run: flutter build apk --debug
- name: Upload Debug APK
uses: actions/upload-artifact@v4
with:
name: apk-debug
path: build/app/outputs/flutter-apk/app-debug.apk
retention-days: 7