From e902e52e953d5c9dd6a7e359bb7373ea9e9dabb5 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 21 Jun 2022 23:59:29 +0000 Subject: [PATCH] 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 --- .github/workflows/test-coverage.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index a6dc207563..c8c0ea29ab 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -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