@@ -3,23 +3,54 @@ name: Code style
3
3
on : [push, pull_request]
4
4
5
5
permissions :
6
- contents : read
6
+ contents : read # Allows checkout
7
7
8
8
jobs :
9
9
phpcs :
10
10
name : PHPCS
11
11
runs-on : ubuntu-latest
12
12
steps :
13
- - name : Checkout
14
- uses : actions/checkout@v3
13
+ - name : Checkout code
14
+ uses : actions/checkout@v4 # Use latest major version
15
15
16
16
- name : Setup PHP
17
17
uses : shivammathur/setup-php@v2
18
18
with :
19
19
php-version : ' 8.2'
20
+ extensions : mbstring, xml # Add common extensions often needed by linters/tools
21
+ tools : composer:v2 # Optionally specify composer version
22
+ env :
23
+ COMPOSER_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Recommended for private repos or hitting rate limits
24
+
25
+ - name : Get Composer Cache Directory
26
+ id : composer-cache
27
+ run : |
28
+ echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
29
+
30
+ - name : Cache Composer dependencies
31
+ uses : actions/cache@v4 # Use latest major version
32
+ with :
33
+ path : ${{ steps.composer-cache.outputs.dir }}
34
+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
35
+ restore-keys : |
36
+ ${{ runner.os }}-composer-
20
37
21
38
- name : Install dependencies
22
- run : composer update --prefer-dist --no-progress --no-suggest
39
+ run : composer install --prefer-dist --no-progress --no-interaction # Use install, add --no-interaction for CI
40
+
41
+ # --- IMPORTANT ---
42
+ # Choose ONE of the following 'Run PHPCS' steps based on your project setup:
43
+
44
+ # Option 1: If you have a phpcs.xml or phpcs.xml.dist file in your root
45
+ - name : Run PHPCS (using config file)
46
+ run : vendor/bin/phpcs --standard=phpcs.xml.dist # Or phpcs.xml if that's your filename
47
+ # Optional: Specify paths explicitly if needed:
48
+ # run: vendor/bin/phpcs --standard=phpcs.xml.dist ./src ./tests
49
+
50
+ # Option 2: If you DON'T have a config file and want to use a standard (e.g., PSR12)
51
+ # - name: Run PHPCS (using PSR12 standard)
52
+ # run: vendor/bin/phpcs --standard=PSR12 ./src ./tests # Adjust paths (./src ./tests) as needed!
23
53
24
- - name : Run script
25
- run : vendor/bin/phpcs
54
+ # Option 3: Most basic run (relies heavily on defaults - least recommended)
55
+ # - name: Run PHPCS (basic)
56
+ # run: vendor/bin/phpcs
0 commit comments