Skip to content
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

PHP 8 compatibility #328

Merged
merged 10 commits into from
Jun 17, 2022
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Linting

env:
COMPOSER_VERSION: "2"
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache"

on:
push:
branches:
Expand Down Expand Up @@ -28,21 +32,38 @@ jobs:
phpcs:
name: phpcs
runs-on: ubuntu-latest

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

- name: Set standard 10up cache directories
run: |
composer config -g cache-dir "${{ env.COMPOSER_CACHE }}"

- name: Prepare composer cache
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-

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

- name: Install dependencies
run: composer install

- name: PHPCS check
uses: chekalsky/phpcs-action@v1
with:
phpcs_bin_path: './vendor/bin/phpcs .'
phpcs_bin_path: './vendor/bin/phpcs . --runtime-set testVersion 7.0-'

vipcs:
name: vipcs
runs-on: ubuntu-latest
Expand Down
34 changes: 28 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: PHPUnit Tests

env:
COMPOSER_VERSION: "2"
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache"

on:
schedule:
- cron: '0 0 * * *'
Expand All @@ -13,23 +17,41 @@ on:

jobs:
phpunit:
runs-on: ubuntu-latest
name: ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
os: [ ubuntu-latest ]

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

- name: Set standard 10up cache directories
run: |
composer config -g cache-dir "${{ env.COMPOSER_CACHE }}"

- name: Prepare composer cache
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-

- uses: getong/mariadb-action@v1.1

- name: Set PHP version
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@2.17.0
with:
php-version: '7.4'
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v1
tools: phpunit-polyfills, composer:v2

- name: Install dependencies
run: composer install
run: composer update -W

- name: Setup WP Tests
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
release
/vendor/*
phpunit.xml
.phpunit.result.cache
/dist
coverage
/docs
Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "wordpress-plugin",
"license": "GPLv2",
"require": {
"php": ">=7.4",
"php": ">=7.0",
"yahnis-elsts/plugin-update-checker": "4.6"
},
"autoload": {
Expand All @@ -22,10 +22,13 @@
]
},
"require-dev": {
"phpunit/phpunit": "^7.5",
"10up/phpcs-composer": "dev-master",
"yoast/phpunit-polyfills": "^1.0.0"
},
"scripts": {
"lint": "phpcs . --runtime-set testVersion 7.0-",
"lint-fix": "phpcbf ."
},
"minimum-stability": "dev",
"config": {
"allow-plugins": {
Expand Down
Loading