-
Notifications
You must be signed in to change notification settings - Fork 24
Fix: Adjust Codecov thresholds and paths for backend coverage; improve frontend test handling #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c991260
3947e7b
0520cf5
011b530
1523c85
7ebcd0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # DISABLED: Frontend bundle analysis - no frontend tests currently | ||
| # This workflow is disabled because we don't have frontend tests | ||
| # and don't plan to implement them. Can be re-enabled if needed in the future. | ||
|
|
||
| # name: Bundle Analysis | ||
|
|
||
| # on: | ||
| # pull_request: | ||
| # paths: | ||
| # - 'frontend/**' | ||
| # branches: [ main, master ] | ||
| # push: | ||
| # paths: | ||
| # - 'frontend/**' | ||
| # branches: [ main, master ] | ||
|
|
||
| # jobs: | ||
| # bundle-analysis: | ||
| # runs-on: ubuntu-latest | ||
| # | ||
| # steps: | ||
| # - uses: actions/checkout@v4 | ||
| # with: | ||
| # fetch-depth: 0 | ||
| # | ||
| # - name: Set up Node.js | ||
| # uses: actions/setup-node@v4 | ||
| # with: | ||
| # node-version: '18' | ||
| # cache: 'npm' | ||
| # cache-dependency-path: frontend/package-lock.json | ||
| # | ||
| # - name: Install Dependencies | ||
| # run: | | ||
| # cd frontend | ||
| # npm ci | ||
| # | ||
| # - name: Build for Bundle Analysis | ||
| # run: | | ||
| # cd frontend | ||
| # # Create a production build for analysis | ||
| # if npm run build --dry-run 2>/dev/null; then | ||
| # npm run build | ||
| # else | ||
| # # Use Expo's build process | ||
| # npx expo export:web | ||
| # fi | ||
| # | ||
| # - name: Analyze Bundle Size | ||
| # run: | | ||
| # cd frontend | ||
| # # Install bundle analyzer | ||
| # npm install --no-save webpack-bundle-analyzer | ||
| # | ||
| # # Generate bundle stats (adjust path based on your build output) | ||
| # if [ -d "web-build" ]; then | ||
| # # Expo web build | ||
| # npx webpack-bundle-analyzer web-build/static/js/*.js --report --mode static --report-filename bundle-report.html | ||
| # elif [ -d "dist" ]; then | ||
| # # Standard React build | ||
| # npx webpack-bundle-analyzer dist/static/js/*.js --report --mode static --report-filename bundle-report.html | ||
| # else | ||
| # echo "No build output found for bundle analysis" | ||
| # fi | ||
| # | ||
| # - name: Upload Bundle Analysis to Codecov | ||
| # uses: codecov/codecov-action@v5 | ||
| # if: github.actor != 'dependabot[bot]' | ||
| # with: | ||
| # token: ${{ secrets.CODECOV_TOKEN }} | ||
| # flags: bundle,frontend,javascript | ||
| # name: "Bundle Analysis" | ||
| # fail_ci_if_error: false | ||
| # | ||
| # - name: Bundle Analysis Skipped | ||
| # if: github.actor == 'dependabot[bot]' | ||
| # run: echo "📦 Bundle analysis skipped for Dependabot PR" |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||||
| name: Run Tests & Analytics | ||||||||||||||
| name: Run Backend Tests & Analytics | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| pull_request: | ||||||||||||||
|
|
@@ -28,85 +28,47 @@ jobs: | |||||||||||||
|
|
||||||||||||||
| - name: Run Backend Tests with Coverage | ||||||||||||||
| run: | | ||||||||||||||
| cd $GITHUB_WORKSPACE | ||||||||||||||
| export PYTHONPATH=$GITHUB_WORKSPACE:$GITHUB_WORKSPACE/backend | ||||||||||||||
| # Generate coverage with detailed flags | ||||||||||||||
| cd backend | ||||||||||||||
| export PYTHONPATH=$GITHUB_WORKSPACE/backend:$GITHUB_WORKSPACE | ||||||||||||||
| # Generate coverage with proper paths | ||||||||||||||
| pytest \ | ||||||||||||||
| --cov=./backend \ | ||||||||||||||
| --cov=app \ | ||||||||||||||
| --cov-report=xml:coverage.xml \ | ||||||||||||||
| --cov-report=json:coverage.json \ | ||||||||||||||
| --cov-report=lcov:coverage.lcov \ | ||||||||||||||
| --cov-report=term-missing \ | ||||||||||||||
| --junit-xml=test-results.xml \ | ||||||||||||||
| --tb=short \ | ||||||||||||||
| -v \ | ||||||||||||||
| backend/tests/ | ||||||||||||||
| tests/ | ||||||||||||||
|
|
||||||||||||||
| - name: List coverage files for debugging | ||||||||||||||
| run: | | ||||||||||||||
| echo "Coverage files generated:" | ||||||||||||||
| find . -name "coverage.*" -type f | head -10 | ||||||||||||||
| ls -la backend/ | grep -E "(coverage|test-results)" | ||||||||||||||
|
|
||||||||||||||
| - name: Run Test Analytics Upload | ||||||||||||||
| uses: codecov/test-results-action@v1 | ||||||||||||||
| if: github.actor != 'dependabot[bot]' | ||||||||||||||
| with: | ||||||||||||||
| token: ${{ secrets.CODECOV_TOKEN }} | ||||||||||||||
| files: test-results.xml | ||||||||||||||
| files: backend/test-results.xml | ||||||||||||||
| flags: backend,test-analytics | ||||||||||||||
| name: "Backend Test Results" | ||||||||||||||
|
|
||||||||||||||
| - name: Upload Coverage to Codecov with Flags | ||||||||||||||
| uses: codecov/codecov-action@v5 | ||||||||||||||
| uses: codecov/codecov-action@v4 | ||||||||||||||
| if: github.actor != 'dependabot[bot]' | ||||||||||||||
| with: | ||||||||||||||
| token: ${{ secrets.CODECOV_TOKEN }} | ||||||||||||||
| files: ./coverage.xml,./coverage.json,./coverage.lcov | ||||||||||||||
| file: backend/coverage.xml | ||||||||||||||
| flags: backend,python,api | ||||||||||||||
| name: "Backend Coverage" | ||||||||||||||
| name: backend-coverage | ||||||||||||||
| fail_ci_if_error: false | ||||||||||||||
| verbose: true | ||||||||||||||
| working-directory: ./ | ||||||||||||||
| override_branch: ${{ github.head_ref }} | ||||||||||||||
| override_commit: ${{ github.event.pull_request.head.sha }} | ||||||||||||||
|
Comment on lines
+68
to
+70
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
- working-directory: ./
+ directory: backend📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| - name: Codecov upload skipped for Dependabot | ||||||||||||||
| if: github.actor == 'dependabot[bot]' | ||||||||||||||
| run: echo "📊 Codecov upload skipped for Dependabot PR - tests still run and pass!" | ||||||||||||||
|
|
||||||||||||||
| test-frontend: | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
|
|
||||||||||||||
| steps: | ||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||
| with: | ||||||||||||||
| fetch-depth: 0 | ||||||||||||||
|
|
||||||||||||||
| - name: Set up Node.js | ||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||
| with: | ||||||||||||||
| node-version: '18' | ||||||||||||||
| cache: 'npm' | ||||||||||||||
| cache-dependency-path: frontend/package-lock.json | ||||||||||||||
|
|
||||||||||||||
| - name: Install Frontend Dependencies | ||||||||||||||
| run: | | ||||||||||||||
| cd frontend | ||||||||||||||
| npm ci | ||||||||||||||
|
|
||||||||||||||
| - name: Run Frontend Tests (if available) | ||||||||||||||
| run: | | ||||||||||||||
| cd frontend | ||||||||||||||
| # Check if test script exists | ||||||||||||||
| if npm run test --dry-run 2>/dev/null; then | ||||||||||||||
| npm run test -- --coverage --watchAll=false --testResultsProcessor=jest-junit | ||||||||||||||
| else | ||||||||||||||
| echo "No frontend tests configured yet" | ||||||||||||||
| # Create a placeholder test result for analytics | ||||||||||||||
| mkdir -p test-results | ||||||||||||||
| echo '<?xml version="1.0"?><testsuites><testsuite name="frontend-placeholder" tests="1" failures="0" errors="0"><testcase name="placeholder" /></testsuite></testsuites>' > test-results/frontend-results.xml | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| - name: Upload Frontend Test Analytics | ||||||||||||||
| uses: codecov/test-results-action@v1 | ||||||||||||||
| if: github.actor != 'dependabot[bot]' | ||||||||||||||
| with: | ||||||||||||||
| token: ${{ secrets.CODECOV_TOKEN }} | ||||||||||||||
| files: frontend/test-results/frontend-results.xml | ||||||||||||||
| flags: frontend,javascript,react-native | ||||||||||||||
| name: "Frontend Test Results" | ||||||||||||||
|
|
||||||||||||||
| - name: Frontend Analytics Upload Skipped | ||||||||||||||
| if: github.actor == 'dependabot[bot]' | ||||||||||||||
| run: echo "📊 Frontend test analytics skipped for Dependabot PR" | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Incorrect input name for Codecov action v4
codecov/codecov-action@v4acceptsfiles:(plural), notfile:.Using the wrong key causes the coverage upload to be skipped.
📝 Committable suggestion
🤖 Prompt for AI Agents