|  | 
|  | 1 | +name: run-phpstan-pull | 
|  | 2 | + | 
|  | 3 | +on: | 
|  | 4 | +  pull_request: | 
|  | 5 | +    branches: | 
|  | 6 | +      - 'master' | 
|  | 7 | +      - 'development' | 
|  | 8 | + | 
|  | 9 | +jobs: | 
|  | 10 | +  test: | 
|  | 11 | +    runs-on: ${{ matrix.os }} | 
|  | 12 | +    strategy: | 
|  | 13 | +      fail-fast: true | 
|  | 14 | +      matrix: | 
|  | 15 | +        os: [ubuntu-latest] | 
|  | 16 | +        php: [8.3] | 
|  | 17 | +        laravel: [11] | 
|  | 18 | +        stability: [prefer-dist] | 
|  | 19 | + | 
|  | 20 | +    name: PHPStan - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} | 
|  | 21 | +    env: | 
|  | 22 | +      extensionKey: phpextensions | 
|  | 23 | +      extensions: dom, curl, libxml, mbstring, zip, pcntl, pcov, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | 
|  | 24 | + | 
|  | 25 | +    steps: | 
|  | 26 | +      - name: Checkout code | 
|  | 27 | +        uses: actions/checkout@v4 | 
|  | 28 | + | 
|  | 29 | +      - name: Setup cache environment | 
|  | 30 | +        id: extcache | 
|  | 31 | +        uses: shivammathur/cache-extensions@v1 | 
|  | 32 | +        with: | 
|  | 33 | +          php-version: ${{ matrix.php }} | 
|  | 34 | +          extensions: ${{ env.extensions }} | 
|  | 35 | +          key: ${{ env.extensionKey }} | 
|  | 36 | + | 
|  | 37 | +      - name: Cache extensions | 
|  | 38 | +        uses: actions/cache@v4 | 
|  | 39 | +        with: | 
|  | 40 | +          path: ${{ steps.extcache.outputs.dir }} | 
|  | 41 | +          key: ${{ steps.extcache.outputs.key }} | 
|  | 42 | +          restore-keys: ${{ steps.extcache.outputs.key }} | 
|  | 43 | + | 
|  | 44 | +      - name: Setup PHP | 
|  | 45 | +        uses: shivammathur/setup-php@v2 | 
|  | 46 | +        with: | 
|  | 47 | +          php-version: ${{ matrix.php }} | 
|  | 48 | +          extensions: ${{ env.extensions }} | 
|  | 49 | +          coverage: pcov | 
|  | 50 | +          tools: phpunit:9.5 | 
|  | 51 | +        env: | 
|  | 52 | +          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | 
|  | 53 | + | 
|  | 54 | +      - name: Setup problem matchers for PHP | 
|  | 55 | +        run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | 
|  | 56 | +           | 
|  | 57 | +      - name: Get composer cache directory | 
|  | 58 | +        id: composer-cache | 
|  | 59 | +        run: | | 
|  | 60 | +          echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | 
|  | 61 | +
 | 
|  | 62 | +      - uses: actions/cache@v4 | 
|  | 63 | +        with: | 
|  | 64 | +          path: ${{ steps.composer-cache.outputs.dir }} | 
|  | 65 | +          key: ${{ runner.os }}-PHPStan-P${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }} | 
|  | 66 | +          restore-keys: ${{ runner.os }}-PHPStan-P${{ matrix.php }}-L${{ matrix.laravel }}-composer- | 
|  | 67 | + | 
|  | 68 | +      - name: Add token | 
|  | 69 | +        run: | | 
|  | 70 | +          composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} | 
|  | 71 | +           | 
|  | 72 | +      - name: Install dependencies | 
|  | 73 | +        if: steps.composer-cache.outputs.cache-hit != 'true' | 
|  | 74 | +        run: composer require "laravel/framework:${{ matrix.laravel }}.*" --no-interaction --no-update | 
|  | 75 | + | 
|  | 76 | +      - name: Update dependencies | 
|  | 77 | +        if: steps.composer-cache.outputs.cache-hit != 'true' | 
|  | 78 | +        run: composer update --${{ matrix.stability }} --no-interaction | 
|  | 79 | + | 
|  | 80 | +      - name: Install PHPStan | 
|  | 81 | +        run: composer require larastan/larastan:^2.0 --dev --no-interaction | 
|  | 82 | + | 
|  | 83 | +      - name: Cache Larastan result cache | 
|  | 84 | +        uses: actions/cache@v4 | 
|  | 85 | +        with: | 
|  | 86 | +          path: .phpstan.cache | 
|  | 87 | +          key: ${{ github.run_id }}-phpstan-result-cache | 
|  | 88 | +          restore-keys: phpstan-result-cache- | 
|  | 89 | + | 
|  | 90 | +      - name: Run PHPStan Tests | 
|  | 91 | +        run: ./vendor/bin/phpstan analyse | 
0 commit comments