Skip to content

Commit

Permalink
Merge pull request #41 from spacedmonkey/fix/0.2
Browse files Browse the repository at this point in the history
Version 1.
  • Loading branch information
spacedmonkey authored Apr 20, 2023
2 parents 38ac80e + 4c3b869 commit a8570d9
Show file tree
Hide file tree
Showing 15 changed files with 12,888 additions and 1,371 deletions.
78 changes: 39 additions & 39 deletions .github/workflows/continuous-integration-lint-php.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
name: PHP Lints

on:
push:
branches:
- master
- release/*
pull_request:
push:
branches:
- master
- release/*
pull_request:

jobs:
lint-php:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr

- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Setup Composer cache
uses: pat-s/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
${{ runner.os }}-
- name: Validate composer.json
run: composer --no-interaction validate --no-check-all

- name: Install dependencies
run: composer install --prefer-dist --no-suggest --no-progress --no-interaction

- name: Detect coding standard violations (PHPCS)
run: vendor/bin/phpcs -q --report=checkstyle --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 | cs2pr --graceful-warnings
lint-php:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr

- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Setup Composer cache
uses: pat-s/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
${{ runner.os }}-
- name: Validate composer.json
run: composer --no-interaction validate --no-check-all

- name: Install dependencies
run: composer install --prefer-dist --no-suggest --no-progress --no-interaction

- name: Detect coding standard violations (PHPCS)
run: vendor/bin/phpcs -q --report=checkstyle --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 | cs2pr --graceful-warnings
68 changes: 34 additions & 34 deletions .github/workflows/deploytowp.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
name: Deploy to WordPress.org
on:
push:
tags:
- "**"
push:
tags:
- '**'
jobs:
tag:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
tag:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer

- name: Validate composer.json and composer.lock
run: composer validate
- name: Validate composer.json and composer.lock
run: composer validate

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer vendor directory
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Cache Composer vendor directory
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install PHP Dependencies
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader --no-interaction
- name: Install PHP Dependencies
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader --no-interaction

- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SLUG: ${{ secrets.SLUG }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SLUG: ${{ secrets.SLUG }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
186 changes: 91 additions & 95 deletions .github/workflows/test-unit-php.yml
Original file line number Diff line number Diff line change
@@ -1,111 +1,107 @@
name: PHP Unit Tests

on:
push:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpunit.xml.dist'
- 'phpunit-multisite.xml.dist'
- 'composer.json'
- 'composer.lock'
- 'tests/**'
branches:
- master
- release/*
pull_request:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpunit.xml.dist'
- 'phpunit-multisite.xml.dist'
- 'composer.json'
- 'composer.lock'
- 'tests/**'
- '.github/workflows/tests-unit-php.yml'
push:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpunit.xml.dist'
- 'phpunit-multisite.xml.dist'
- 'composer.json'
- 'composer.lock'
- 'tests/**'
branches:
- master
- release/*
pull_request:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpunit.xml.dist'
- 'phpunit-multisite.xml.dist'
- 'composer.json'
- 'composer.lock'
- 'tests/**'
- '.github/workflows/tests-unit-php.yml'

jobs:
unit-php:
name: 'PHP ${{ matrix.php }} - WP ${{ matrix.wp }}'
runs-on: ubuntu-latest
timeout-minutes: 60
services:
mysql:
image: mariadb:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: wordpress_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
continue-on-error: ${{ matrix.experimental == true }}
strategy:
matrix:
php: ['7.0', '7.2', '7.4', '8.0', '8.1', '8.2']
wp: ['latest']
include:
- php: '7.4'
wp: 'trunk'
experimental: true
unit-php:
name: 'PHP ${{ matrix.php }} - WP ${{ matrix.wp }}'
runs-on: ubuntu-latest
timeout-minutes: 60
services:
mysql:
image: mariadb:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: wordpress_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
continue-on-error: ${{ matrix.experimental == true }}
strategy:
matrix:
php: ['7.0', '7.2', '7.4', '8.0']
wp: ['latest']
include:
- php: '7.4'
wp: 'trunk'
experimental: true

steps:
- name: Checkout
uses: actions/checkout@v2
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Setup Composer cache
uses: pat-s/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
${{ runner.os }}-
- name: Setup Composer cache
uses: pat-s/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
${{ runner.os }}-
# PHP-Scoper only works on PHP 7.2+ and we need to prefix our dependencies to accurately test them.
# So we temporarily switch PHP versions, do a full install and then remove the package.
# Then switch back to the PHP version we want to test and delete the vendor directory.
- name: Setup PHP 8.0
uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d
with:
php-version: '8.0'
tools: composer

- name: Setup PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer
- name: Install prefixed dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-interaction
rm -rf vendor/*
- name: Install prefixed dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-interaction
rm -rf vendor/*
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysql
tools: composer, cs2pr

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysql
tools: composer, cs2pr
- name: Install dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-interaction --no-scripts
composer dump-autoload --no-interaction
- name: Install dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-interaction --no-scripts
composer dump-autoload --no-interaction
- name: Shutdown default MySQL service
run: sudo service mysql stop

- name: Shutdown default MySQL service
run: sudo service mysql stop
- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"${{ job.services.mysql.ports[3306] }}" --silent; do
sleep 1
done
- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"${{ job.services.mysql.ports[3306] }}" --silent; do
sleep 1
done
- name: Set up tests
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp }} true

- name: Set up tests
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp }} true

- name: Run tests
run: |
npm run test:php
npm run test:php:multisite
- name: Run tests
run: |
npm run test:php
npm run test:php:multisite
28 changes: 14 additions & 14 deletions .github/workflows/upateassets.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Asset update
on:
push:
branches:
- master
push:
branches:
- master
jobs:
master:
name: Push to main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: WordPress.org asset update
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SLUG: ${{ secrets.SLUG }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
master:
name: Push to main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: WordPress.org asset update
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SLUG: ${{ secrets.SLUG }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
Loading

0 comments on commit a8570d9

Please sign in to comment.