Skip to content

Commit 4890b54

Browse files
committed
GH Actions: run tests on Windows
This commit changes both the test.yml and the quicktest.yml workflows to run the tests on Windows as well. Before the tests were executed only on Linux. Installing xmllint on Windows using Chocolatey is a bit slow. We can look into ways on how to make it faster if needed.
1 parent 05b8942 commit 4890b54

File tree

2 files changed

+140
-30
lines changed

2 files changed

+140
-30
lines changed

.github/workflows/quicktest.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,38 @@ concurrency:
1717
jobs:
1818
# Run CI checks/tests which have no dependency on the PHPCS version used.
1919
quicktest-php:
20-
runs-on: ubuntu-latest
20+
runs-on: ${{ matrix.os }}
2121

2222
strategy:
2323
matrix:
24+
os: ['ubuntu-latest', 'windows-latest']
2425
php: ['5.4', 'latest']
2526

26-
name: "QTest + Lint: PHP ${{ matrix.php }}"
27+
name: "QTest + Lint: PHP ${{ matrix.php }} - OS ${{ matrix.os }}"
2728

2829
steps:
30+
- name: Prepare git to leave line endings alone
31+
run: git config --global core.autocrlf input
32+
2933
- name: Checkout code
3034
uses: actions/checkout@v4
3135

3236
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
3337
# This should not be blocking for this job, so ignore any errors from this step.
3438
# Ref: https://github.com/dotnet/core/issues/4167
35-
- name: Update the available packages list
39+
- name: Update the available packages list (Linux)
40+
if: runner.os == 'Linux'
3641
continue-on-error: true
3742
run: sudo apt-get update
3843

39-
- name: Install xmllint
44+
- name: Install xmllint (Linux)
45+
if: runner.os == 'Linux'
4046
run: sudo apt-get install --no-install-recommends -y libxml2-utils
4147

48+
- name: Install xmllint (Windows)
49+
if: runner.os == 'Windows'
50+
run: choco install xsltproc
51+
4252
- name: Install PHP
4353
uses: shivammathur/setup-php@v2
4454
with:
@@ -70,12 +80,14 @@ jobs:
7080

7181
- name: Grab PHPUnit version
7282
id: phpunit_version
83+
shell: bash
7384
# yamllint disable rule:line-length
7485
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
7586
# yamllint enable rule:line-length
7687

7788
- name: Determine PHPUnit composer script to use
7889
id: phpunit_script
90+
shell: bash
7991
run: |
8092
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
8193
echo 'SUFFIX=' >> "$GITHUB_OUTPUT"
@@ -90,29 +102,42 @@ jobs:
90102

91103
# Run CI checks/tests which have a dependency on the PHPCS version used.
92104
quicktest-phpcs:
93-
runs-on: ubuntu-latest
105+
runs-on: ${{ matrix.os }}
94106

95107
strategy:
96108
matrix:
109+
os: ['ubuntu-latest', 'windows-latest']
97110
php: ['5.4', 'latest']
98111
phpcs_version: ['dev-master']
99112

100113
include:
101-
- php: '7.2'
114+
- os: ubuntu-latest
115+
php: '7.2'
116+
phpcs_version: '3.1.0'
117+
- os: windows-latest
118+
php: '7.2'
102119
phpcs_version: '3.1.0'
103-
- php: '5.4'
120+
- os: ubuntu-latest
121+
php: '5.4'
122+
phpcs_version: '3.1.0'
123+
- os: windows-latest
124+
php: '5.4'
104125
phpcs_version: '3.1.0'
105126

106-
name: "QTest: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
127+
name: "QTest: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }} - OS ${{ matrix.os }}"
107128

108129
steps:
130+
- name: Prepare git to leave line endings alone
131+
run: git config --global core.autocrlf input
132+
109133
- name: Checkout code
110134
uses: actions/checkout@v4
111135

112136
# On stable PHPCS versions, allow for PHP deprecation notices.
113137
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
114138
- name: Setup ini config
115139
id: set_ini
140+
shell: bash
116141
run: |
117142
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
118143
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
@@ -144,12 +169,14 @@ jobs:
144169

145170
- name: Grab PHPUnit version
146171
id: phpunit_version
172+
shell: bash
147173
# yamllint disable rule:line-length
148174
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
149175
# yamllint enable rule:line-length
150176

151177
- name: Determine PHPUnit composer script to use
152178
id: phpunit_script
179+
shell: bash
153180
run: |
154181
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
155182
echo 'SUFFIX=' >> "$GITHUB_OUTPUT"

.github/workflows/test.yml

Lines changed: 105 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,40 @@ concurrency:
1818
jobs:
1919
# Run CI checks/tests which have no dependency on the PHPCS version used.
2020
test-php:
21-
runs-on: ubuntu-latest
21+
runs-on: ${{ matrix.os }}
2222

2323
strategy:
2424
matrix:
25+
os: ['ubuntu-latest', 'windows-latest']
2526
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
2627

27-
name: "Test + Lint: PHP ${{ matrix.php }}"
28+
name: "Test + Lint: PHP ${{ matrix.php }} - OS ${{ matrix.os }}"
2829

2930
continue-on-error: ${{ matrix.php == '8.5' }}
3031

3132
steps:
33+
- name: Prepare git to leave line endings alone
34+
run: git config --global core.autocrlf input
35+
3236
- name: Checkout code
3337
uses: actions/checkout@v4
3438

3539
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
3640
# This should not be blocking for this job, so ignore any errors from this step.
3741
# Ref: https://github.com/dotnet/core/issues/4167
38-
- name: Update the available packages list
42+
- name: Update the available packages list (Linux)
43+
if: runner.os == 'Linux'
3944
continue-on-error: true
4045
run: sudo apt-get update
4146

42-
- name: Install xmllint
47+
- name: Install xmllint (Linux)
48+
if: runner.os == 'Linux'
4349
run: sudo apt-get install --no-install-recommends -y libxml2-utils
4450

51+
- name: Install xmllint (Windows)
52+
if: runner.os == 'Windows'
53+
run: choco install xsltproc
54+
4555
- name: Install PHP
4656
uses: shivammathur/setup-php@v2
4757
with:
@@ -75,12 +85,14 @@ jobs:
7585

7686
- name: Grab PHPUnit version
7787
id: phpunit_version
88+
shell: bash
7889
# yamllint disable rule:line-length
7990
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
8091
# yamllint enable rule:line-length
8192

8293
- name: Determine PHPUnit composer script to use
8394
id: phpunit_script
95+
shell: bash
8496
run: |
8597
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
8698
echo 'SUFFIX=' >> "$GITHUB_OUTPUT"
@@ -95,7 +107,7 @@ jobs:
95107

96108
# Run CI checks/tests which have a dependency on the PHPCS version used.
97109
test-phpcs:
98-
runs-on: ubuntu-latest
110+
runs-on: ${{ matrix.os }}
99111

100112
strategy:
101113
# Keys:
@@ -110,63 +122,132 @@ jobs:
110122
# - PHP 8.2 needs PHPCS 3.6.1+ to run without errors.
111123
# - PHP 8.3 needs PHPCS 3.8.0+ to run without errors (though the errors don't affect this package).
112124
# - PHP 8.4 needs PHPCS 3.8.0+ to run without errors (officially 3.11.0, but 3.8.0 will work fine).
125+
os: ['ubuntu-latest', 'windows-latest']
113126
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2']
114127
phpcs_version: ['3.1.0', 'dev-master']
115128

116129
include:
117130
# Complete the matrix, while preventing issues with PHPCS versions incompatible with certain PHP versions.
118-
- php: '7.3'
131+
- os: ubuntu-latest
132+
php: '7.3'
119133
phpcs_version: 'dev-master'
120-
- php: '7.3'
134+
- os: ubuntu-latest
135+
php: '7.3'
136+
phpcs_version: '3.3.1'
137+
- os: windows-latest
138+
php: '7.3'
139+
phpcs_version: 'dev-master'
140+
- os: windows-latest
141+
php: '7.3'
121142
phpcs_version: '3.3.1'
122143

123-
- php: '7.4'
144+
- os: ubuntu-latest
145+
php: '7.4'
146+
phpcs_version: 'dev-master'
147+
- os: ubuntu-latest
148+
php: '7.4'
149+
phpcs_version: '3.5.0'
150+
- os: windows-latest
151+
php: '7.4'
124152
phpcs_version: 'dev-master'
125-
- php: '7.4'
153+
- os: windows-latest
154+
php: '7.4'
126155
phpcs_version: '3.5.0'
127156

128-
- php: '8.0'
157+
- os: ubuntu-latest
158+
php: '8.0'
159+
phpcs_version: 'dev-master'
160+
- os: ubuntu-latest
161+
php: '8.0'
162+
phpcs_version: '3.5.7'
163+
- os: windows-latest
164+
php: '8.0'
129165
phpcs_version: 'dev-master'
130-
- php: '8.0'
166+
- os: windows-latest
167+
php: '8.0'
131168
phpcs_version: '3.5.7'
132169

133-
- php: '8.1'
170+
- os: ubuntu-latest
171+
php: '8.1'
172+
phpcs_version: 'dev-master'
173+
- os: ubuntu-latest
174+
php: '8.1'
175+
phpcs_version: '3.6.1'
176+
- os: windows-latest
177+
php: '8.1'
134178
phpcs_version: 'dev-master'
135-
- php: '8.1'
179+
- os: windows-latest
180+
php: '8.1'
136181
phpcs_version: '3.6.1'
137182

138-
- php: '8.2'
183+
- os: ubuntu-latest
184+
php: '8.2'
139185
phpcs_version: 'dev-master'
140-
- php: '8.2'
186+
- os: ubuntu-latest
187+
php: '8.2'
188+
phpcs_version: '3.6.1'
189+
- os: windows-latest
190+
php: '8.2'
191+
phpcs_version: 'dev-master'
192+
- os: windows-latest
193+
php: '8.2'
141194
phpcs_version: '3.6.1'
142195

143-
- php: '8.3'
196+
- os: ubuntu-latest
197+
php: '8.3'
144198
phpcs_version: 'dev-master'
145-
- php: '8.3'
199+
- os: ubuntu-latest
200+
php: '8.3'
201+
phpcs_version: '3.8.0'
202+
- os: windows-latest
203+
php: '8.3'
204+
phpcs_version: 'dev-master'
205+
- os: windows-latest
206+
php: '8.3'
146207
phpcs_version: '3.8.0'
147208

148-
- php: '8.4'
209+
- os: ubuntu-latest
210+
php: '8.4'
149211
phpcs_version: 'dev-master'
150-
- php: '8.4'
212+
- os: ubuntu-latest
213+
php: '8.4'
214+
phpcs_version: '3.8.0'
215+
- os: windows-latest
216+
php: '8.4'
217+
phpcs_version: 'dev-master'
218+
- os: windows-latest
219+
php: '8.4'
151220
phpcs_version: '3.8.0'
152221

153222
# Experimental builds. These are allowed to fail.
154-
- php: '7.4'
223+
- os: ubuntu-latest
224+
php: '7.4'
225+
phpcs_version: '4.0.x-dev'
226+
- os: windows-latest
227+
php: '7.4'
155228
phpcs_version: '4.0.x-dev'
156229

157-
- php: '8.5' # Nightly.
230+
- os: ubuntu-latest
231+
php: '8.5' # Nightly.
232+
phpcs_version: 'dev-master'
233+
- os: windows-latest
234+
php: '8.5' # Nightly.
158235
phpcs_version: 'dev-master'
159236

160-
name: "Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
237+
name: "Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }} - OS ${{ matrix.os }}"
161238

162239
continue-on-error: ${{ matrix.php == '8.5' || matrix.phpcs_version == '4.0.x-dev' }}
163240

164241
steps:
242+
- name: Prepare git to leave line endings alone
243+
run: git config --global core.autocrlf input
244+
165245
- name: Checkout code
166246
uses: actions/checkout@v4
167247

168248
- name: Setup ini config
169249
id: set_ini
250+
shell: bash
170251
run: |
171252
# On stable PHPCS versions, allow for PHP deprecation notices.
172253
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
@@ -201,12 +282,14 @@ jobs:
201282

202283
- name: Grab PHPUnit version
203284
id: phpunit_version
285+
shell: bash
204286
# yamllint disable rule:line-length
205287
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
206288
# yamllint enable rule:line-length
207289

208290
- name: Determine PHPUnit composer script to use
209291
id: phpunit_script
292+
shell: bash
210293
run: |
211294
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
212295
echo 'SUFFIX=' >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)