Skip to content

Commit a863311

Browse files
committed
Add Windows tests to GHA
1 parent 19c28a1 commit a863311

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

.github/workflows/reusable-serviceless-phpunit-test.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
description: The PHP version the workflow should run
1414
type: string
1515
required: true
16+
os:
17+
description: The GitHub-hosted runner for the job
18+
type: string
19+
required: true
1620
job-id:
1721
description: Job ID to be used as part of cache key and artifact name
1822
type: string
@@ -49,9 +53,15 @@ on:
4953
jobs:
5054
tests:
5155
name: ${{ inputs.job-name }}
52-
runs-on: ubuntu-22.04
56+
runs-on: ${{ inputs.os }}
5357

5458
steps:
59+
- name: Set Git to use LF
60+
if: ${{ contains(inputs.os, 'windows') }}
61+
run: |
62+
git config --global core.autocrlf false
63+
git config --global core.eol lf
64+
5565
- name: Install latest ImageMagick
5666
if: ${{ contains(inputs.extra-extensions, 'imagick') }}
5767
run: |
@@ -68,22 +78,24 @@ jobs:
6878
with:
6979
php-version: ${{ inputs.php-version }}
7080
tools: composer
71-
extensions: gd, ${{ inputs.extra-extensions }}
81+
extensions: intl, gd, ${{ inputs.extra-extensions }}
7282
coverage: ${{ env.COVERAGE_DRIVER }}
7383
env:
7484
COVERAGE_DRIVER: ${{ inputs.enable-coverage && 'xdebug' || 'none' }}
7585

7686
- name: Setup global environment variables
7787
run: |
7888
echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
79-
echo "ARTIFACT_NAME=${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}" >> $GITHUB_ENV
89+
echo "ARTIFACT_NAME=${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-os-${{ inputs.os }}" >> $GITHUB_ENV
90+
shell: bash
8091

8192
- name: Cache Composer dependencies
8293
uses: actions/cache@v3
8394
with:
8495
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
85-
key: ${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-${{ hashFiles('**/composer.*') }}
96+
key: ${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-os-${{ inputs.os }}-${{ hashFiles('**/composer.*') }}
8697
restore-keys: |
98+
${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-os-${{ inputs.os }}-
8799
${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-
88100
${{ inputs.job-id || github.job }}-
89101
@@ -109,7 +121,7 @@ jobs:
109121
GROUP_OPTION: ${{ inputs.group-name && format('--group {0}', inputs.group-name) || '' }}
110122

111123
- name: Run tests
112-
run: script -e -c "vendor/bin/phpunit --color=always ${{ env.EXTRA_PHPUNIT_OPTIONS }}"
124+
run: vendor/bin/phpunit --color=always ${{ env.EXTRA_PHPUNIT_OPTIONS }}
113125
env:
114126
TACHYCARDIA_MONITOR_GA: ${{ inputs.enable-profiling && 'enabled' || '' }}
115127
TERM: xterm-256color

.github/workflows/test-autoreview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ jobs:
2727
with:
2828
job-name: Automatic Code Review [PHP 8.1]
2929
php-version: '8.1'
30+
os: ubuntu-22.04
3031
job-id: auto-review-tests
3132
group-name: AutoReview

.github/workflows/test-phpunit.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,23 @@ jobs:
158158
enable-profiling: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
159159
extra-extensions: redis, memcached
160160

161+
windows-tests:
162+
needs:
163+
- coverage-php-version
164+
- sanity-tests
165+
166+
uses: ./.github/workflows/reusable-serviceless-phpunit-test.yml # @TODO Extract to codeigniter4/.github repo
167+
with:
168+
job-name: Windows Tests
169+
php-version: '8.1'
170+
os: windows-2022
171+
job-id: windows-tests
172+
group-name: 'Others,SeparateProcess,CacheLive'
173+
enable-artifact-upload: ${{ '8.1' == needs.coverage-php-version.outputs.version }}
174+
enable-coverage: ${{ '8.1' == needs.coverage-php-version.outputs.version }}
175+
enable-profiling: ${{ '8.1' == needs.coverage-php-version.outputs.version }}
176+
extra-extensions: redis, memcached
177+
161178
coveralls:
162179
name: Upload coverage results to Coveralls
163180
if: github.repository_owner == 'codeigniter4'
@@ -167,6 +184,7 @@ jobs:
167184
- cache-live-tests
168185
- database-live-tests
169186
- separate-process-tests
187+
- windows-tests
170188

171189
uses: ./.github/workflows/reusable-coveralls.yml # @TODO Extract to codeigniter4/.github repo
172190
with:

0 commit comments

Comments
 (0)