-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7321 from ampproject/add/multisite-phpunit-workflow
Add PHPUnit tests workflow for multisite
- Loading branch information
Showing
15 changed files
with
186 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,11 +71,11 @@ jobs: | |
echo "Changed JS file count: $JS_FILE_COUNT" | ||
echo "Changed GHA workflow file count: $GHA_WORKFLOW_COUNT" | ||
echo "::set-output name=count::$FILE_COUNT" | ||
echo "::set-output name=php-count::$PHP_FILE_COUNT" | ||
echo "::set-output name=css-count::$CSS_FILE_COUNT" | ||
echo "::set-output name=js-count::$JS_FILE_COUNT" | ||
echo "::set-output name=gha-workflow-count::$GHA_WORKFLOW_COUNT" | ||
echo "count=$FILE_COUNT" >> $GITHUB_OUTPUT | ||
echo "php-count=$PHP_FILE_COUNT" >> $GITHUB_OUTPUT | ||
echo "css-count=$CSS_FILE_COUNT" >> $GITHUB_OUTPUT | ||
echo "js-count=$JS_FILE_COUNT" >> $GITHUB_OUTPUT | ||
echo "gha-workflow-count=$GHA_WORKFLOW_COUNT" >> $GITHUB_OUTPUT | ||
env: | ||
# Ignore Paths: | ||
# - .github/ | ||
|
@@ -176,7 +176,7 @@ jobs: | |
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure Composer cache | ||
uses: actions/[email protected] | ||
|
@@ -222,7 +222,7 @@ jobs: | |
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure Composer cache | ||
uses: actions/[email protected] | ||
|
@@ -304,7 +304,7 @@ jobs: | |
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure Composer cache | ||
uses: actions/[email protected] | ||
|
@@ -457,7 +457,7 @@ jobs: | |
- name: Get Composer Cache Directory | ||
if: needs.pre-run.outputs.changed-php-count > 0 | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure Composer cache | ||
if: needs.pre-run.outputs.changed-php-count > 0 | ||
|
@@ -475,7 +475,7 @@ jobs: | |
composer remove --dev phpdocumentor/reflection | ||
composer install --prefer-dist --ignore-platform-reqs --no-progress --no-interaction | ||
# See https://github.com/wp-cli/wp-cli/issues/5484 | ||
# See https://github.com/wp-cli/wp-cli/issues/5484 | ||
- name: Remove conflicting Requests library | ||
if: needs.pre-run.outputs.changed-php-count > 0 | ||
run: composer remove --dev --ignore-platform-reqs --no-interaction --no-scripts roave/security-advisories wp-cli/export-command wp-cli/extension-command wp-cli/wp-cli wp-cli/wp-cli-tests | ||
|
@@ -567,7 +567,76 @@ jobs: | |
flags: php,unit | ||
fail_ci_if_error: true | ||
|
||
#----------------------------------------------------------------------------------------------------------------------- | ||
#----------------------------------------------------------------------------------------------------------------------- | ||
|
||
unit-test-multisite-php: | ||
name: 'Unit Tests Multisite: PHP 7.4, WP Latest' | ||
needs: pre-run | ||
runs-on: ubuntu-latest | ||
if: needs.pre-run.outputs.changed-php-count > 0 | ||
strategy: | ||
matrix: | ||
testsuite: ['default', 'external-http'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected] | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: npm | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure Composer cache | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install Node dependencies | ||
run: npm ci | ||
env: | ||
CI: true | ||
|
||
- name: Install Composer dependencies | ||
run: | | ||
# phpdocumentor/reflection has to be removed as it makes use of an outdated dependency. | ||
composer remove --dev phpdocumentor/reflection | ||
composer install --prefer-dist --ignore-platform-reqs --no-progress --no-interaction | ||
# See https://github.com/wp-cli/wp-cli/issues/5484 | ||
- name: Remove conflicting Requests library | ||
run: composer remove --dev --ignore-platform-reqs --no-interaction --no-scripts roave/security-advisories wp-cli/export-command wp-cli/extension-command wp-cli/wp-cli wp-cli/wp-cli-tests | ||
|
||
- name: Update PHPUnit | ||
if: needs.pre-run.outputs.changed-php-count > 0 | ||
run: | | ||
# We are using PHP 7.4 and WP Latest. | ||
echo "Installing latest version of PHPUnit" | ||
composer update --ignore-platform-reqs --no-interaction --no-scripts yoast/phpunit-polyfills --with-dependencies | ||
- name: Build plugin | ||
run: npm run build:js | ||
|
||
- name: Move amp-wp to amp | ||
run: cp -r "$PWD" "/tmp/amp" | ||
|
||
- name: Start wp-env | ||
working-directory: /tmp/amp | ||
run: npm run wp-env start | ||
|
||
- name: Run multisite unit tests | ||
working-directory: /tmp/amp | ||
run: npm run test:php:multisite ${{ matrix.testsuite == 'external-http' && '-- --testsuite external-http' || '' }} | ||
|
||
#----------------------------------------------------------------------------------------------------------------------- | ||
|
||
feature-test-php: | ||
name: "Feature test${{ matrix.coverage && ' (with coverage)' || '' }}: PHP ${{ matrix.php }}, WP ${{ matrix.wp }}" | ||
|
@@ -641,7 +710,7 @@ jobs: | |
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure Composer cache | ||
uses: actions/[email protected] | ||
|
@@ -741,8 +810,7 @@ jobs: | |
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure Composer cache | ||
uses: actions/[email protected] | ||
|
@@ -774,11 +842,11 @@ jobs: | |
|
||
- name: Retrieve branch name | ||
id: retrieve-branch-name | ||
run: echo "::set-output name=branch_name::$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" | ||
run: echo "branch_name=$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_OUTPUT | ||
|
||
- name: Retrieve git SHA-8 string | ||
id: retrieve-git-sha-8 | ||
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" | ||
run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT | ||
|
||
- name: Upload build as artifact | ||
uses: actions/upload-artifact@v3 | ||
|
@@ -847,7 +915,7 @@ jobs: | |
- Download [development build](https://storage.googleapis.com/ampwp_github_artifacts/${{ github.ref }}/dev/amp.zip?${{ github.sha }}) | ||
- Download [production build](https://storage.googleapis.com/ampwp_github_artifacts/${{ github.ref }}/prod/amp.zip?${{ github.sha }})" | ||
body="${body//$'\n'/'%0A'}" | ||
echo "::set-output name=body::$body" | ||
echo "body=$body" >> $GITHUB_OUTPUT | ||
- name: Create comment on PR with links to plugin builds | ||
if: ${{ steps.find-comment.outputs.comment-id == '' }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"core": "WordPress/WordPress#master", | ||
"phpVersion": "7.4", | ||
"env": { | ||
"development": { | ||
"plugins": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.