Skip to content

Add Windows tests to GHA #7491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions .github/workflows/reusable-serviceless-phpunit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
description: The PHP version the workflow should run
type: string
required: true
os:
description: The GitHub-hosted runner for the job
type: string
required: true
job-id:
description: Job ID to be used as part of cache key and artifact name
type: string
Expand Down Expand Up @@ -49,9 +53,15 @@ on:
jobs:
tests:
name: ${{ inputs.job-name }}
runs-on: ubuntu-22.04
runs-on: ${{ inputs.os }}

steps:
- name: Set Git to use LF
if: ${{ contains(inputs.os, 'windows') }}
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- name: Install latest ImageMagick
if: ${{ contains(inputs.extra-extensions, 'imagick') }}
run: |
Expand All @@ -68,22 +78,24 @@ jobs:
with:
php-version: ${{ inputs.php-version }}
tools: composer
extensions: gd, ${{ inputs.extra-extensions }}
extensions: intl, gd, ${{ inputs.extra-extensions }}
coverage: ${{ env.COVERAGE_DRIVER }}
env:
COVERAGE_DRIVER: ${{ inputs.enable-coverage && 'xdebug' || 'none' }}

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

- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-${{ hashFiles('**/composer.*') }}
key: ${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-os-${{ inputs.os }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-os-${{ inputs.os }}-
${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-
${{ inputs.job-id || github.job }}-

Expand All @@ -107,10 +119,12 @@ jobs:
env:
COVERAGE_OPTION: ${{ inputs.enable-coverage && format('--coverage-php build/cov/coverage-{0}.cov', env.ARTIFACT_NAME) || '--no-coverage' }}
GROUP_OPTION: ${{ inputs.group-name && format('--group {0}', inputs.group-name) || '' }}
shell: bash

- name: Run tests
run: script -e -c "vendor/bin/phpunit --color=always ${{ env.EXTRA_PHPUNIT_OPTIONS }}"
run: vendor/bin/phpunit --color=always ${{ env.EXTRA_PHPUNIT_OPTIONS }}
env:
DB: SQLite3
TACHYCARDIA_MONITOR_GA: ${{ inputs.enable-profiling && 'enabled' || '' }}
TERM: xterm-256color

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-autoreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ jobs:
with:
job-name: Automatic Code Review [PHP 8.1]
php-version: '8.1'
os: ubuntu-22.04
job-id: auto-review-tests
group-name: AutoReview
17 changes: 17 additions & 0 deletions .github/workflows/test-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,22 @@ jobs:
enable-profiling: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
extra-extensions: redis, memcached

windows-tests:
needs:
- coverage-php-version
- sanity-tests

uses: ./.github/workflows/reusable-serviceless-phpunit-test.yml # @TODO Extract to codeigniter4/.github repo
with:
job-name: Windows Tests
php-version: '8.1'
os: windows-2022
job-id: windows-tests
enable-artifact-upload: ${{ '8.1' == needs.coverage-php-version.outputs.version }}
enable-coverage: ${{ '8.1' == needs.coverage-php-version.outputs.version }}
enable-profiling: ${{ '8.1' == needs.coverage-php-version.outputs.version }}
extra-extensions: redis, memcached, sodium, sqlite3

coveralls:
name: Upload coverage results to Coveralls
if: github.repository_owner == 'codeigniter4'
Expand All @@ -167,6 +183,7 @@ jobs:
- cache-live-tests
- database-live-tests
- separate-process-tests
- windows-tests

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