|
12 | 12 | - 'src/**/*.md'
|
13 | 13 | - 'ux.symfony.com/**'
|
14 | 14 |
|
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
15 | 19 | jobs:
|
16 | 20 | coding-style-js:
|
17 | 21 | name: JavaScript Coding Style
|
@@ -50,75 +54,95 @@ jobs:
|
50 | 54 | echo "The Git workspace is clean. No changes detected."
|
51 | 55 | fi
|
52 | 56 |
|
53 |
| - tests-php-components: |
54 |
| - runs-on: ubuntu-latest |
55 |
| - outputs: |
56 |
| - components: ${{ steps.components.outputs.components }} |
57 |
| - steps: |
58 |
| - - uses: actions/checkout@v4 |
59 |
| - |
60 |
| - - id: components |
61 |
| - run: | |
62 |
| - components=$(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*" -printf '%h\n' | jq -R -s -c 'split("\n")[:-1] | map(. | sub("^src/";"")) | sort') |
63 |
| - echo "$components" |
64 |
| - echo "components=$components" >> $GITHUB_OUTPUT |
65 |
| -
|
66 | 57 | tests-php:
|
67 | 58 | runs-on: ubuntu-latest
|
68 |
| - needs: tests-php-components |
69 | 59 | strategy:
|
70 | 60 | fail-fast: false
|
71 | 61 | matrix:
|
72 |
| - php-version: ['8.1', '8.3', '8.4'] |
73 |
| - minimum-stability: ['stable', 'dev'] |
74 |
| - include: |
75 |
| - - php-version: '8.1' |
76 |
| - dependency-version: 'lowest' |
77 |
| - - php-version: '8.3' |
78 |
| - dependency-version: 'highest' |
79 |
| - - php-version: '8.4' |
80 |
| - dependency-version: 'highest' |
81 |
| - component: ${{ fromJson(needs.tests-php-components.outputs.components )}} |
82 |
| - exclude: |
83 |
| - - php-version: '8.1' |
84 |
| - minimum-stability: 'dev' |
85 |
| - - php-version: '8.3' |
86 |
| - minimum-stability: 'dev' |
87 |
| - - component: Swup # has no tests |
88 |
| - - component: Turbo # has its own workflow (test-turbo.yml) |
89 |
| - - component: Typed # has no tests |
90 |
| - |
| 62 | + config: |
| 63 | + # Minimum supported PHP versions, LTS Symfony versions, with highest deps |
| 64 | + - PHP_VERSION: '8.1' |
| 65 | + SYMFONY_VERSION: '6.4.*' |
| 66 | + |
| 67 | + # Minimum supported PHP versions, with highest and lowest deps |
| 68 | + - PHP_VERSION: '8.1' |
| 69 | + - PHP_VERSION: '8.1' |
| 70 | + COMPOSER_FLAGS: --prefer-lowest |
| 71 | + - PHP_VERSION: '8.2' |
| 72 | + - PHP_VERSION: '8.3' |
| 73 | + - PHP_VERSION: '8.4' |
| 74 | + |
| 75 | + # Multiple PHP versions, major Symfony development versions |
| 76 | + - PHP_VERSION: '8.1' |
| 77 | + SYMFONY_VERSION: '6.*' |
| 78 | + MINIMUM_STABILITY: dev |
| 79 | + |
| 80 | + - PHP_VERSION: '8.2' |
| 81 | + SYMFONY_VERSION: '7.*' |
| 82 | + MINIMUM_STABILITY: dev |
| 83 | + |
| 84 | + - PHP_VERSION: '8.3' |
| 85 | + SYMFONY_VERSION: '7.*' |
| 86 | + MINIMUM_STABILITY: dev |
| 87 | + |
| 88 | + - PHP_VERSION: '8.4' |
| 89 | + SYMFONY_VERSION: '7.*' |
| 90 | + MINIMUM_STABILITY: dev |
| 91 | + |
| 92 | + env: |
| 93 | + SYMFONY_REQUIRE: ${{ matrix.config.SYMFONY_VERSION }} |
91 | 94 | steps:
|
92 | 95 | - uses: actions/checkout@v4
|
93 | 96 |
|
94 |
| - - uses: shivammathur/setup-php@v2 |
| 97 | + - name: Configure environment |
| 98 | + run: | |
| 99 | + echo COLUMNS=120 >> $GITHUB_ENV |
| 100 | + echo COMPOSER_MIN_STAB='composer config minimum-stability ${{ matrix.config.MINIMUM_STABILITY || 'stable' }} --ansi' >> $GITHUB_ENV |
| 101 | + echo COMPOSER_UP='composer update ${{ matrix.config.COMPOSER_FLAGS || '' }} --no-progress --no-interaction --ansi' >> $GITHUB_ENV |
| 102 | + echo PHPUNIT='vendor/bin/simple-phpunit' >> $GITHUB_ENV |
| 103 | +
|
| 104 | + # Swup and Typed have no tests, Turbo has its own workflow file |
| 105 | + PACKAGES=$(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*" -printf '%h\n' | sed 's/^src\///' | grep -Ev "Swup|Turbo|Typed" | sort | tr '\n' ' ') |
| 106 | + echo "Packages: $PACKAGES" |
| 107 | + echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV |
| 108 | +
|
| 109 | + - name: Setup PHP |
| 110 | + uses: shivammathur/setup-php@v2 |
95 | 111 | with:
|
96 | 112 | php-version: ${{ matrix.php-version }}
|
| 113 | + tools: flex |
97 | 114 |
|
98 |
| - - name: Install root packages |
99 |
| - uses: ramsey/composer-install@v3 |
100 |
| - with: |
101 |
| - working-directory: ${{ github.workspace }} |
102 |
| - dependency-versions: ${{ matrix.dependency-version }} |
| 115 | + - name: Install root dependencies |
| 116 | + run: composer install |
103 | 117 |
|
104 | 118 | - name: Build root packages
|
105 | 119 | run: php .github/build-packages.php
|
106 |
| - working-directory: ${{ github.workspace }} |
107 |
| - |
108 |
| - - name: Configure ${{ matrix.minimum-stability }} stability |
109 |
| - if: ${{ matrix.minimum-stability }} |
110 |
| - run: composer config minimum-stability ${{ matrix.minimum-stability }} |
111 |
| - working-directory: "src/${{ matrix.component }}" |
112 | 120 |
|
113 |
| - - name: Install ${{ matrix.component }} packages |
114 |
| - uses: ramsey/composer-install@v3 |
115 |
| - with: |
116 |
| - working-directory: "src/${{ matrix.component }}" |
117 |
| - dependency-versions: ${{ matrix.dependency-version }} |
118 |
| - |
119 |
| - - name: ${{ matrix.component }} Tests |
120 |
| - working-directory: "src/${{ matrix.component }}" |
121 |
| - run: vendor/bin/simple-phpunit |
| 121 | + - name: Run packages tests |
| 122 | + run: | |
| 123 | + _run_task() { |
| 124 | + local ok=0 |
| 125 | + local title="$1" |
| 126 | + local start=$(date -u +%s) |
| 127 | + OUTPUT=$(bash -xc "$2" 2>&1) || ok=$? |
| 128 | + local end=$(date -u +%s) |
| 129 | +
|
| 130 | + if [[ $ok -ne 0 ]]; then |
| 131 | + printf "\n%-70s%10s\n" $title $(($end-$start))s |
| 132 | + echo "$OUTPUT" |
| 133 | + echo "Job exited with: $ok" |
| 134 | + echo -e "\n::error::KO $title\\n" |
| 135 | + else |
| 136 | + printf "::group::%-68s%10s\n" $title $(($end-$start))s |
| 137 | + echo "$OUTPUT" |
| 138 | + echo -e "\n\\e[32mOK\\e[0m $title\\n\\n::endgroup::" |
| 139 | + fi |
| 140 | +
|
| 141 | + exit $ok |
| 142 | + } |
| 143 | + export -f _run_task |
| 144 | +
|
| 145 | + echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} '(cd src/{} && $COMPOSER_MIN_STAB && $COMPOSER_UP && $PHPUNIT)'" |
122 | 146 |
|
123 | 147 | tests-js:
|
124 | 148 | runs-on: ubuntu-latest
|
|
0 commit comments