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
53 changes: 53 additions & 0 deletions .github/actions/setup-php-composer/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'Setup PHP and Composer'
description: 'Setup PHP and install Composer dependencies with caching'

inputs:
php-version:
description: 'PHP version to use'
required: false
default: '8.3'
coverage:
description: 'Coverage driver to use (none, xdebug, pcov)'
required: false
default: 'none'
stability:
description: 'Composer stability preference (prefer-stable, prefer-lowest)'
required: false
default: 'prefer-stable'
extensions:
description: 'PHP extensions to install'
required: false
default: 'dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo'

runs:
using: 'composite'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
coverage: ${{ inputs.coverage }}
extensions: ${{ inputs.extensions }}

- name: Get Composer Cache Directory
id: composer-cache
shell: bash
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ inputs.stability }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ inputs.stability }}-

- name: Install dependencies
shell: bash
run: |
if [ "${{ inputs.stability }}" = "prefer-lowest" ]; then
composer update --prefer-lowest --prefer-dist --no-interaction --no-progress
else
composer install --prefer-dist --no-interaction --no-progress
fi

2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ updates:
labels:
- "dependencies"
- "composer"
versioning-strategy: "widen"
versioning-strategy: "increase-if-necessary"
open-pull-requests-limit: 5

- package-ecosystem: "github-actions"
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,18 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Setup PHP and Composer
uses: ./.github/actions/setup-php-composer
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: pcov
stability: ${{ matrix.stability }}

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Execute tests with mutation
if: ${{ matrix.os == 'ubuntu-latest' }}
run: vendor/bin/pest --colors=always --mutate --parallel --min=80
Expand Down
64 changes: 28 additions & 36 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo

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

- name: Cache Composer dependencies
uses: actions/cache@v5
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 --prefer-dist --no-interaction --no-progress
- name: Setup PHP and Composer
uses: ./.github/actions/setup-php-composer

- name: Cache phpstan results
uses: actions/cache@v5
Expand All @@ -56,26 +38,36 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
- name: Setup PHP and Composer
uses: ./.github/actions/setup-php-composer

- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Check type coverage
run: vendor/bin/pest --type-coverage --min=100

- name: Cache Composer dependencies
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup PHP and Composer
uses: ./.github/actions/setup-php-composer

- name: Cache rector results
uses: actions/cache@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
path: /tmp/rector
key: "rector-cache-${{ github.run_id }}" # always write a new cache
restore-keys: |
${{ runner.os }}-composer-
rector-cache-

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Cache ecs results
uses: actions/cache@v5
with:
path: /tmp/ecs
key: "ecs-cache-${{ github.run_id }}" # always write a new cache
restore-keys: |
ecs-cache-

- name: Check type coverage
run: vendor/bin/pest --type-coverage --min=100
- name: Run format checks
run: composer format --no-progress-bar
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ This package supports multiple JSON Schema specification versions with automatic

### Supported Versions

- **Draft-07** (2018) - Default version for maximum compatibility
- **Draft 2020-12** - (Default) Latest version with `prefixItems`, dynamic references, and format vocabularies
- **Draft 2019-09** - Adds advanced features like `$defs`, `unevaluatedProperties`, `deprecated`
- **Draft 2020-12** - Latest version with `prefixItems`, dynamic references, and format vocabularies
- **Draft-07** (2018) - Legacy version for maximum compatibility

## Requirements

Expand Down