diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb241d003..f7372596b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,44 @@ jobs: name: package path: ./pkg/**/* + coverage: + name: Combine & check coverage. + needs: [ matrix, matrix-main-frameworks ] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + # Use latest Python, so it understands all syntax. + python-version: 3.11 + + - run: python -Im pip install --upgrade coverage[toml] + + - uses: actions/download-artifact@v4 + with: + pattern: coverage-reports-* + merge-multiple: true + + - name: Combine coverage + run: | + python -Im coverage combine + python -Im coverage html --skip-covered --skip-empty + + # Report and write to summary. + python -Im coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY + + - name: Upload HTML report + uses: actions/upload-artifact@v4 + with: + name: html-coverage-report + path: htmlcov + + - uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # 5.1.0 + with: + name: coverage-reports-* + all: if: always() runs-on: ubuntu-latest diff --git a/.github/workflows/coverage-reporter.yml b/.github/workflows/coverage-reporter.yml deleted file mode 100644 index dbd2966fb..000000000 --- a/.github/workflows/coverage-reporter.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -## Workflow to process coverage report -## For now the coverage is not reported. This workflow is just here as preparation for -## https://github.com/elastic/observability-robots/issues/1546 -name: coverage-reporter -on: - workflow_run: - workflows: - - test - types: - - completed - -permissions: - contents: read - -jobs: - report: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Download artifacts - run: > - gh run download ${{ github.event.workflow_run.id }} - --name coverage - --repo "${GITHUB_REPOSITORY}" - --dir coverage - env: - GH_TOKEN: ${{ github.token }} - - run: ls -l coverage/matrix_results -# - run: ./spec/scripts/coverage_converge.sh -# - uses: actions/upload-artifact@v3 -# with: -# name: coverage-report -# path: coverage/coverage.xml diff --git a/.github/workflows/run-matrix.yml b/.github/workflows/run-matrix.yml index 65ec70fc7..e4b324bac 100644 --- a/.github/workflows/run-matrix.yml +++ b/.github/workflows/run-matrix.yml @@ -59,15 +59,15 @@ jobs: } const framework = normalizeName('${{ matrix.framework }}') const version = normalizeName('${{ matrix.version }}') - return `test-results-${version}-${framework}` + return `${version}-${framework}` - if: success() || failure() name: Upload JUnit Test Results uses: actions/upload-artifact@v4 with: - name: ${{ steps.normalize-junit.outputs.result }} + name: test-results-${{ steps.normalize-junit.outputs.result }} path: "**/spec/junit-reports/**/*ruby-agent-junit.xml" - if: success() || failure() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: coverage + name: coverage-reports-${{ steps.normalize-junit.outputs.result }} path: "coverage/"