Skip to content

Update v3 #128

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.github/ export-ignore
tests/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.wp-env.json export-ignore
composer.lock export-ignore
package.json export-ignore
package-lock.json export-ignore
phpcs.xml export-ignore
phpunit.env export-ignore
phpunit.xml export-ignore
162 changes: 59 additions & 103 deletions .github/workflows/php_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,121 +3,77 @@ name: Unit Tests
# Since Unit Tests are required to pass for each PR,
# we cannot disable them for documentation-only changes.
on:
pull_request:
push:
# Allow manually triggering the workflow.
workflow_dispatch:
pull_request:
push:
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
compute-previous-wordpress-version:
name: Compute previous WordPress version
runs-on: ubuntu-latest
outputs:
previous-wordpress-version: ${{ steps.get-previous-wordpress-version.outputs.previous-wordpress-version }}
latest-wordpress-version: ${{ steps.get-latest-wordpress-version.outputs.latest-wordpress-version }}
test-php:
name: PHP ${{ matrix.php }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
wordpress:
- '6.5'
- '6.7'
- '6.8'

steps:
- name: Get latest WordPress version
id: get-latest-wordpress-version
run: |
curl \
-H "Accept: application/json" \
-o versions.json \
"http://api.wordpress.org/core/stable-check/1.0/"
LATEST_WP_VERSION=$(jq --raw-output 'with_entries(select(.value=="latest"))|keys[]' versions.json)
echo "latest-wordpress-version=${LATEST_WP_VERSION}" >> $GITHUB_OUTPUT
rm versions.json
- name: Get previous WordPress version
id: get-previous-wordpress-version
run: |
curl \
-H "Accept: application/json" \
-o versions.json \
"http://api.wordpress.org/core/stable-check/1.0/"
LATEST_WP_VERSION=$(jq --raw-output 'with_entries(select(.value=="latest"))|keys[]' versions.json)
IFS='.' read LATEST_WP_MAJOR LATEST_WP_MINOR LATEST_WP_PATCH <<< "${LATEST_WP_VERSION}"
if [[ ${LATEST_WP_MINOR} == "0" ]]; then
PREVIOUS_WP_SERIES="$((LATEST_WP_MAJOR - 1)).9"
else
PREVIOUS_WP_SERIES="${LATEST_WP_MAJOR}.$((LATEST_WP_MINOR - 1))"
fi
PREVIOUS_WP_VERSION=$(jq --raw-output --arg series "${PREVIOUS_WP_SERIES}" 'with_entries(select(.key|startswith($series)))|keys[-1]' versions.json)
echo "previous-wordpress-version=${PREVIOUS_WP_VERSION}" >> $GITHUB_OUTPUT
rm versions.json
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}

test-php:
name: PHP ${{ matrix.php }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
needs: compute-previous-wordpress-version
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php:
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
wordpress: ["${{needs.compute-previous-wordpress-version.outputs.latest-wordpress-version}}" ] # Latest WordPress version.
include:
# Test with the previous WP version.
- php: '7.0'
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
- php: '7.4'
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
- php: '8.2'
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
# Test with the upcoming WP version.
- php: '7.0'
wordpress: ''
- php: '7.4'
wordpress: ''
- php: '8.2'
wordpress: ''
steps:
- uses: actions/[email protected]

env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
- name: Install Dependencies
run: npm ci

steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl

- name: Install Dependencies
run: npm ci
- name: Install PHP Dependencies
run: composer install --no-interaction --no-progress --no-suggest --optimize-autoloader

- name: Docker debug information
run: |
docker -v
docker-compose -v
- name: Docker debug information
run: |
docker -v

- name: General debug information
run: |
npm --version
node --version
curl --version
git --version
locale -a
echo "PHP version: ${WP_ENV_PHP_VERSION}"
echo "WordPress version: ${WP_ENV_CORE}"
- name: General debug information
run: |
npm --version
node --version
php --version
curl --version
git --version
locale -a
echo "PHP version: ${WP_ENV_PHP_VERSION}"
echo "WordPress version: ${WP_ENV_CORE}"

- name: Start Docker environment
run: npm run wp-env start
- name: Start Docker environment
run: npm run wp-env start

- name: Log running Docker containers
run: docker ps -a
- name: Log running Docker containers
run: docker ps -a

- name: Running unit tests
run: |
set -o pipefail
npm run test:php
- name: Running unit tests
run: |
set -o pipefail
npm run test
11 changes: 2 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,15 @@ dwsync.xml
.komodotools

# PHPUnit
phpunit.xml
phpunit.env
.phpunit.result.cache

# PHPCS
phpcs.xml

# Composer
composer.lock

# Folders to ignore
.hg
.svn
.CVS
intermediate
.idea
cache
deploy.sh
node_modules
node_modules
vendor
62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

9 changes: 8 additions & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"core": "WordPress/WordPress",
"plugins": [ "." ],
"config": {
"WP_ENVIRONMENT_TYPE": "production",
"WP_ENV": "production",
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": true
},
"env": {
"tests": {
"mappings": {
"wp-content/plugins/rollbar": "."
"wp-content/plugins/rollbar": "./"
}
}
}
Expand Down
Loading