Build/Test Tools: Allow changes to the code coverage workflow to run on pull request.

This adds the `pull_request` event to the Code Coverage Report workflow, allowing changes to be verified in a pull request before being committed.

The `branches` and `paths` filters are used to limit when the workflow runs to pull requests with:

- A base branch of `trunk`.
- Changing specific files that can potentially affect the way a coverage report is generated.

Reports generated on `pull_request` events are for testing purposes only and are not submitted to Codecov.

The `docker-compose.yml` file has also been added to the `paths` filter for both `push` and `pull_request` events. Changes to this file could potentially affect the environment used to generate the report (such as the ones in [53552]).

Props afragen, johnbillion, desrosj.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53553 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2022-06-21 23:59:29 +00:00
parent c40b46525c
commit e902e52e95

View File

@ -7,6 +7,15 @@ on:
- trunk
paths:
- '.github/workflows/test-coverage.yml'
- 'docker-compose.yml'
- 'phpunit.xml.dist'
- 'tests/phpunit/multisite.xml'
pull_request:
branches:
- trunk
paths:
- '.github/workflows/test-coverage.yml'
- 'docker-compose.yml'
- 'phpunit.xml.dist'
- 'tests/phpunit/multisite.xml'
# Once daily at 00:00 UTC.
@ -150,7 +159,7 @@ jobs:
run: git diff --exit-code
- name: Upload single site report to Codecov
if: ${{ ! matrix.multisite }}
if: ${{ ! matrix.multisite && github.event_name != 'pull_request' }}
uses: codecov/codecov-action@e3c560433a6cc60aec8812599b7844a7b4fa0d71 # v3.0.0
with:
file: wp-code-coverage-single-clover-${{ github.sha }}.xml
@ -164,7 +173,7 @@ jobs:
run: git diff --exit-code
- name: Upload multisite report to Codecov
if: ${{ matrix.multisite }}
if: ${{ matrix.multisite && github.event_name != 'pull_request' }}
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
with:
file: wp-code-coverage-multisite-clover-${{ github.sha }}.xml