|
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,81 @@ 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'] |
| 62 | + php-version: ['8.1', '8.2', '8.3', '8.4'] |
| 63 | + dependency-version: [''] |
| 64 | + symfony-version: [''] |
| 65 | + minimum-stability: ['stable'] |
74 | 66 | 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 |
| - |
| 67 | + # dev packages (probably not needed to have multiple such jobs) |
| 68 | + - minimum-stability: 'dev' |
| 69 | + php-version: '8.4' |
| 70 | + # lowest deps |
| 71 | + - php-version: '8.1' |
| 72 | + dependency-version: 'lowest' |
| 73 | + # LTS version of Symfony |
| 74 | + - php-version: '8.1' |
| 75 | + symfony-version: '6.4.*' |
| 76 | + |
| 77 | + env: |
| 78 | + SYMFONY_REQUIRE: ${{ matrix.symfony-version }} |
91 | 79 | steps:
|
92 | 80 | - uses: actions/checkout@v4
|
93 | 81 |
|
94 |
| - - uses: shivammathur/setup-php@v2 |
| 82 | + - name: Configure environment |
| 83 | + run: | |
| 84 | + echo COLUMNS=120 >> $GITHUB_ENV |
| 85 | + echo COMPOSER_MIN_STAB='composer config minimum-stability ${{ matrix.minimum-stability || 'stable' }} --ansi' >> $GITHUB_ENV |
| 86 | + echo COMPOSER_UP='composer update ${{ matrix.dependency-version == 'lowest' && '--prefer-lowest' }} --no-progress --no-interaction --ansi' >> $GITHUB_ENV |
| 87 | + echo PHPUNIT='vendor/bin/simple-phpunit' >> $GITHUB_ENV |
| 88 | + [ 'lowest' = '${{ matrix.dependency-version }}' ] && export SYMFONY_DEPRECATIONS_HELPER=weak |
| 89 | +
|
| 90 | + # Swup and Typed have no tests, Turbo has its own workflow file |
| 91 | + 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' ' ') |
| 92 | + echo "Packages: $PACKAGES" |
| 93 | + echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV |
| 94 | +
|
| 95 | + - name: Setup PHP |
| 96 | + uses: shivammathur/setup-php@v2 |
95 | 97 | with:
|
96 | 98 | php-version: ${{ matrix.php-version }}
|
| 99 | + tools: flex |
97 | 100 |
|
98 |
| - - name: Install root packages |
99 |
| - uses: ramsey/composer-install@v3 |
100 |
| - with: |
101 |
| - working-directory: ${{ github.workspace }} |
102 |
| - dependency-versions: ${{ matrix.dependency-version }} |
| 101 | + - name: Install root dependencies |
| 102 | + run: composer install |
103 | 103 |
|
104 | 104 | - name: Build root packages
|
105 | 105 | 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 | 106 |
|
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 |
| 107 | + - name: Run packages tests |
| 108 | + run: | |
| 109 | + _run_task() { |
| 110 | + local ok=0 |
| 111 | + local title="$1" |
| 112 | + local start=$(date -u +%s) |
| 113 | + OUTPUT=$(bash -xc "$2" 2>&1) || ok=$? |
| 114 | + local end=$(date -u +%s) |
| 115 | +
|
| 116 | + if [[ $ok -ne 0 ]]; then |
| 117 | + printf "\n%-70s%10s\n" $title $(($end-$start))s |
| 118 | + echo "$OUTPUT" |
| 119 | + echo "Job exited with: $ok" |
| 120 | + echo -e "\n::error::KO $title\\n" |
| 121 | + else |
| 122 | + printf "::group::%-68s%10s\n" $title $(($end-$start))s |
| 123 | + echo "$OUTPUT" |
| 124 | + echo -e "\n\\e[32mOK\\e[0m $title\\n\\n::endgroup::" |
| 125 | + fi |
| 126 | +
|
| 127 | + exit $ok |
| 128 | + } |
| 129 | + export -f _run_task |
| 130 | +
|
| 131 | + echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} '(cd src/{} && $COMPOSER_MIN_STAB && $COMPOSER_UP && $PHPUNIT)'" |
122 | 132 |
|
123 | 133 | tests-js:
|
124 | 134 | runs-on: ubuntu-latest
|
|
0 commit comments