@@ -17,12 +17,11 @@ jobs:
1717 fail-fast : false
1818 matrix :
1919 os : [ubuntu-latest, macos-latest]
20- php : [8.0 ,8.1 ,8.2, 8.3, 8.4]
21-
20+ php : [8.0 ,8.1 ,8.2, 8.3]
2221 steps :
2322 - uses : actions/checkout@v4
2423
25- # Setup PHP for Linux
24+ # PHP installation and setup using built-in tools
2625 - name : Setup PHP (Ubuntu)
2726 if : matrix.os == 'ubuntu-latest'
2827 run : |
3231 php -v
3332 shell : bash
3433
35- # Setup PHP for macOS
3634 - name : Setup PHP (macOS)
3735 if : matrix.os == 'macos-latest'
3836 run : |
4139 php -v
4240 shell : bash
4341
44-
4542 - name : Get Composer Cache Directory
4643 id : composer-cache
47- run : echo "dir=$(wsl composer config cache-files-dir)" >> $GITHUB_OUTPUT
44+ run : echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
4845 shell : bash
4946
5047 - name : Cache Composer packages
5552 restore-keys : |
5653 ${{ runner.os }}-composer-
5754
58- # Install dependencies
59- - name : Install dependencies (Windows via WSL)
60- if : matrix.os == 'windows-latest'
61- run : wsl composer install --prefer-dist --no-progress
62- shell : pwsh
63-
64- - name : Install dependencies (Unix)
65- if : matrix.os != 'windows-latest'
66- run : composer install --prefer-dist --no-progress
67- shell : bash
6855
69- # Run tests
70- - name : Run test suite (Windows via WSL)
71- if : matrix.os == 'windows-latest'
72- run : wsl vendor/bin/phpunit
73- shell : pwsh
7456
75- - name : Run test suite (Unix)
76- if : matrix.os != 'windows-latest'
57+ - name : Run test suite
7758 run : vendor/bin/phpunit
7859 shell : bash
7960
10081 run : |
10182 sudo add-apt-repository ppa:ondrej/php
10283 sudo apt-get update
103- sudo apt install -y php8.2 php8.2 -cli php8.2 -xml php8.2 -mbstring
84+ sudo apt-get install -y php${{ matrix.php }} php${{ matrix.php }} -cli php${{ matrix.php }} -xml php${{ matrix.php }} -mbstring
10485 shell : bash
10586
10687 - name : Install Composer
@@ -111,14 +92,44 @@ jobs:
11192 sudo chown -R $USER:$USER ~/.composer
11293 shell : bash
11394
95+ - name : Get Composer Cache Directory
96+ id : composer-cache
97+ run : echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
98+
99+ - name : Cache Composer packages
100+ uses : actions/cache@v3
101+ with :
102+ path : ${{ steps.composer-cache.outputs.dir }}
103+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
104+ restore-keys : |
105+ ${{ runner.os }}-composer-
106+
114107 - name : Install Dependencies
115108 run : |
116109 composer install --prefer-dist --no-progress
117110 composer require --dev phpstan/phpstan --with-all-dependencies
118111 shell : bash
119112
113+ - name : Create PHPStan config
114+ run : |
115+ echo '
116+ parameters:
117+ level: 5
118+ paths:
119+ - src
120+ - tests
121+ excludePaths:
122+ - vendor/*
123+ ' > phpstan.neon
124+
120125 - name : Run PHPStan
121- run : vendor/bin/phpstan analyse --level=5 src tests
126+ run : |
127+ if [ -f "vendor/bin/phpstan" ]; then
128+ vendor/bin/phpstan analyse -c phpstan.neon
129+ else
130+ echo "PHPStan not found in vendor/bin"
131+ exit 1
132+ fi
122133 shell : bash
123134
124135 code-style :
@@ -134,7 +145,7 @@ jobs:
134145 run : |
135146 sudo add-apt-repository ppa:ondrej/php
136147 sudo apt-get update
137- sudo apt install -y php8.2 php8.2 -cli php8.2 -xml php8.2 -mbstring
148+ sudo apt-get install -y php${{ matrix.php }} php${{ matrix.php }} -cli php${{ matrix.php }} -xml php${{ matrix.php }} -mbstring
138149 shell : bash
139150
140151 - name : Install Composer
@@ -145,6 +156,18 @@ jobs:
145156 sudo chown -R $USER:$USER ~/.composer
146157 shell : bash
147158
159+ - name : Get Composer Cache Directory
160+ id : composer-cache
161+ run : echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
162+
163+ - name : Cache Composer packages
164+ uses : actions/cache@v3
165+ with :
166+ path : ${{ steps.composer-cache.outputs.dir }}
167+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
168+ restore-keys : |
169+ ${{ runner.os }}-composer-
170+
148171 - name : Install Dependencies
149172 run : |
150173 composer install --prefer-dist --no-progress
@@ -167,8 +190,6 @@ jobs:
167190 ->in(__DIR__)
168191 );
169192 " > .php-cs-fixer.php
170- shell : bash
171193
172194 - name : Check coding standards
173- run : vendor/bin/php-cs-fixer fix --dry-run --diff
174- shell : bash
195+ run : vendor/bin/php-cs-fixer fix --dry-run --diff
0 commit comments