Skip to content

Commit a8570d9

Browse files
authored
Merge pull request #41 from spacedmonkey/fix/0.2
Version 1.
2 parents 38ac80e + 4c3b869 commit a8570d9

15 files changed

+12888
-1371
lines changed
Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
name: PHP Lints
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
- release/*
8-
pull_request:
4+
push:
5+
branches:
6+
- master
7+
- release/*
8+
pull_request:
99

1010
jobs:
11-
lint-php:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v2
16-
17-
- name: Setup PHP
18-
uses: shivammathur/setup-php@v2
19-
with:
20-
php-version: '7.4'
21-
coverage: none
22-
tools: composer, cs2pr
23-
24-
- name: Get Composer cache directory
25-
id: composer-cache
26-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
27-
28-
- name: Setup Composer cache
29-
uses: pat-s/[email protected]
30-
with:
31-
path: ${{ steps.composer-cache.outputs.dir }}
32-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
33-
restore-keys: |
34-
${{ runner.os }}-composer-
35-
${{ runner.os }}-
36-
37-
- name: Validate composer.json
38-
run: composer --no-interaction validate --no-check-all
39-
40-
- name: Install dependencies
41-
run: composer install --prefer-dist --no-suggest --no-progress --no-interaction
42-
43-
- name: Detect coding standard violations (PHPCS)
44-
run: vendor/bin/phpcs -q --report=checkstyle --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 | cs2pr --graceful-warnings
11+
lint-php:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: '7.4'
21+
coverage: none
22+
tools: composer, cs2pr
23+
24+
- name: Get Composer cache directory
25+
id: composer-cache
26+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
27+
28+
- name: Setup Composer cache
29+
uses: pat-s/[email protected]
30+
with:
31+
path: ${{ steps.composer-cache.outputs.dir }}
32+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
33+
restore-keys: |
34+
${{ runner.os }}-composer-
35+
${{ runner.os }}-
36+
37+
- name: Validate composer.json
38+
run: composer --no-interaction validate --no-check-all
39+
40+
- name: Install dependencies
41+
run: composer install --prefer-dist --no-suggest --no-progress --no-interaction
42+
43+
- name: Detect coding standard violations (PHPCS)
44+
run: vendor/bin/phpcs -q --report=checkstyle --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 | cs2pr --graceful-warnings

.github/workflows/deploytowp.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
name: Deploy to WordPress.org
22
on:
3-
push:
4-
tags:
5-
- "**"
3+
push:
4+
tags:
5+
- '**'
66
jobs:
7-
tag:
8-
name: New tag
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@main
7+
tag:
8+
name: New tag
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@main
1212

13-
- name: Setup PHP
14-
uses: shivammathur/setup-php@v2
15-
with:
16-
php-version: '7.4'
17-
coverage: none
18-
tools: composer
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '7.4'
17+
coverage: none
18+
tools: composer
1919

20-
- name: Validate composer.json and composer.lock
21-
run: composer validate
20+
- name: Validate composer.json and composer.lock
21+
run: composer validate
2222

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

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

38-
- name: WordPress Plugin Deploy
39-
uses: 10up/action-wordpress-plugin-deploy@stable
40-
env:
41-
SLUG: ${{ secrets.SLUG }}
42-
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
43-
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
38+
- name: WordPress Plugin Deploy
39+
uses: 10up/action-wordpress-plugin-deploy@stable
40+
env:
41+
SLUG: ${{ secrets.SLUG }}
42+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
43+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
Lines changed: 91 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,107 @@
11
name: PHP Unit Tests
22

33
on:
4-
push:
5-
# Only run if PHP-related files changed.
6-
paths:
7-
- '**.php'
8-
- 'phpunit.xml.dist'
9-
- 'phpunit-multisite.xml.dist'
10-
- 'composer.json'
11-
- 'composer.lock'
12-
- 'tests/**'
13-
branches:
14-
- master
15-
- release/*
16-
pull_request:
17-
# Only run if PHP-related files changed.
18-
paths:
19-
- '**.php'
20-
- 'phpunit.xml.dist'
21-
- 'phpunit-multisite.xml.dist'
22-
- 'composer.json'
23-
- 'composer.lock'
24-
- 'tests/**'
25-
- '.github/workflows/tests-unit-php.yml'
4+
push:
5+
# Only run if PHP-related files changed.
6+
paths:
7+
- '**.php'
8+
- 'phpunit.xml.dist'
9+
- 'phpunit-multisite.xml.dist'
10+
- 'composer.json'
11+
- 'composer.lock'
12+
- 'tests/**'
13+
branches:
14+
- master
15+
- release/*
16+
pull_request:
17+
# Only run if PHP-related files changed.
18+
paths:
19+
- '**.php'
20+
- 'phpunit.xml.dist'
21+
- 'phpunit-multisite.xml.dist'
22+
- 'composer.json'
23+
- 'composer.lock'
24+
- 'tests/**'
25+
- '.github/workflows/tests-unit-php.yml'
2626

2727
jobs:
28-
unit-php:
29-
name: 'PHP ${{ matrix.php }} - WP ${{ matrix.wp }}'
30-
runs-on: ubuntu-latest
31-
timeout-minutes: 60
32-
services:
33-
mysql:
34-
image: mariadb:latest
35-
env:
36-
MYSQL_ALLOW_EMPTY_PASSWORD: true
37-
MYSQL_ROOT_PASSWORD:
38-
MYSQL_DATABASE: wordpress_test
39-
ports:
40-
- 3306
41-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
42-
continue-on-error: ${{ matrix.experimental == true }}
43-
strategy:
44-
matrix:
45-
php: ['7.0', '7.2', '7.4', '8.0', '8.1', '8.2']
46-
wp: ['latest']
47-
include:
48-
- php: '7.4'
49-
wp: 'trunk'
50-
experimental: true
28+
unit-php:
29+
name: 'PHP ${{ matrix.php }} - WP ${{ matrix.wp }}'
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 60
32+
services:
33+
mysql:
34+
image: mariadb:latest
35+
env:
36+
MYSQL_ALLOW_EMPTY_PASSWORD: true
37+
MYSQL_ROOT_PASSWORD:
38+
MYSQL_DATABASE: wordpress_test
39+
ports:
40+
- 3306
41+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
42+
continue-on-error: ${{ matrix.experimental == true }}
43+
strategy:
44+
matrix:
45+
php: ['7.0', '7.2', '7.4', '8.0']
46+
wp: ['latest']
47+
include:
48+
- php: '7.4'
49+
wp: 'trunk'
50+
experimental: true
5151

52-
steps:
53-
- name: Checkout
54-
uses: actions/checkout@v2
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v2
5555

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

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

73-
- name: Setup PHP 7.4
74-
uses: shivammathur/setup-php@v2
75-
with:
76-
php-version: 7.4
77-
tools: composer
75+
- name: Install prefixed dependencies
76+
run: |
77+
composer install --prefer-dist --no-suggest --no-progress --no-interaction
78+
rm -rf vendor/*
7879
79-
- name: Install prefixed dependencies
80-
run: |
81-
composer install --prefer-dist --no-suggest --no-progress --no-interaction
82-
rm -rf vendor/*
80+
- name: Setup PHP
81+
uses: shivammathur/setup-php@v2
82+
with:
83+
php-version: ${{ matrix.php }}
84+
extensions: mysql
85+
tools: composer, cs2pr
8386

84-
- name: Setup PHP
85-
uses: shivammathur/setup-php@v2
86-
with:
87-
php-version: ${{ matrix.php }}
88-
extensions: mysql
89-
tools: composer, cs2pr
87+
- name: Install dependencies
88+
run: |
89+
composer install --prefer-dist --no-suggest --no-progress --no-interaction --no-scripts
90+
composer dump-autoload --no-interaction
9091
91-
- name: Install dependencies
92-
run: |
93-
composer install --prefer-dist --no-suggest --no-progress --no-interaction --no-scripts
94-
composer dump-autoload --no-interaction
92+
- name: Shutdown default MySQL service
93+
run: sudo service mysql stop
9594

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

105-
- name: Set up tests
106-
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp }} true
107-
108-
- name: Run tests
109-
run: |
110-
npm run test:php
111-
npm run test:php:multisite
104+
- name: Run tests
105+
run: |
106+
npm run test:php
107+
npm run test:php:multisite

.github/workflows/upateassets.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name: Asset update
22
on:
3-
push:
4-
branches:
5-
- master
3+
push:
4+
branches:
5+
- master
66
jobs:
7-
master:
8-
name: Push to main
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@main
12-
- name: WordPress.org asset update
13-
uses: 10up/action-wordpress-plugin-asset-update@stable
14-
env:
15-
SLUG: ${{ secrets.SLUG }}
16-
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
17-
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
7+
master:
8+
name: Push to main
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@main
12+
- name: WordPress.org asset update
13+
uses: 10up/action-wordpress-plugin-asset-update@stable
14+
env:
15+
SLUG: ${{ secrets.SLUG }}
16+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
17+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}

0 commit comments

Comments
 (0)