Skip to content

[CI] Run unit and functional tests under Windows too #2816

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

Merged
merged 1 commit into from
Jul 1, 2025
Merged
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
13 changes: 11 additions & 2 deletions .github/workflows/.utils.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
_run_task() {
# Create a non-exiting version of _run_task for sequential execution
# This is used to run the tests sequentially on Windows
# because parallel is not available on Windows.
_run_task_sequential() {
local ok=0
local title="$1"
local start=$(date -u +%s)
Expand All @@ -16,7 +19,13 @@ _run_task() {
echo -e "\n\\e[32mOK\\e[0m $title\\n\\n::endgroup::"
fi

exit $ok
return $ok
}
export -f _run_task_sequential

_run_task() {
_run_task_sequential "$1" "$2"
exit $?
}
export -f _run_task

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Functional Tests

defaults:
run:
shell: bash

on:
push:
paths:
Expand All @@ -12,14 +16,15 @@ on:

jobs:
turbo-tests:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']
dependency-version: ['']
symfony-version: ['']
minimum-stability: ['stable']
os: ['']
include:
# dev packages (probably not needed to have multiple such jobs)
- minimum-stability: 'dev'
Expand All @@ -30,7 +35,6 @@ jobs:
# LTS version of Symfony
- php-version: '8.1'
symfony-version: '6.4.*'

env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version || '>=5.4' }}
services:
Expand Down
37 changes: 34 additions & 3 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Unit Tests

defaults:
run:
shell: bash

on:
push:
paths-ignore:
Expand All @@ -18,14 +22,15 @@ concurrency:

jobs:
php:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']
dependency-version: ['']
symfony-version: ['']
minimum-stability: ['stable']
os: ['']
include:
# dev packages (probably not needed to have multiple such jobs)
- minimum-stability: 'dev'
Expand All @@ -36,6 +41,9 @@ jobs:
# LTS version of Symfony
- php-version: '8.1'
symfony-version: '6.4.*'
- php-version: '8.1'
symfony-version: '6.4.*'
os: 'windows-latest'

env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version || '>=5.4' }}
Expand Down Expand Up @@ -66,6 +74,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ matrix.os == 'windows-latest' && 'pdo_sqlite,sqlite3,fileinfo,gd' || '' }}
tools: flex

- name: Get composer cache directory
Expand All @@ -89,17 +98,39 @@ jobs:
- name: Build root packages
run: php .github/build-packages.php

- name: Run packages tests
- name: Run packages tests (Unix)
if: matrix.os != 'windows-latest'
run: |
source .github/workflows/.utils.sh

echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} \
'(cd src/{} \
&& $COMPOSER_MIN_STAB \
&& $COMPOSER_UP \
&& if [ {} = LiveComponent ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
&& $PHPUNIT)'"

- name: Run packages tests (Windows)
if: matrix.os == 'windows-latest'
run: |
source .github/workflows/.utils.sh

# parallel is not available on Windows, so we need to run the tests sequentially
FAILED_PACKAGES=""
for PACKAGE in $PACKAGES; do
if ! PACKAGE="$PACKAGE" _run_task_sequential $PACKAGE \
'(cd src/$PACKAGE \
&& $COMPOSER_MIN_STAB \
&& $COMPOSER_UP \
&& if [ "$PACKAGE" = "LiveComponent" ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
&& $PHPUNIT)'; then
FAILED_PACKAGES="$FAILED_PACKAGES $PACKAGE"
fi
done

if [ -n "$FAILED_PACKAGES" ]; then
echo "The following packages failed:$FAILED_PACKAGES"
exit 1
fi
js:
runs-on: ubuntu-latest
strategy:
Expand Down