64
64
#
65
65
# The matrix is set up so as not to duplicate the builds which are run for code coverage.
66
66
php : ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
67
- phpcs_version : ["4.x-dev"]
67
+ phpcs_version : ["lowest", "stable", " 4.x-dev"]
68
68
69
- name : " Test: PHP ${{ matrix.php }}"
69
+ exclude :
70
+ - php : " 8.3"
71
+ phpcs_version : " lowest"
72
+
73
+ include :
74
+ # Add some builds with variations of the dependency versions.
75
+ - php : " 8.4"
76
+ phpcs_version : " stable"
77
+
78
+ # Test against dev versions of all dependencies with select PHP versions for early detection of issues.
79
+ - php : " 7.2"
80
+ phpcs_version : " dev-master"
81
+ - php : " 7.2"
82
+ phpcs_version : " 4.x-dev"
83
+ - php : " 7.4"
84
+ phpcs_version : " 4.x-dev"
85
+ - php : " 8.2"
86
+ phpcs_version : " 4.x-dev"
87
+
88
+ name : " Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
70
89
71
90
steps :
72
91
- name : Checkout code
@@ -90,6 +109,14 @@ jobs:
90
109
ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
91
110
coverage : none
92
111
112
+ - name : " Composer: set PHPCS version for tests (dev/specific version)"
113
+ if : ${{ matrix.phpcs_version != 'lowest' && matrix.phpcs_version != 'stable' }}
114
+ run : composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
115
+
116
+ - name : " Composer: use lock file when necessary"
117
+ if : ${{ matrix.phpcs_version == 'lowest' }}
118
+ run : composer config --unset lock
119
+
93
120
# Install dependencies and handle caching in one go.
94
121
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
95
122
- name : Install Composer dependencies
@@ -98,29 +125,25 @@ jobs:
98
125
# Bust the cache at least once a month - output format: YYYY-MM.
99
126
custom-cache-suffix : $(date -u "+%Y-%m")
100
127
128
+ - name : " Composer: set PHPCS version for tests (lowest)"
129
+ if : ${{ matrix.phpcs_version == 'lowest' }}
130
+ run : composer update squizlabs/php_codesniffer --prefer-lowest --no-scripts --no-interaction
131
+
101
132
- name : Composer info
102
133
run : composer info
103
134
104
- - name : Grab PHPUnit version
105
- id : phpunit_version
106
- run : echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
135
+ - name : Grab PHPCS version
136
+ id : phpcs_version
137
+ # yamllint disable-line rule:line-length
138
+ run : echo "VERSION=$(vendor/bin/phpcs --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
107
139
108
- - name : " DEBUG: Show grabbed PHPUnit version"
109
- run : echo ${{ steps.phpunit_version .outputs.VERSION }}
140
+ - name : " DEBUG: Show grabbed PHPCS version"
141
+ run : echo ${{ steps.phpcs_version .outputs.VERSION }}
110
142
111
- - name : Determine PHPUnit config file to use
112
- id : phpunit_config
113
- shell : bash
114
- run : |
115
- if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
116
- echo 'FILE=phpunit.xml' >> "$GITHUB_OUTPUT"
117
- elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
118
- echo 'FILE=phpunit.xml' >> "$GITHUB_OUTPUT"
119
- else
120
- echo 'FILE=phpunit-lte9.xml' >> "$GITHUB_OUTPUT"
121
- fi
143
+ - name : Run the unit tests (PHPCS 3.x)
144
+ if : ${{ startsWith( steps.phpcs_version.outputs.VERSION, '3.' ) }}
145
+ run : composer test-phpcs3
122
146
123
- - name : Run the unit tests
124
- run : composer test -- -c ${{ steps.phpunit_config.outputs.FILE }}
125
- env :
126
- PHPCS_VERSION : ${{ matrix.phpcs_version }}
147
+ - name : Run the unit tests (PHPCS 4.x)
148
+ if : ${{ startsWith( steps.phpcs_version.outputs.VERSION, '4.' ) }}
149
+ run : composer test-phpcs4
0 commit comments