From 14cda0388b49f21204d691d3216bf3fe034aac0d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 10 Dec 2020 19:17:28 +0000 Subject: [PATCH] Build/Test Tools: Reestablish the codebase as a Git repo before reporting test results. The test reporter uses the hidden `.svn` or `.git` directories to determine which changeset to send to WordPress.org along with the test report. Because the GitHub Action workflow builds and prepares WordPress in a preceding job to share with each test job, the `.git` directory is missing (it is purposefully not included to limit artifact size). This re-establishes the directory as a checkout of the `wordpress-develop` repository so that test results can be reported correctly. See #50401. git-svn-id: https://develop.svn.wordpress.org/trunk@49786 602fd350-edb4-49c9-b593-d223f7449a82 --- .github/workflows/phpunit-tests.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 2a4ae0c864..9200203896 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -120,6 +120,7 @@ jobs: # - Install WordPress within the Docker container. # - Run the PHPUnit tests. # - Checks out the WordPress Test reporter repository. + # - Reconnect the directory to the Git repository. # - Submit the test results to the WordPress.org host test results. # - todo: Configure Slack notifications for failing tests. test-php: @@ -279,8 +280,16 @@ jobs: repository: 'WordPress/phpunit-test-runner' path: 'test-runner' + - name: Set up the Git repository + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} + run: | + git init + git remote add origin https://github.com/WordPress/wordpress-develop.git + git fetch + git reset origin/master + - name: Submit test results to the WordPress.org host test results if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} env: WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" - run: docker-compose run --rm -e "$WPT_REPORT_API_KEY" -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php + run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php