diff --git a/.github/workflows/.utils.sh b/.github/workflows/.utils.sh index e4f14caf089..582a3bc7bd2 100644 --- a/.github/workflows/.utils.sh +++ b/.github/workflows/.utils.sh @@ -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) @@ -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 diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml index bc84147937a..08e3a72daf2 100644 --- a/.github/workflows/functional-tests.yml +++ b/.github/workflows/functional-tests.yml @@ -1,5 +1,9 @@ name: Functional Tests +defaults: + run: + shell: bash + on: push: paths: @@ -12,7 +16,7 @@ on: jobs: turbo-tests: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false matrix: @@ -20,6 +24,7 @@ jobs: dependency-version: [''] symfony-version: [''] minimum-stability: ['stable'] + os: [''] include: # dev packages (probably not needed to have multiple such jobs) - minimum-stability: 'dev' @@ -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: diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index f32d91dc687..3e4b8aeb0e5 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -1,5 +1,9 @@ name: Unit Tests +defaults: + run: + shell: bash + on: push: paths-ignore: @@ -18,7 +22,7 @@ concurrency: jobs: php: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false matrix: @@ -26,6 +30,7 @@ jobs: dependency-version: [''] symfony-version: [''] minimum-stability: ['stable'] + os: [''] include: # dev packages (probably not needed to have multiple such jobs) - minimum-stability: 'dev' @@ -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' }} @@ -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 @@ -89,10 +98,10 @@ 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 \ @@ -100,6 +109,28 @@ jobs: && 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: