Skip to content

fix(memories): show weekday in page header #23

fix(memories): show weekday in page header

fix(memories): show weekday in page header #23

Workflow file for this run

name: CI - Tests
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:
jobs:
test:
name: Run Flutter Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'oracle'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.32.x'
cache: true
- name: Cache Flutter dependencies
uses: actions/cache@v4
with:
path: |
~/.pub-cache
${{ runner.workspace }}/.pub-cache
key: flutter-${{ runner.os }}-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
flutter-${{ runner.os }}-
- name: Create environment file
run: |
cp .env.example .env || echo "No .env.example found, creating basic .env"
if [ ! -f .env ]; then
echo "# Test environment" > .env
echo "API_BASE_URL=https://api.test.example.com" >> .env
echo "SEQ_API_KEY=test-key" >> .env
fi
- name: Install dependencies
run: flutter pub get
- name: Verify Flutter installation
run: flutter doctor -v
- name: Analyze code (non-blocking)
id: analyze
continue-on-error: true
run: flutter analyze --fatal-infos --fatal-warnings
- name: Run tests with coverage
run: flutter test --coverage --reporter expanded
- name: Check code formatting (non-blocking)
id: format-check
continue-on-error: true
run: |
echo "πŸ” Checking code formatting..."
if ! dart format --set-exit-if-changed --page-width=120 . 2>&1 | tee format-output.log; then
echo "⚠️ Code formatting issues found!"
echo "## πŸ“‹ Code Formatting Report" >> $GITHUB_STEP_SUMMARY
echo "The following files need formatting:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
grep "Formatted" format-output.log >> $GITHUB_STEP_SUMMARY || echo "See job logs for details" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "To fix: run \`dart format --page-width=120 .\` locally and commit the changes" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo "βœ… All files are properly formatted" >> $GITHUB_STEP_SUMMARY
fi
- name: Report code quality status
if: always()
run: |
echo "## πŸ” Code Quality Report" >> $GITHUB_STEP_SUMMARY
# Analysis status
if [ "${{ steps.analyze.outcome }}" = "success" ]; then
echo "- βœ… **Static Analysis**: Passed" >> $GITHUB_STEP_SUMMARY
else
echo "- ⚠️ **Static Analysis**: Issues found (check logs above)" >> $GITHUB_STEP_SUMMARY
fi
# Format status
if [ "${{ steps.format-check.outcome }}" = "success" ]; then
echo "- βœ… **Code Formatting**: All files properly formatted" >> $GITHUB_STEP_SUMMARY
else
echo "- ⚠️ **Code Formatting**: Files need formatting (see report above)" >> $GITHUB_STEP_SUMMARY
fi
# Overall status
if [ "${{ steps.analyze.outcome }}" = "success" ] && [ "${{ steps.format-check.outcome }}" = "success" ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "πŸŽ‰ **All code quality checks passed!**" >> $GITHUB_STEP_SUMMARY
else
echo "" >> $GITHUB_STEP_SUMMARY
echo "πŸ“ **Please review the issues above and fix them in your next commit.**" >> $GITHUB_STEP_SUMMARY
echo "πŸ’‘ These issues won't block the CI, but should be addressed for code quality." >> $GITHUB_STEP_SUMMARY
fi
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: test/
retention-days: 30
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
retention-days: 30
- name: Generate coverage report summary
if: always()
run: |
if [ -f coverage/lcov.info ]; then
echo "## Test Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "Coverage data has been generated and uploaded as an artifact." >> $GITHUB_STEP_SUMMARY
echo "### Coverage Files Generated:" >> $GITHUB_STEP_SUMMARY
echo "- lcov.info: Line coverage data" >> $GITHUB_STEP_SUMMARY
echo "- HTML report available in coverage/ directory" >> $GITHUB_STEP_SUMMARY
else
echo "## Test Coverage" >> $GITHUB_STEP_SUMMARY
echo "No coverage data was generated." >> $GITHUB_STEP_SUMMARY
fi
build-test:
name: Build Test (Android)
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'oracle'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.32.x'
cache: true
- name: Create environment file
run: |
cp .env.example .env || echo "# Test build environment" > .env
- name: Install dependencies
run: flutter pub get
- name: Build Android APK (debug)
run: flutter build apk --debug
- name: Build Android App Bundle (debug)
run: flutter build appbundle --debug
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'oracle'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.32.x'
cache: true
- name: Create environment file
run: |
cp .env.example .env || echo "# Integration test environment" > .env
- name: Install dependencies
run: flutter pub get
- name: Run integration tests
run: |
if [ -d "integration_test" ]; then
flutter test integration_test/
else
echo "No integration tests found, skipping..."
fi
summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test, build-test]
if: always()
steps:
- name: Test Summary
run: |
echo "## CI Test Results" >> $GITHUB_STEP_SUMMARY
echo "- **Unit Tests**: ${{ needs.test.result }}" >> $GITHUB_STEP_SUMMARY
echo "- **Build Test**: ${{ needs.build-test.result }}" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.test.result }}" = "success" ] && [ "${{ needs.build-test.result }}" = "success" ]; then
echo "βœ… All tests passed successfully!" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Some tests failed. Please check the job details above." >> $GITHUB_STEP_SUMMARY
fi