Chore: ensure codecov upload gets attempted (#9308)

---------

Co-authored-by: Trenton H <797416+stumpylog@users.noreply.github.com>
This commit is contained in:
shamoon 2025-03-07 09:29:55 -08:00 committed by GitHub
parent 485dad01b7
commit 8db04398c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 111 deletions

View File

@ -1,18 +1,18 @@
codecov: codecov:
require_ci_to_pass: true require_ci_to_pass: true
# https://docs.codecov.com/docs/flags#recommended-automatic-flag-management # https://docs.codecov.com/docs/components
# Require each flag to have 1 upload before notification component_management:
flag_management: individual_components:
individual_flags: - component_id: backend
- name: backend
paths: paths:
- src/ - src/**
- name: frontend - component_id: frontend
paths: paths:
- src-ui/ - src-ui/**
# https://docs.codecov.com/docs/pull-request-comments # https://docs.codecov.com/docs/pull-request-comments
# codecov will only comment if coverage changes # codecov will only comment if coverage changes
comment: comment:
layout: "header, diff, components, flags, files"
require_changes: true require_changes: true
# https://docs.codecov.com/docs/javascript-bundle-analysis # https://docs.codecov.com/docs/javascript-bundle-analysis
require_bundle_changes: true require_bundle_changes: true

View File

@ -162,16 +162,20 @@ jobs:
--frozen \ --frozen \
pytest pytest
- -
name: Upload coverage name: Upload backend test results to Codecov
if: ${{ matrix.python-version == env.DEFAULT_PYTHON_VERSION }} if: always()
uses: actions/upload-artifact@v4 uses: codecov/test-results-action@v1
with: with:
name: backend-coverage-report token: ${{ secrets.CODECOV_TOKEN }}
path: | flags: python-${{ matrix.python-version }}
coverage.xml files: junit.xml
junit.xml -
retention-days: 7 name: Upload backend coverage to Codecov
if-no-files-found: error uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: python-${{ matrix.python-version }}
files: coverage.xml
- -
name: Stop containers name: Stop containers
if: always() if: always()
@ -179,7 +183,7 @@ jobs:
docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml logs docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml logs
docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml down docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml down
install-frontend-depedendencies: install-frontend-dependencies:
name: "Install Frontend Dependencies" name: "Install Frontend Dependencies"
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
needs: needs:
@ -214,7 +218,7 @@ jobs:
name: "Frontend Tests (Node ${{ matrix.node-version }} - ${{ matrix.shard-index }}/${{ matrix.shard-count }})" name: "Frontend Tests (Node ${{ matrix.node-version }} - ${{ matrix.shard-index }}/${{ matrix.shard-count }})"
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
needs: needs:
- install-frontend-depedendencies - install-frontend-dependencies
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -245,111 +249,33 @@ jobs:
run: cd src-ui && npm run lint run: cd src-ui && npm run lint
- -
name: Run Jest unit tests name: Run Jest unit tests
env:
JEST_JUNIT_OUTPUT_FILE: junit-report-${{ matrix.shard-index }}.xml
run: cd src-ui && npm run test -- --max-workers=2 --shard=${{ matrix.shard-index }}/${{ matrix.shard-count }} run: cd src-ui && npm run test -- --max-workers=2 --shard=${{ matrix.shard-index }}/${{ matrix.shard-count }}
-
name: Upload Jest coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: jest-coverage-report-${{ matrix.shard-index }}
path: |
src-ui/coverage/coverage-final.json
src-ui/coverage/lcov.info
src-ui/coverage/clover.xml
retention-days: 7
if-no-files-found: error
- -
name: Run Playwright e2e tests name: Run Playwright e2e tests
run: cd src-ui && npx playwright test --shard ${{ matrix.shard-index }}/${{ matrix.shard-count }} run: cd src-ui && npx playwright test --shard ${{ matrix.shard-index }}/${{ matrix.shard-count }}
- -
name: Upload Playwright test results name: Upload frontend test results to Codecov
uses: codecov/test-results-action@v1
if: always() if: always()
uses: actions/upload-artifact@v4
with: with:
name: playwright-report-${{ matrix.shard-index }} token: ${{ secrets.CODECOV_TOKEN }}
path: src-ui/playwright-report flags: node-${{ matrix.node-version }}
retention-days: 7 directory: src-ui/
-
name: Upload frontend test results
if: always()
uses: actions/upload-artifact@v4
with:
name: junit-report-${{ matrix.shard-index }}
path: src-ui/junit-report-${{ matrix.shard-index }}.xml
retention-days: 7
tests-coverage-upload:
name: "Upload to Codecov"
runs-on: ubuntu-24.04
needs:
- tests-backend
- tests-frontend
steps:
-
uses: actions/checkout@v4
-
name: Download frontend jest coverage
uses: actions/download-artifact@v4
with:
path: src-ui/coverage/
pattern: jest-coverage-report-*
-
name: Download frontend playwright coverage
uses: actions/download-artifact@v4
with:
path: src-ui/coverage/
pattern: playwright-report-*
merge-multiple: true
-
name: Download frontend test results
uses: actions/download-artifact@v4
with:
path: src-ui/junit/
pattern: junit-report-*
merge-multiple: true
- -
name: Upload frontend coverage to Codecov name: Upload frontend coverage to Codecov
uses: codecov/codecov-action@v5 uses: codecov/codecov-action@v5
with: with:
# not required for public repos, but intermittently fails otherwise
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
flags: frontend flags: node-${{ matrix.node-version }}
directory: src-ui/coverage/ directory: src-ui/coverage/
# dont include backend coverage files here
files: '!coverage.xml' frontend-bundle-analysis:
- name: "Frontend Bundle Analysis"
name: Upload frontend test results to Codecov runs-on: ubuntu-24.04
if: ${{ !cancelled() }} needs:
uses: codecov/test-results-action@v1 - tests-frontend
with: steps:
token: ${{ secrets.CODECOV_TOKEN }} - uses: actions/checkout@v4
flags: frontend
directory: src-ui/junit/
-
name: Download backend coverage
uses: actions/download-artifact@v4
with:
name: backend-coverage-report
path: src/
-
name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
# not required for public repos, but intermittently fails otherwise
token: ${{ secrets.CODECOV_TOKEN }}
# future expansion
flags: backend
directory: src/
-
name: Upload backend test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: backend
directory: src/
- -
name: Use Node.js 20 name: Use Node.js 20
uses: actions/setup-node@v4 uses: actions/setup-node@v4