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