Skip to content

Commit 4bb275f

Browse files
authored
GH Actions: run DevTools tests on Windows (#180)
This commit changes both the test.yml and the quicktest.yml workflows to run the test-php and quicktest-php jobs (DevTools 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 b7ffb7c commit 4bb275f

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

.github/workflows/quicktest.yml

Lines changed: 16 additions & 4 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 }} (${{ matrix.os == 'windows-latest' && 'Win' || 'Linux' }})"
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"

.github/workflows/test.yml

Lines changed: 16 additions & 4 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 }} (${{ matrix.os == 'windows-latest' && 'Win' || 'Linux' }})"
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"

0 commit comments

Comments
 (0)