11name : Unit Tests
22
3+ defaults :
4+ run :
5+ shell : bash
6+
37on :
48 push :
59 paths-ignore :
@@ -18,14 +22,15 @@ concurrency:
1822
1923jobs :
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'
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' }}
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
@@ -93,13 +102,54 @@ jobs:
93102 run : |
94103 source .github/workflows/.utils.sh
95104
96- echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} \
97- '(cd src/{} \
98- && $COMPOSER_MIN_STAB \
99- && $COMPOSER_UP \
100- && if [ {} = LiveComponent ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
101- && $PHPUNIT)'"
102-
105+ # Create a non-exiting version of _run_task for sequential execution
106+ _run_task_sequential() {
107+ local ok=0
108+ local title="$1"
109+ local start=$(date -u +%s)
110+ OUTPUT=$(bash -xc "$2" 2>&1) || ok=$?
111+ local end=$(date -u +%s)
112+
113+ if [[ $ok -ne 0 ]]; then
114+ printf "\n%-70s%10s\n" $title $(($end-$start))s
115+ echo "$OUTPUT"
116+ echo "Job exited with: $ok"
117+ echo -e "\n::error::KO $title\\n"
118+ else
119+ printf "::group::%-68s%10s\n" $title $(($end-$start))s
120+ echo "$OUTPUT"
121+ echo -e "\n\\e[32mOK\\e[0m $title\\n\\n::endgroup::"
122+ fi
123+
124+ return $ok # Return instead of exit
125+ }
126+
127+ if [ "${{ matrix.os }}" = "windows-latest" ]; then
128+ # parallel is not available on Windows, so we need to run the tests sequentially
129+ FAILED_PACKAGES=""
130+ for PACKAGE in $PACKAGES; do
131+ if ! PACKAGE="$PACKAGE" _run_task_sequential $PACKAGE \
132+ '(cd src/$PACKAGE \
133+ && $COMPOSER_MIN_STAB \
134+ && $COMPOSER_UP \
135+ && if [ "$PACKAGE" = "LiveComponent" ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
136+ && $PHPUNIT)'; then
137+ FAILED_PACKAGES="$FAILED_PACKAGES $PACKAGE"
138+ fi
139+ done
140+
141+ if [ -n "$FAILED_PACKAGES" ]; then
142+ echo "The following packages failed:$FAILED_PACKAGES"
143+ exit 1
144+ fi
145+ else
146+ echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} \
147+ '(cd src/{} \
148+ && $COMPOSER_MIN_STAB \
149+ && $COMPOSER_UP \
150+ && if [ {} = LiveComponent ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
151+ && $PHPUNIT)'"
152+ fi
103153 js :
104154 runs-on : ubuntu-latest
105155 strategy :
0 commit comments