Skip to content

Commit

Permalink
Update test environment (#191)
Browse files Browse the repository at this point in the history
* separate composer environment for PHP 5, add PHP 8 tests

PHPUnit 7.5 has sufficient support for PHP 8, even though it is not
compatible officially, and WP test does not yet support PHPUnit 8 or
later. PHPUnit 5/6 however fail with PHP 8, so we use a different
dev-dependency set for PHP 5 integration tests.

Dropped PHP 7.0-7.3 and nightly from CI roster, as there is no real
benefit in running PHPCS lints against these versions.

* lock PHPUnit to v5 for PHP 5.6 builds

Using 5 or 7 should work, however without a lockfile and 
--ignore-platform-reqs (required for PHP 8) v7 is chosen.

* update node dev-dependencies and use "npm ci"
  • Loading branch information
stklcode authored Dec 12, 2020
1 parent 2a5c021 commit 90caeeb
Show file tree
Hide file tree
Showing 8 changed files with 1,875 additions and 1,364 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
/.stylelintrc.json export-ignore
/.travis.yml export-ignore
/composer.json export-ignore
/composer-php5.json export-ignore
/package.json export-ignore
/package-lock.json export-ignore
/composer.lock export-ignore
/composer-php5.lock export-ignore
/phpcs.xml export-ignore
/phpunit.xml export-ignore
/README.md export-ignore
19 changes: 8 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,20 @@ services:
matrix:
include:
- php: 5.6
env: WP_VERSION=4.7
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
env:
- WP_VERSION=4.7
- COMPOSER=composer-php5.json
- php: 7.4
env: WP_VERSION=5.5
- php: 8.0
env: WP_VERSION=5.6
- php: nightly
allow_failures:
- php: nightly

before_install:
- nvm install 10
- nvm install 14

before_script:
- composer install
- npm install
- composer install --ignore-platform-reqs
- npm ci
- |
if [[ ! -z "$WP_VERSION" ]] ; then
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
Expand Down
93 changes: 93 additions & 0 deletions composer-php5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"name": "pluginkollektiv/statify",
"description": "Compact, easy-to-use and privacy-compliant stats plugin for WordPress.",
"license": "GPL-3.0-or-later",
"type": "wordpress-plugin",
"keywords": [
"wordpress",
"plugin",
"statistics"
],
"config": {
"platform": {
"php": "5.6"
}
},
"require": {
"php": "^5.2|^7|^8",
"npm-asset/chartist": "^0.11.4",
"npm-asset/chartist-plugin-tooltips-updated": "^0.1.3"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"matthiasmullie/minify": "^1.3",
"slowprog/composer-copy-file": "^0.3",
"squizlabs/php_codesniffer": "^3.5",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^2.3",
"phpunit/phpunit": "^5"
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"scripts": {
"post-install-cmd": [
"@build"
],
"post-update-cmd": [
"@build"
],
"build": [
"@copy-assets",
"@minify"
],
"copy-assets": [
"SlowProg\\CopyFile\\ScriptHandler::copy"
],
"cs": [
"@lint-php"
],
"csfix": [
"phpcbf --standard=phpcs.xml"
],
"lint-all": [
"@lint-php",
"@lint-js",
"@lint-css"
],
"lint-css": [
"npx stylelint css/dashboard.css"
],
"lint-js": [
"npx eslint js/dashboard.js",
"npx eslint js/snippet.js"
],
"lint-php": [
"phpcs --standard=phpcs.xml -s"
],
"lint-tests": [
"phpcs --standard=tests/phpcs.xml tests"
],
"minify": [
"minifycss css/dashboard.css > css/dashboard.min.css",
"minifyjs js/dashboard.js > js/dashboard.min.js",
"minifyjs js/snippet.js > js/snippet.min.js",
"minifycss vendor/npm-asset/chartist-plugin-tooltips-updated/dist/chartist-plugin-tooltip.css > css/chartist-plugin-tooltip.min.css"
],
"test": [
"phpunit"
]
},
"extra": {
"copy-file": {
"vendor/npm-asset/chartist/dist/chartist.min.css": "css/",
"vendor/npm-asset/chartist/dist/chartist.min.js": "js/",
"vendor/npm-asset/chartist/dist/chartist.min.js.map": "js/",
"vendor/npm-asset/chartist-plugin-tooltips-updated/dist/chartist-plugin-tooltip.min.js": "js/",
"vendor/npm-asset/chartist-plugin-tooltips-updated/dist/chartist-plugin-tooltip.min.js.map": "js/"
}
}
}
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"statistics"
],
"require": {
"php": "^5.2|^7",
"php": "^5.2|^7|^8",
"npm-asset/chartist": "^0.11.4",
"npm-asset/chartist-plugin-tooltips-updated": "^0.1.3"
},
Expand All @@ -18,9 +18,9 @@
"matthiasmullie/minify": "^1.3",
"slowprog/composer-copy-file": "^0.3",
"squizlabs/php_codesniffer": "^3.5",
"phpcompatibility/php-compatibility": "^9.3",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^2.3",
"phpunit/phpunit": "^5"
"phpunit/phpunit": "^5|^7"
},
"repositories": [
{
Expand Down
Loading

0 comments on commit 90caeeb

Please sign in to comment.