Skip to content

Commit

Permalink
Repo updates and maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
dlh01 committed Oct 30, 2024
1 parent c4dee0a commit 335472c
Show file tree
Hide file tree
Showing 54 changed files with 177 additions and 196 deletions.
8 changes: 4 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# Exclude these files from release archives.
#
# This will also make the files unavailable when using Composer with `--prefer-dist`.
# If you develop using Composer, use `--prefer-source`.
#
# Via WPCS.
#
/.github export-ignore
/.php-cs-fixer.dist.php export-ignore
/phpcs.xml export-ignore
/phpstan.neon export-ignore
/.phpcs.xml export-ignore
/.phpcs export-ignore
/phpunit.xml export-ignore
/tests export-ignore
/configure.php export-ignore
/Makefile export-ignore

#
# Auto detect text files and perform LF normalization.
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/all-pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "All Pull Request Tests"

on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened, ready_for_review]

jobs:
# We use a single job to ensure that all steps run in the same environment and
# reduce the number of minutes used.
pr-tests:
# Don't run on draft PRs
if: github.event.pull_request.draft == false
# Timeout after 10 minutes
timeout-minutes: 10
# Define a matrix of PHP/WordPress versions to test against
strategy:
matrix:
php: [8.2, 8.3]
wordpress: ["latest"]
multisite: [false, true]
runs-on: ubuntu-latest
# Cancel any existing runs of this workflow
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}
cancel-in-progress: true
# Name the job in the matrix
name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }}"
steps:
- uses: actions/checkout@v4

- name: Run General Tests
# See https://github.com/alleyinteractive/action-test-general for more options
uses: alleyinteractive/action-test-general@develop

- name: Run PHP Tests
# See https://github.com/alleyinteractive/action-test-php for more options
uses: alleyinteractive/action-test-php@develop
with:
php-version: '${{ matrix.php }}'
audit-command: 'composer audit --no-dev --ansi --no-interaction'
wordpress-version: '${{ matrix.wordpress }}'
wordpress-multisite: '${{ matrix.multisite }}'
skip-wordpress-install: 'true'
14 changes: 0 additions & 14 deletions .github/workflows/code-quality.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/coding-standards.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/unit-test.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .php-cs-fixer.dist.php

This file was deleted.

42 changes: 18 additions & 24 deletions phpcs.xml → .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="alleyinteractive/wp-type-extensions" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>PHP_CodeSniffer standard for alleyinteractive/wp-type-extensions.</description>

<file>src/</file>
<file>tests/</file>
<exclude-pattern>vendor/</exclude-pattern>
<!-- Include Alley Rules -->
<rule ref="Alley-Interactive"/>

<!--
Pass some flags to PHPCS:
Expand All @@ -13,37 +12,32 @@
-->
<arg value="ps"/>

<!-- Use the Alley standard. -->
<rule ref="Alley-Interactive"/>
<file>src/</file>
<file>tests/</file>
<exclude-pattern>vendor/</exclude-pattern>

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>

<!-- Check up to N files simultaneously. -->
<arg name="parallel" value="75"/>
<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20"/>

<!-- Set severity to 1 to see everything that isn't effectively turned off. -->
<arg name="severity" value="1"/>

<!-- Set the allowed text domains for i18n. -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array" value="alley"/>
</properties>
</rule>
<!-- In effect, set the minimum supported version of WordPress to the latest version. -->
<config name="minimum_supported_wp_version" value="99.0"/>

<!-- Set the allowed prefixes for functions, etc. -->
<!-- Define the prefixes that can be used by the plugin -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array" value="Alley"/>
<property name="prefixes" type="array">
<element value="alley"/>
</property>
</properties>
</rule>

<!-- Use PSR-4 test class naming convention. -->
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>tests/</exclude-pattern>
<rule ref="WordPress.Files.FileName">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>tests/</exclude-pattern>
</rule>

<!-- In effect, set the minimum supported version of WordPress to the latest version. -->
<config name="minimum_supported_wp_version" value="99.0"/>
</ruleset>
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a C

## Unreleased

### Changed

- The minimum PHP version is now 8.2.

### Deprecated

- `Used_Post_IDs` class.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The library is oriented toward a declarative style of development that makes use
Install the latest version with:

```bash
$ composer require alleyinteractive/wp-type-extensions
composer require alleyinteractive/wp-type-extensions
```

## Basic usage
Expand Down
110 changes: 61 additions & 49 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,65 @@
{
"name": "alleyinteractive/wp-type-extensions",
"description": "PHP interfaces and implementations for WordPress.",
"type": "library",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Alley",
"email": "info@alley.com"
}
],
"config": {
"allow-plugins": {
"alleyinteractive/composer-wordpress-autoloader": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"name": "alleyinteractive/wp-type-extensions",
"description": "PHP interfaces and implementations for WordPress.",
"license": "GPL-2.0-or-later",
"type": "library",
"authors": [
{
"name": "Alley",
"email": "info@alley.com"
}
],
"require": {
"php": "^8.2",
"alleyinteractive/laminas-validator-extensions": "^2.0",
"alleyinteractive/wp-match-blocks": "^3.0",
"spatie/once": "^3.1"
},
"lock": false
},
"require": {
"php": "^8.1",
"alleyinteractive/laminas-validator-extensions": "^2.0",
"alleyinteractive/wp-match-blocks": "^3.0",
"spatie/once": "^3.1"
},
"require-dev": {
"alleyinteractive/alley-coding-standards": "^1.0.0",
"friendsofphp/php-cs-fixer": "^3.8",
"mantle-framework/testkit": "^0.9",
"szepeviktor/phpstan-wordpress": "^1.1"
},
"autoload-dev": {
"psr-4": {
"Alley\\": "tests/alley/"
}
},
"extra": {
"wordpress-autoloader": {
"autoload": {
"Alley\\": "src/alley/"
},
"autoload-dev": {
"Alley\\": "tests/alley/"
}
"require-dev": {
"alleyinteractive/alley-coding-standards": "^2.0",
"ergebnis/composer-normalize": "^2.44",
"mantle-framework/testkit": "^1.2",
"szepeviktor/phpstan-wordpress": "^1.3"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload-dev": {
"psr-4": {
"Alley\\WP\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"alleyinteractive/composer-wordpress-autoloader": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"ergebnis/composer-normalize": true
},
"lock": false,
"sort-packages": true
},
"extra": {
"wordpress-autoloader": {
"autoload": {
"Alley\\WP\\": "src/"
}
}
},
"scripts": {
"pre-install-cmd": [
"@tidy"
],
"post-install-cmd": [
"@tidy"
],
"phpcbf": "phpcbf",
"phpcs": "phpcs",
"phpstan": "phpstan -v --memory-limit=512M",
"phpunit": "phpunit",
"test": [
"@phpcs",
"@phpstan",
"@phpunit"
],
"tidy": "[ $COMPOSER_DEV_MODE -eq 0 ] || composer normalize"
}
},
"scripts": {
"fixer": "php-cs-fixer -v fix --allow-risky=yes",
"phpcbf": "phpcbf",
"phpcs": "phpcs",
"phpstan": "phpstan --memory-limit=512M",
"phpunit": "phpunit"
}
}
24 changes: 16 additions & 8 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<testsuite name="unit">
<directory suffix=".php">tests/alley/wp/</directory>
</testsuite>
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd"
cacheDirectory=".phpunit.result.cache">
<testsuites>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
<php>
<env name="MANTLE_USE_SQLITE" value="true"/>
<env name="WP_SKIP_DB_CREATE" value="true"/>
</php>
</phpunit>
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 335472c

Please sign in to comment.