Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multisite test coverage when SUBDOMAIN_INSTALL is true #5522

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

jeremyfelt
Copy link
Member

Trac ticket: https://core.trac.wordpress.org/ticket/42093


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
@jeremyfelt
Copy link
Member Author

@desrosj Super low priority, I'm just poking to see if I can get this to work. 😄

Is there a best practice for modifying php-tests-run.yml without changing this line?

uses: WordPress/wordpress-develop/.github/workflows/phpunit-tests-run.yml@trunk

Or can I tweak that and then revert to test this PR?

@desrosj
Copy link
Contributor

desrosj commented Oct 20, 2023

Or can I tweak that and then revert to test this PR?

Unfortunately, no. I usually just change it to point to the version in my fork in the PR's branch. jeremyfelt/wordpress-develop.....@add-subdomain-tests in this case.

Just have to remember to change it back when committing to trunk. Adding a comment to that line in the PR could help serve as a call out for that.

@@ -161,6 +161,10 @@ jobs:
if: ${{ inputs.multisite }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files

- name: Run tests as a subdomain multisite install
if: ${{ inputs.multisite }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} -d SUBDOMAIN_INSTALL=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to run this in parallel to avoid multisite jobs from taking double the amount of time. The best way to do this would likely be to add a new input for multisite-type that defaults to subdirectory and change this condition to something like:

Suggested change
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} -d SUBDOMAIN_INSTALL=true
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ 'subdomain' == inputs.multisite-type && ' -d SUBDOMAIN_INSTALL=true' || '' }}

Probably should make the ms-files job dynamic as well.

Working this into the matrix in phpunit-tests.yml is a little tricky,. We should be able to add a multisite-type: [ 'subdomain', 'subdirectory' ] accompanied with an exclude: excluding all multisite: false/multisite-type: 'subdomain and multisite: false/multisite-type: 'subdirectory jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants