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