Make WordPress Core

Changeset 57570


Ignore:
Timestamp:
02/08/2024 07:30:26 PM (4 months ago)
Author:
desrosj
Message:

Build/Test Tools: Generate a human-readable HTML coverage report.

This updates the test coverage GitHub Actions workflow to generate a human-readable HTML report in addition to the current machine readable one submitted to Codecov.

Props jorbin.
Fixes #60476.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/test-coverage.yml

    r57566 r57570  
    5858  # - Upload the multisite code coverage report to Codecov.io.
    5959  test-coverage-report:
    60     name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report
     60    name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report (${{ matrix.format }})
    6161    runs-on: ubuntu-latest
    6262    permissions:
     
    6868      matrix:
    6969        multisite: [ false, true ]
     70        format: [ clover, html ]
    7071
    7172    steps:
     
    145146      - name: Run tests as a single site
    146147        if: ${{ ! matrix.multisite }}
    147         run: npm run test:php -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml
     148        run: npm run test:php -- --verbose -c phpunit.xml.dist --coverage-${{ 'html' == matrix.format && 'html' || 'clover' }} wp-code-coverage-single-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }}
    148149
    149150      - name: Ensure version-controlled files are not modified during the tests
     
    155156        with:
    156157          token: ${{ secrets.CODECOV_TOKEN }}
    157           file: wp-code-coverage-single-clover-${{ github.sha }}.xml
     158          file: wp-code-coverage-single-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }}
    158159          flags: single,php
    159160          fail_ci_if_error: true
    160161
     162      - name: Upload single site HTML report as artifact
     163        if: ${{ ! matrix.multisite && matrix.format == 'html' }}
     164        uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
     165        with:
     166          name: wp-code-coverage-single-${{ github.sha }}
     167          path: wp-code-coverage-single-${{ github.sha }}
     168          overwrite: true
     169
    161170      - name: Run tests as a multisite install
    162171        if: ${{ matrix.multisite }}
    163         run: npm run test:php -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml
     172        run: npm run test:php -- --verbose -c tests/phpunit/multisite.xml --coverage-${{ 'html' == matrix.format && 'html' || 'clover' }} wp-code-coverage-multisite-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }}
    164173
    165174      - name: Ensure version-controlled files are not modified during the tests
     
    171180        with:
    172181          token: ${{ secrets.CODECOV_TOKEN }}
    173           file: wp-code-coverage-multisite-clover-${{ github.sha }}.xml
     182          file: wp-code-coverage-multisite-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }}
    174183          flags: multisite,php
    175184          fail_ci_if_error: true
     185
     186      - name: Upload multisite HTML report as artifact
     187        if: ${{ matrix.multisite && matrix.format == 'html' }}
     188        uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
     189        with:
     190          name: wp-code-coverage-multisite-${{ github.sha }}
     191          path: wp-code-coverage-multisite-${{ github.sha }}
     192          overwrite: true
    176193
    177194  slack-notifications:
Note: See TracChangeset for help on using the changeset viewer.