From 50cec420ef736f43cb056589fff0cc160f169eff Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Tue, 4 Mar 2025 11:43:41 +0100 Subject: [PATCH] Upload test results to codecov (#138512) * Upload test results to codecov * Upload tests results in single job --- .github/workflows/ci.yaml | 53 +++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 54 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 829888f3fe2..f0b117ab54a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -962,6 +962,7 @@ jobs: if [[ "${{ needs.info.outputs.skip_coverage }}" != "true" ]]; then cov_params+=(--cov="homeassistant") cov_params+=(--cov-report=xml) + cov_params+=(--junitxml=junit.xml -o junit_family=legacy) fi echo "Test group ${{ matrix.group }}: $(sed -n "${{ matrix.group }},1p" pytest_buckets.txt)" @@ -992,6 +993,12 @@ jobs: name: coverage-${{ matrix.python-version }}-${{ matrix.group }} path: coverage.xml overwrite: true + - name: Upload test results artifact + if: needs.info.outputs.skip_coverage != 'true' + uses: actions/upload-artifact@v4.6.0 + with: + name: test-results-full-${{ matrix.python-version }}-${{ matrix.group }} + path: junit.xml - name: Remove pytest_buckets run: rm pytest_buckets.txt - name: Check dirty @@ -1088,6 +1095,7 @@ jobs: cov_params+=(--cov="homeassistant.components.recorder") cov_params+=(--cov-report=xml) cov_params+=(--cov-report=term-missing) + cov_params+=(--junitxml=junit.xml -o junit_family=legacy) fi python3 -b -X dev -m pytest \ @@ -1122,6 +1130,13 @@ jobs: steps.pytest-partial.outputs.mariadb }} path: coverage.xml overwrite: true + - name: Upload test results artifact + if: needs.info.outputs.skip_coverage != 'true' + uses: actions/upload-artifact@v4.6.0 + with: + name: test-results-mariadb-${{ matrix.python-version }}-${{ + steps.pytest-partial.outputs.mariadb }} + path: junit.xml - name: Check dirty run: | ./script/check_dirty @@ -1218,6 +1233,7 @@ jobs: cov_params+=(--cov="homeassistant.components.recorder") cov_params+=(--cov-report=xml) cov_params+=(--cov-report=term-missing) + cov_params+=(--junitxml=junit.xml -o junit_family=legacy) fi python3 -b -X dev -m pytest \ @@ -1253,6 +1269,13 @@ jobs: steps.pytest-partial.outputs.postgresql }} path: coverage.xml overwrite: true + - name: Upload test results artifact + if: needs.info.outputs.skip_coverage != 'true' + uses: actions/upload-artifact@v4.6.0 + with: + name: test-results-postgres-${{ matrix.python-version }}-${{ + steps.pytest-partial.outputs.postgresql }} + path: junit.xml - name: Check dirty run: | ./script/check_dirty @@ -1365,6 +1388,7 @@ jobs: cov_params+=(--cov="homeassistant.components.${{ matrix.group }}") cov_params+=(--cov-report=xml) cov_params+=(--cov-report=term-missing) + cov_params+=(--junitxml=junit.xml -o junit_family=legacy) fi python3 -b -X dev -m pytest \ @@ -1394,6 +1418,12 @@ jobs: name: coverage-${{ matrix.python-version }}-${{ matrix.group }} path: coverage.xml overwrite: true + - name: Upload test results artifact + if: needs.info.outputs.skip_coverage != 'true' + uses: actions/upload-artifact@v4.6.0 + with: + name: test-results-partial-${{ matrix.python-version }}-${{ matrix.group }} + path: junit.xml - name: Check dirty run: | ./script/check_dirty @@ -1419,3 +1449,26 @@ jobs: with: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + + upload-test-results: + name: Upload test results to Codecov + if: needs.info.outputs.skip_coverage != 'true' && !cancelled() + runs-on: ubuntu-24.04 + needs: + - info + - pytest-partial + - pytest-full + - pytest-postgres + - pytest-mariadb + timeout-minutes: 10 + steps: + - name: Download all coverage artifacts + uses: actions/download-artifact@v4.1.8 + with: + pattern: test-results-* + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + with: + fail_ci_if_error: true + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 241255253c5..5aa51c9d762 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,7 @@ test-reports/ test-results.xml test-output.xml pytest-*.txt +junit.xml # Translations *.mo