diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..191b169 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -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' diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 98ab66b..00080ff 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -1,3 +1,6 @@ +# Run PHPUnit. +# +# This file is managed in https://github.com/happyprime/projects name: PHPUnit on: @@ -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 diff --git a/.github/workflows/plugin-check.yml b/.github/workflows/plugin-check.yml new file mode 100644 index 0000000..ebe58c3 --- /dev/null +++ b/.github/workflows/plugin-check.yml @@ -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' diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 0dde24e..2b21d5f 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -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\.#' diff --git a/plugin.php b/plugin.php index 6136e2b..9b7f8af 100644 --- a/plugin.php +++ b/plugin.php @@ -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 *