Skip to content

Commit

Permalink
Merge branch 'release/1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Aug 26, 2021
2 parents e55a883 + 32a38d2 commit 9c8cd95
Show file tree
Hide file tree
Showing 10 changed files with 409 additions and 284 deletions.
120 changes: 86 additions & 34 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,22 @@ on: [ push, pull_request ]
env:
COMPOSER_NO_INTERACTION: 1
WP_TESTS_DB_PASS: password
php-version: '7.4'
wp-version: '*'
phpunit-version: '^6.0'

jobs:
coding-standards:
name: Coding Standards (PHP ${{ matrix.php-version }})
phpcs:
name: PHP Coding Standards

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version:
- 7.4

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: ${{ env.php-version }}
extensions: bcmath, intl, mbstring, mysql
ini-values: memory_limit=2048M
tools: composer, phpcs
Expand Down Expand Up @@ -54,32 +50,64 @@ jobs:
- name: List Composer packages
run: composer show

- name: PHPLint
run: composer run-script phplint

- name: PHP Code Sniffer
run: composer run-script phpcs

phpmd:
name: PHP Mess Detector

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
extensions: bcmath, intl, mbstring, mysql
ini-values: memory_limit=2048M
tools: composer
coverage: none

- name: Composer validation
run: composer validate --strict

# https://github.com/actions/cache/blob/master/examples.md#php---composer
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Require WordPress
run: composer require --dev --no-update --no-progress --no-suggest roots/wordpress:${{ env.wp-version }} wp-phpunit/wp-phpunit:${{ env.wp-version }}

- name: Install Composer dependencies
run: composer update --no-progress --no-suggest

- name: List Composer packages
run: composer show

- name: PHP Mess Detector
continue-on-error: true
run: composer run-script phpmd

static-code-analysis:
name: Static Code Analysis (PHP ${{ matrix.php-version }})
phpstan:
name: PHPStan

runs-on: ubuntu-latest

strategy:
matrix:
php-version:
- 7.4

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: ${{ env.php-version }}
extensions: bcmath, intl, mbstring, mysql
ini-values: memory_limit=2048M
tools: composer
Expand All @@ -100,8 +128,11 @@ jobs:
- name: Install Composer dependencies
run: composer update --no-progress --no-suggest

- name: PHPStan static code analysis
run: composer bin phpstan install && composer run-script phpstan
- name: Install PHPStan
run: composer bin phpstan install

- name: PHPStan
run: composer run-script phpstan

tests:
name: Tests — PHP ${{ matrix.php-version }} ${{ matrix.name }}
Expand Down Expand Up @@ -215,16 +246,10 @@ jobs:
run: composer run-script phpunit

code-coverage:
name: Code Coverage (PHP ${{ matrix.php-version }})
name: Code Coverage

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version:
- 7.4

services:
mysql:
image: mysql:5.7
Expand All @@ -241,7 +266,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: ${{ env.php-version }}
extensions: bcmath, intl, mbstring, mysql
ini-values: memory_limit=2048M
tools: composer
Expand Down Expand Up @@ -277,17 +302,19 @@ jobs:
- name: PHPUnit test suite
env:
WP_TESTS_DB_HOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }}
run: composer run-script phpunit
run: composer run-script coverage

- name: Coveralls code coverage
- name: Publish coverage
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

run: |
composer run-script coveralls
bash <(curl -s https://codecov.io/bash)
es-sass-linting:
name: Scripts and Styles
es-lint:
name: Scripts

runs-on: ubuntu-latest

Expand All @@ -314,3 +341,28 @@ jobs:

- name: Sass Lint
run: npm run-script sass-lint
sass-lint:
name: Styles

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# https://github.com/actions/cache/blob/master/examples.md#macos-and-ubuntu
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-node@v1
with:
node-version: '12'

- name: Install Node packages
run: npm install

- name: Sass Lint
run: npm run-script sass-lint
36 changes: 24 additions & 12 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run

coverage:
tests:
override:
- command: ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
coverage:
file: build/logs/clover.xml
format: clover

environment:
php: 7.3.0
variables:
WP_TESTS_DB_NAME: 'wp_phpunit_tests'
WP_TESTS_DB_USER: 'root'
WP_TESTS_DB_PASS: ''
WP_TESTS_DB_HOST: 'localhost'
project_setup:
before:
- mysql -e "CREATE DATABASE wp_phpunit_tests"
WP_TESTS_DB_HOST: '127.0.0.1'

services:
mysql: 5.7

dependencies:
override:
- composer install --ignore-platform-reqs --no-interaction
nodes:
coverage:
tests:
override:
- command: ./vendor/bin/phpunit
coverage:
file: build/logs/clover.xml
format: clover

project_setup:
before:
- mysql -e "CREATE DATABASE wp_phpunit_tests"

checks:
php:
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## [Unreleased][unreleased]
-

## [1.2.2] - 2021-08-26
- Added the character `p` to the date format characters list which was added in PHP 8.

## [1.2.1] - 2021-04-26
- Happy 2021.

Expand Down Expand Up @@ -38,7 +41,8 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## 1.0.0
- First release.

[unreleased]: https://github.com/pronamic/wp-datetime/compare/1.2.1...HEAD
[unreleased]: https://github.com/pronamic/wp-datetime/compare/1.2.2...HEAD
[1.2.2]: https://github.com/pronamic/wp-datetime/compare/1.2.1...1.2.2
[1.2.1]: https://github.com/pronamic/wp-datetime/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/pronamic/wp-datetime/compare/1.1.1...1.2.0
[1.1.1]: https://github.com/pronamic/wp-datetime/compare/1.1.0...1.1.1
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,27 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"koodimonni-language/de_de": "*",
"koodimonni-language/fr_fr": "*",
"koodimonni-language/ja": "*",
"koodimonni-language/nl_nl": "*",
"php-coveralls/php-coveralls": "^2.4",
"phpcompatibility/php-compatibility": "^9.3",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpmd/phpmd": "^2.9",
"phpunit/phpunit": "^5.7 || ^6.0",
"pronamic/wp-coding-standards": "^1.0",
"roots/wordpress": "^5.6",
"squizlabs/php_codesniffer": "^3.5",
"vlucas/phpdotenv": "^2.0",
"wp-coding-standards/wpcs": "^2.3",
"wp-phpunit/wp-phpunit": "^5.6"
},
"scripts": {
"coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover build/logs/clover.xml --coverage-text",
"coverage-clover": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover build/logs/clover.xml",
"coverage-html": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html build/coverage-html",
"coverage-text": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text",
"coveralls": "vendor/bin/php-coveralls -v",
"phpcbf":"vendor/bin/phpcbf",
"phpcs": "vendor/bin/phpcs -s -v",
"phpcs": "XDEBUG_MODE=off vendor/bin/phpcs -s -v",
"phplint": "find src tests -name '*.php' | xargs -n 1 -P 4 php -l",
"phpmd": "vendor/bin/phpmd src,tests text phpmd.ruleset.xml --suffixes php",
"phpstan": "vendor/bin/phpstan analyse",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-datetime",
"version": "1.2.1",
"version": "1.2.2",
"description": "WordPress DateTime library.",
"repository": {
"type": "git",
Expand Down
23 changes: 1 addition & 22 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,35 +1,14 @@
<?xml version="1.0"?>

<ruleset name="Pronamic DateTime rules">
<config name="minimum_supported_wp_version" value="4.7" />

<config name="testVersion" value="5.6-" />

<file>.</file>

<arg name="colors"/>
<arg name="extensions" value="php" />
<arg value="sp" />

<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
<exclude-pattern>tests/wp-config.php</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>wordpress/*</exclude-pattern>
<exclude-pattern type="relative">^wp-content/*</exclude-pattern>

<rule ref="PHPCompatibility">
<rule ref="PronamicWP">
<exclude name="PHPCompatibility.Interfaces.InternalInterfaces.datetimeinterfaceFound" />
</rule>

<rule ref="PHPCompatibilityWP" />

<rule ref="WordPress">
<exclude name="Generic.Files.LowercasedFilename.NotFound" />

<exclude name="Squiz.Commenting" />

<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
</rule>
</ruleset>
4 changes: 0 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
</whitelist>
</filter>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>

<php>
<env name="WP_PHPUNIT__TESTS_CONFIG" value="tests/wp-config.php" />
</php>
Expand Down
1 change: 1 addition & 0 deletions src/DateTimeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ interface DateTimeInterface extends \DateTimeInterface {
// Timezone.
'I',
'P',
'p',
'O',
'T',
'e',
Expand Down
Loading

0 comments on commit 9c8cd95

Please sign in to comment.