Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #20 from wp-cms/moving-along-with-wordpress
Browse files Browse the repository at this point in the history
Cherrypick relevant commits from WordPress
  • Loading branch information
WP CMS authored Nov 27, 2022
2 parents 9cf457a + 2489110 commit 7aadd93
Show file tree
Hide file tree
Showing 98 changed files with 647 additions and 519 deletions.
38 changes: 13 additions & 25 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ jobs:
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
# - Logs debug information.
# - Configures caching for PHPCS scans.
# - Installs Composer dependencies (use cache if possible).
# - Installs Composer dependencies.
# - Make Composer packages available globally.
# - Logs PHP_CodeSniffer debug information.
# - Runs PHPCS on the full codebase with warnings suppressed.
# - Generate a report for displaying issues as pull request annotations.
# - Runs PHPCS on the `tests` directory without warnings suppressed.
# - Generate a report for displaying `test` directory issues as pull request annotations.
# - Ensures version-controlled files are not modified or deleted.
phpcs:
name: PHP coding standards
Expand All @@ -71,12 +71,7 @@ jobs:
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr

- name: Log debug information
run: |
php --version
composer --version
tools: cs2pr

# This date is used to ensure that the PHPCS cache is cleared at least once every week.
# http://man7.org/linux/man-pages/man1/date.1.html
Expand All @@ -90,17 +85,16 @@ jobs:
path: .cache/phpcs.json
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}

# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
# passing a custom cache suffix ensures that the cache is flushed at least once per week.
- name: Install Composer dependencies
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
with:
composer-options: "--no-progress --no-ansi"
custom-cache-suffix: ${{ steps.get-date.outputs.date }}

- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH

- name: Log PHPCS debug information
run: phpcs -i

- name: Run PHPCS on all Core files
id: phpcs-core
run: phpcs -n --report-full --report-checkstyle=./.cache/phpcs-report.xml
Expand All @@ -126,10 +120,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs Node.js.
# - Logs updated debug information.
# _ Installs npm dependencies.
# - Installs npm dependencies.
# - Run the WordPress JSHint checks.
# - Ensures version-controlled files are not modified or deleted.
jshint:
Expand All @@ -144,14 +137,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Log debug information
run: |
npm --version
node --version
git --version
svn --version
- name: Install Node.js
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
Expand All @@ -161,8 +147,10 @@ jobs:
run: |
npm --version
node --version
git --version
svn --version
- name: Install Dependencies
- name: Install npm Dependencies
run: npm ci

- name: Run JSHint
Expand Down
29 changes: 9 additions & 20 deletions .github/workflows/end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ jobs:
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs Node.js.
# _ Installs npm dependencies.
# - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Starts the WordPress Docker container.
# - Logs general debug information.
# - Logs the running Docker containers.
# - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
# - Install WordPress within the Docker container.
Expand All @@ -61,24 +60,22 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Log debug information
run: |
npm --version
node --version
curl --version
git --version
svn --version
php --version
php -i
locale -a
- name: Install Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install Dependencies
- name: Install npm Dependencies
run: npm ci

- name: Build WordPress
Expand All @@ -88,14 +85,6 @@ jobs:
run: |
npm run env:start
- name: General debug information
run: |
npm --version
node --version
curl --version
git --version
svn --version
- name: Log running Docker containers
run: docker ps -a

Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/javascript-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs Node.js.
# - Logs updated debug information.
# _ Installs npm dependencies.
# - Installs npm dependencies.
# - Run the WordPress QUnit tests.
# - Ensures version-controlled files are not modified or deleted.
test-js:
Expand All @@ -59,14 +58,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Log debug information
run: |
npm --version
node --version
git --version
svn --version
- name: Install Node.js
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
Expand All @@ -76,8 +68,10 @@ jobs:
run: |
npm --version
node --version
git --version
svn --version
- name: Install Dependencies
- name: Install npm Dependencies
run: npm ci

- name: Run QUnit tests
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/php-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
# - Sets up PHP.
# - Logs debug information.
# - Configures caching for PHP compatibility scans.
# - Installs Composer dependencies (use cache if possible).
# - Installs Composer dependencies.
# - Make Composer packages available globally.
# - Logs PHP_CodeSniffer debug information.
# - Runs the PHP compatibility tests.
# - Generate a report for displaying issues as pull request annotations.
# - Ensures version-controlled files are not modified or deleted.
php-compatibility:
name: Check PHP compatibility
Expand All @@ -66,11 +66,10 @@ jobs:
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr
tools: cs2pr

- name: Log debug information
run: |
php --version
composer --version
# This date is used to ensure that the PHP compatibility cache is cleared at least once every week.
Expand All @@ -85,17 +84,16 @@ jobs:
path: .cache/phpcompat.json
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}

# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
# passing a custom cache suffix ensures that the cache is flushed at least once per week.
- name: Install Composer dependencies
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
with:
composer-options: "--no-progress --no-ansi"
custom-cache-suffix: ${{ steps.get-date.outputs.date }}

- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH

- name: Log PHPCS debug information
run: phpcs -i

- name: Run PHP compatibility tests
id: phpcs
run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml
Expand Down
77 changes: 34 additions & 43 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,20 @@ jobs:
#
# Performs the following steps:
# - Sets environment variables.
# - Sets up the environment variables needed for testing with memcached (if desired).
# - Installs Node.js.
# - Installs npm dependencies
# - Configures caching for Composer.
# - Checks out the repository.
# - Sets up Node.js.
# - Sets up PHP.
# - Installs Composer dependencies.
# - Installs npm dependencies
# - Logs general debug information about the runner.
# - Logs Docker debug information (about the Docker installation within the runner).
# - Starts the WordPress Docker container.
# - Logs general debug information about the runner.
# - Logs the running Docker containers.
# - Logs debug information from inside the WordPress Docker container.
# - Logs debug information about what's installed within the WordPress Docker containers.
# - Install WordPress within the Docker container.
# - Run the PHPUnit tests.
# - Ensures version-controlled files are not modified or deleted.
# - 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.
test-php:
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
Expand Down Expand Up @@ -108,43 +106,44 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Install Node.js
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install Dependencies
run: npm ci

# This date is used to ensure that the Composer cache is refreshed at least once every week.
# http://man7.org/linux/man-pages/man1/date.1.html
- name: "Get last Monday's date"
id: get-date
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT

- name: Get Composer cache directory
id: composer-cache
run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
env:
cache-name: cache-composer-dependencies
##
# This allows Composer dependencies to be installed using a single step.
#
# Since the tests are currently run within the Docker containers where the PHP version varies,
# the same PHP version needs to be configured for the action runner machine so that the correct
# dependency versions are installed and cached.
##
- name: Set up PHP
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2.22.0
with:
path: ${{ steps.composer-cache.outputs.composer_dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-date-${{ steps.get-date.outputs.date }}-composer-${{ hashFiles('**/composer.json') }}
php-version: '${{ matrix.php }}'
coverage: none

# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
# passing a custom cache suffix ensures that the cache is flushed at least once per week.
- name: Install Composer dependencies
run: |
docker-compose run --rm php composer --version
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
with:
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")

# Install using `composer update` as there is no `composer.lock` file.
if [ ${{ env.LOCAL_PHP }} == '8.2-fpm' ]; then
docker-compose run --rm php composer update --ignore-platform-req=php+
else
docker-compose run --rm php composer update
fi
- name: Install npm dependencies
run: npm ci

- name: General debug information
run: |
npm --version
node --version
curl --version
git --version
svn --version
composer --version
locale -a
- name: Docker debug information
run: |
Expand All @@ -155,14 +154,6 @@ jobs:
run: |
npm run env:start
- name: General debug information
run: |
npm --version
node --version
curl --version
git --version
svn --version
- name: Log running Docker containers
run: docker ps -a

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-and-zip-default-themes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
# - Installs Node.js (only when theme has a build process)
# - Installs npm dependencies (only when theme has a build process)
# - Runs the theme build script (only when theme has a build process)
# - Sets up Node.js.
# - Installs npm dependencies.
# - Runs the theme build script.
# - Ensures version-controlled files are not modified or deleted.
test-build-scripts:
name: Test ${{ matrix.theme }} build script
Expand All @@ -77,7 +77,7 @@ jobs:
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}

- name: Install Node.js
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
Expand Down
Loading

0 comments on commit 7aadd93

Please sign in to comment.