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
52 changes: 38 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: tests
name: Tests

on:
push:
branches:
- master
- main
pull_request:
branches:
- master

jobs:
build:
phpcs:
name: Coding Standards (PHPCS)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -22,20 +21,45 @@ jobs:
- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: PHPCS
run: composer phpcs

phpstan:
name: Static Analysis (PHPStan)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
php-version: '8.3'

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: PHPStan
run: composer phpstan

phpunit:
name: Unit Tests (PHPUnit)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run test suite
run: composer run-script test
- name: PHPUnit
run: composer phpunit

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
19 changes: 13 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,26 @@
},
"require-dev": {
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "3.*"
"squizlabs/php_codesniffer": "3.*",
"phpstan/phpstan": "^2.1",
"szepeviktor/phpstan-wordpress": "^2.0",
"phpstan/extension-installer": "^1.4"
},
"autoload": {
"psr-4": {
"PostTypes\\": "src/"
}
},
"scripts": {
"test": [
"./vendor/bin/phpcs --standard=psr2 src",
"./vendor/bin/phpunit --coverage-clover=coverage.xml"
]
"phpcs": "phpcs --standard=psr2 src",
"phpunit": "phpunit --coverage-clover=coverage.xml",
"phpstan": "phpstan analyse --memory-limit=512M"
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}
Loading