Lock down workflows

This commit is contained in:
Dan Harrin
2026-05-12 10:04:04 +01:00
parent 2f3999e057
commit 32ae49ddca
8 changed files with 148 additions and 82 deletions

View File

@@ -1,26 +1,64 @@
name: PHPStan
name: phpstan
on:
push:
paths:
- '**.php'
- 'phpstan.neon.dist'
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [8.4, 8.3, 8.2]
laravel: [12.*, 11.*]
stability: [prefer-stable]
include:
- laravel: 12.*
testbench: 10.*
- laravel: 11.*
testbench: 9.*
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Cache Composer dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.composer/cache/files
key: composer-${{ matrix.php }}-${{ matrix.laravel }}-${{ hashFiles('composer.json') }}
restore-keys: |
composer-${{ matrix.php }}-${{ matrix.laravel }}-
composer-${{ matrix.php }}-
- name: Cache PHPStan result
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: /tmp/phpstan
key: phpstan-${{ matrix.php }}-${{ matrix.laravel }}-${{ github.sha }}
restore-keys: |
phpstan-${{ matrix.php }}-${{ matrix.laravel }}-
- name: Setup PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
with:
php-version: '8.2'
php-version: ${{ matrix.php }}
extensions: mbstring, pdo, pdo_sqlite
coverage: none
- name: Install composer dependencies
uses: ramsey/composer-install@v3
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github