Skip to content

Commit c17dff3

Browse files
committed
[CI] Run unit and functional tests under Windows too
1 parent 7c3afc9 commit c17dff3

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed

.github/workflows/.utils.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
_run_task() {
1+
# Create a non-exiting version of _run_task for sequential execution
2+
# This is used to run the tests sequentially on Windows
3+
# because parallel is not available on Windows.
4+
_run_task_sequential() {
25
local ok=0
36
local title="$1"
47
local start=$(date -u +%s)
@@ -16,7 +19,13 @@ _run_task() {
1619
echo -e "\n\\e[32mOK\\e[0m $title\\n\\n::endgroup::"
1720
fi
1821

19-
exit $ok
22+
return $ok
23+
}
24+
export -f _run_task_sequential
25+
26+
_run_task() {
27+
_run_task_sequential "$1" "$2"
28+
exit $?
2029
}
2130
export -f _run_task
2231

.github/workflows/functional-tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Functional Tests
22

3+
defaults:
4+
run:
5+
shell: bash
6+
37
on:
48
push:
59
paths:
@@ -12,14 +16,15 @@ on:
1216

1317
jobs:
1418
turbo-tests:
15-
runs-on: ubuntu-latest
19+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
1620
strategy:
1721
fail-fast: false
1822
matrix:
1923
php-version: ['8.1', '8.2', '8.3', '8.4']
2024
dependency-version: ['']
2125
symfony-version: ['']
2226
minimum-stability: ['stable']
27+
os: ['']
2328
include:
2429
# dev packages (probably not needed to have multiple such jobs)
2530
- minimum-stability: 'dev'
@@ -30,7 +35,6 @@ jobs:
3035
# LTS version of Symfony
3136
- php-version: '8.1'
3237
symfony-version: '6.4.*'
33-
3438
env:
3539
SYMFONY_REQUIRE: ${{ matrix.symfony-version || '>=5.4' }}
3640
services:

.github/workflows/unit-tests.yaml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Unit Tests
22

3+
defaults:
4+
run:
5+
shell: bash
6+
37
on:
48
push:
59
paths-ignore:
@@ -18,14 +22,15 @@ concurrency:
1822

1923
jobs:
2024
php:
21-
runs-on: ubuntu-latest
25+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
2226
strategy:
2327
fail-fast: false
2428
matrix:
2529
php-version: ['8.1', '8.2', '8.3', '8.4']
2630
dependency-version: ['']
2731
symfony-version: ['']
2832
minimum-stability: ['stable']
33+
os: ['']
2934
include:
3035
# dev packages (probably not needed to have multiple such jobs)
3136
- minimum-stability: 'dev'
@@ -36,6 +41,9 @@ jobs:
3641
# LTS version of Symfony
3742
- php-version: '8.1'
3843
symfony-version: '6.4.*'
44+
- php-version: '8.1'
45+
symfony-version: '6.4.*'
46+
os: 'windows-latest'
3947

4048
env:
4149
SYMFONY_REQUIRE: ${{ matrix.symfony-version || '>=5.4' }}
@@ -66,6 +74,7 @@ jobs:
6674
uses: shivammathur/setup-php@v2
6775
with:
6876
php-version: ${{ matrix.php-version }}
77+
extensions: ${{ matrix.os == 'windows-latest' && 'pdo_sqlite,sqlite3,fileinfo,gd' || '' }}
6978
tools: flex
7079

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

92-
- name: Run packages tests
101+
- name: Run packages tests (Unix)
102+
if: matrix.os != 'windows-latest'
93103
run: |
94104
source .github/workflows/.utils.sh
95-
96105
echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} \
97106
'(cd src/{} \
98107
&& $COMPOSER_MIN_STAB \
99108
&& $COMPOSER_UP \
100109
&& if [ {} = LiveComponent ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
101110
&& $PHPUNIT)'"
102111
112+
- name: Run packages tests (Windows)
113+
if: matrix.os == 'windows-latest'
114+
run: |
115+
source .github/workflows/.utils.sh
116+
117+
# parallel is not available on Windows, so we need to run the tests sequentially
118+
FAILED_PACKAGES=""
119+
for PACKAGE in $PACKAGES; do
120+
if ! PACKAGE="$PACKAGE" _run_task_sequential $PACKAGE \
121+
'(cd src/$PACKAGE \
122+
&& $COMPOSER_MIN_STAB \
123+
&& $COMPOSER_UP \
124+
&& if [ "$PACKAGE" = "LiveComponent" ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
125+
&& $PHPUNIT)'; then
126+
FAILED_PACKAGES="$FAILED_PACKAGES $PACKAGE"
127+
fi
128+
done
129+
130+
if [ -n "$FAILED_PACKAGES" ]; then
131+
echo "The following packages failed:$FAILED_PACKAGES"
132+
exit 1
133+
fi
103134
js:
104135
runs-on: ubuntu-latest
105136
strategy:

0 commit comments

Comments
 (0)