Skip to content
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
21 changes: 21 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Run PHPStan and comment on the pull request with any issues.
#
# This file is managed in https://github.com/happyprime/projects
name: PHPStan (Default, PHP 8.3)

on: pull_request

# The GITHUB_TOKEN used by Dependabot has read-only permissions by default. We
# provide write permissions to this workflow so that comments can be left on
# the pull request.
#
# @see https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#changing-github_token-permissions
permissions:
contents: read
pull-requests: write

jobs:
call-workflow:
uses: happyprime/workflows/.github/workflows/phpstan.yml@trunk
with:
php-version: '8.3'
71 changes: 5 additions & 66 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Run PHPUnit.
#
# This file is managed in https://github.com/happyprime/projects
name: PHPUnit

on:
Expand All @@ -9,69 +12,5 @@ on:
- trunk

jobs:
phpunit:
name: PHPUnit (PHP ${{ matrix.php }} with WordPress ${{ matrix.wordpress }})
runs-on: ubuntu-latest

services:
mysql:
image: mysql:5.7
ports:
- 3306/tcp
env:
MYSQL_ROOT_PASSWORD: password
# Set health checks to wait until mysql has started
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3

continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.2']
wordpress: ['latest']
experimental: [false]
include:
- php: '8.3'
wordpress: 'trunk'
experimental: true

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: mysqli
tools: composer, cs2pr

- name: Install WordPress test setup
env:
WP_VERSION: ${{ matrix.wordpress }}
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
run: bash bin/install-wp-tests.sh wordpress_test root password "127.0.0.1:$MYSQL_PORT" "$WP_VERSION"

- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Setup cache
uses: pat-s/always-upload-cache@v3.0.11
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --no-scripts

- name: Run tests
run: composer phpunit
call-workflow:
uses: happyprime/workflows/.github/workflows/phpunit.yml@trunk
18 changes: 18 additions & 0 deletions .github/workflows/plugin-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Run WP.org's plugin check.
#
# This file is managed in https://github.com/happyprime/projects
name: WP.org Plugin Check

on:
push:
branches:
- trunk
pull_request:
branches:
- trunk

jobs:
call-workflow:
uses: happyprime/workflows/.github/workflows/plugin-check.yml@trunk
with:
php-version: '8.3'
5 changes: 2 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ includes:
- %rootDir%/../../happyprime/coding-standards/phpstan.neon.dist

parameters:
level: 6
level: 5
ignoreErrors:
-
identifier: missingType.generics
- '#Parameter \#1 \$postarr of function wp_update_post expects array\{ID\?\: int, post_author\?\: int, post_date\?\: string, post_date_gmt\?\: string, post_content\?\: string, post_content_filtered\?\: string, post_title\?\: string, post_excerpt\?\: string, \.\.\.\}, WP_Post\|null given\.#'
2 changes: 2 additions & 0 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Plugin URI: https://github.com/happyprime/shadow-terms/
* Author: Happy Prime
* Author URI: https://happyprime.co
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* Text Domain: shadow-terms
* Requires PHP: 7.4
*
Expand Down