Skip to content
Merged
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
79 changes: 38 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ See [action.yml](action.yml) and the underlying script [`typisttech/php-matrix`]
## Examples

<details open>
<summary>Run tests against all supported PHP minor versions.</summary>
<summary>Run tests against all supported PHP versions.</summary>

```yaml
name: Test
Expand All @@ -124,7 +124,11 @@ jobs:
outputs:
versions: ${{ steps.php-matrix.outputs.versions }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
sparse-checkout: composer.json
sparse-checkout-cone-mode: false

- uses: typisttech/php-matrix-action@v2
id: php-matrix

Expand All @@ -133,52 +137,49 @@ jobs:
needs: php-matrix
strategy:
matrix:
php: ${{ fromJSON(needs.php-matrix.outputs.versions) }}
php-version: ${{ fromJSON(needs.php-matrix.outputs.versions) }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
php-version: ${{ matrix.php-version }}
- run: composer install
- run: composer test
```

</details>

<details>
<summary>Run `phpstan` with the lowest supported PHP minor version.</summary>
<summary>Run tests on the highest supported PHP version only.</summary>

```yaml
name: PHPStan
name: Test

on:
push:

jobs:
phpstan:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: typisttech/php-matrix-action@v2
id: php-matrix

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ steps.php-matrix.outputs.lowest }}
php-version: ${{ steps.php-matrix.outputs.highest }}

- run: composer install

- run: vendor/bin/phpstan analyse src
- run: composer test
```

</details>

<details>
<summary>Run tests with coverage.</summary>
<summary>Run `$ composer audit` against all supported PHP versions.</summary>

```yaml
name: Test
name: Composer Audit

on:
push:
Expand All @@ -189,52 +190,48 @@ jobs:
outputs:
versions: ${{ steps.php-matrix.outputs.versions }}
highest: ${{ steps.php-matrix.outputs.highest }}
lowest: ${{ steps.php-matrix.outputs.lowest }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
sparse-checkout: composer.json
sparse-checkout-cone-mode: false

- uses: typisttech/php-matrix-action@v2
id: php-matrix

test:
runs-on: ubuntu-latest
composer-audit:
needs: php-matrix
runs-on: ubuntu-latest
strategy:
matrix:
php: ${{ fromJSON(needs.php-matrix.outputs.versions) }}
dependency-versions: [lowest, highest]
coverage: [none]
exclude:
- php: ${{ needs.php-matrix.outputs.highest }}
dependency-versions: highest
coverage: none
php-version: ${{ fromJSON(needs.php-matrix.outputs.versions) }}
dependency-versions: [highest]
include:
- php: ${{ needs.php-matrix.outputs.highest }}
dependency-versions: highest
coverage: xdebug
- php-version: ${{ needs.php-matrix.outputs.lowest }}
dependency-versions: lowest
- php-version: ${{ needs.php-matrix.outputs.highest }}
dependency-versions: locked
env:
COMPOSER_NO_AUDIT: 1
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
sparse-checkout: |
composer.json
composer.lock
sparse-checkout-cone-mode: false

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

php-version: ${{ matrix.php-version }}
coverage: none
- uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependency-versions }}

- run: composer test:with-coverage
if: ${{ matrix.coverage == 'xdebug' }}

- run: composer test:without-coverage
if: ${{ matrix.coverage != 'xdebug' }}
- run: composer audit
```

</details>

## Credits
Expand Down
Loading