44 push :
55 branches-ignore :
66 - ' dependabot/**'
7- pull_request : ~
7+ paths-ignore :
8+ - " *.md"
9+ pull_request :
10+ paths-ignore :
11+ - " *.md"
812 release :
913 types : [created]
1014 schedule :
1115 -
1216 cron : " 0 1 * * 6" # Run at 1am every Saturday
1317 workflow_dispatch : ~
1418
19+ concurrency :
20+ group : ${{ github.workflow }}-${{ github.ref }}
21+ cancel-in-progress : true
22+
1523jobs :
1624 tests :
1725 runs-on : ubuntu-latest
1826
19- name : " Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
27+ name : " Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, ${{ matrix.database }}"
2028
2129 strategy :
2230 fail-fast : false
2331 matrix :
2432 php : ["8.3"]
25- symfony : ["^6.4", "^ 7.3"]
33+ symfony : ["^6.4", "~ 7.3.0 "]
2634 sylius : ["~2.0.0", "~2.1.0"]
35+ database : ["mysql:8.4"]
2736 node : ["22.x"]
28- mysql : ["8.4"]
2937
3038 env :
3139 APP_ENV : test
32- BEHAT_BASE_URL : " http://127.0.0.1:8080/"
33- DATABASE_URL : " mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
3440
3541 steps :
3642 -
3743 uses : actions/checkout@v4
3844
3945 -
40- name : Setup PHP
41- uses : shivammathur/setup-php@v2
42- with :
43- php-version : " ${{ matrix.php }}"
44- extensions : intl
45- tools : flex, symfony
46- coverage : none
47-
48- -
49- name : Setup Node
50- uses : actions/setup-node@v4
51- with :
52- node-version : " ${{ matrix.node }}"
53-
54- -
55- name : Shutdown default MySQL
56- run : sudo service mysql stop
57-
58- -
59- name : Setup MySQL
60- uses : mirromutth/mysql-action@v1.1
61- with :
62- mysql version : " ${{ matrix.mysql }}"
63- mysql root password : " root"
64-
65- -
66- name : Output PHP version for Symfony CLI
67- run : php -v | head -n 1 | awk '{ print $2 }' > .php-version
68-
69- -
70- name : Get Composer cache directory
71- id : composer-cache
72- run : echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
73-
74- -
75- name : Cache Composer
76- uses : actions/cache@v4
77- with :
78- path : ${{ steps.composer-cache.outputs.dir }}
79- key : ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
80- restore-keys : |
81- ${{ runner.os }}-php-${{ matrix.php }}-composer-
82-
83- -
84- name : Restrict Symfony version
85- if : matrix.symfony != ''
46+ name : Parse database string
8647 run : |
87- composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.4"
88- composer global config --no-plugins allow-plugins.symfony/flex true
89- composer config extra.symfony.require "${{ matrix.symfony }}"
90-
91- -
92- name : Restrict Sylius version
93- if : matrix.sylius != ''
94- run : composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction
95-
96- -
97- name : Install PHP dependencies
98- run : composer install --no-interaction
48+ DB_TYPE="${DATABASE%%:*}"
49+ DB_VERSION="${DATABASE##*:}"
50+ echo "DB_TYPE=$DB_TYPE" >> $GITHUB_ENV
51+ echo "DB_VERSION=$DB_VERSION" >> $GITHUB_ENV
52+
53+ if [ "$DB_TYPE" = "postgres" ]; then
54+ echo "DATABASE_URL=pgsql://postgres:postgres@127.0.0.1/sylius?serverVersion=$DB_VERSION" >> $GITHUB_ENV
55+ else
56+ echo "DATABASE_URL=mysql://root:root@127.0.0.1/sylius?serverVersion=$DB_VERSION" >> $GITHUB_ENV
57+ fi
58+ env :
59+ DATABASE : ${{ matrix.database }}
60+
61+ -
62+ name : Build Sylius Test Application
63+ uses : SyliusLabs/BuildTestAppAction@v3.2.0
64+ with :
65+ e2e_js : " yes"
66+ cache_key : " ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}"
67+ cache_restore_key : " ${{ runner.os }}-php-${{ matrix.php }}-composer-"
68+ database : " ${{ env.DB_TYPE }}"
69+ database_version : " ${{ env.DB_VERSION }}"
70+ node_version : " ${{ matrix.node }}"
71+ php_version : " ${{ matrix.php }}"
72+ sylius_version : " ${{ matrix.sylius }}"
73+ symfony_version : " ${{ matrix.symfony }}"
9974
10075 -
10176 name : Run unit tests
10277 run : vendor/bin/phpunit --colors=always --testsuite=unit
10378
104- -
105- name : Get Yarn cache directory
106- id : yarn-cache
107- run : echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
108-
109- -
110- name : Cache Yarn
111- uses : actions/cache@v4
112- with :
113- path : ${{ steps.yarn-cache.outputs.dir }}
114- key : ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
115- restore-keys : |
116- ${{ runner.os }}-node-${{ matrix.node }}-yarn-
117-
118- -
119- name : Install JS dependencies
120- run : (cd vendor/sylius/test-application && yarn install)
121-
122- -
123- name : Prepare test application database
124- run : |
125- (vendor/bin/console doctrine:database:create -vvv)
126- (vendor/bin/console doctrine:schema:create -vvv)
127-
128- -
129- name : Prepare test application assets
130- run : |
131- vendor/bin/console assets:install -vvv
132- (cd vendor/sylius/test-application && yarn build)
133-
134- -
135- name : Prepare test application cache
136- run : vendor/bin/console cache:warmup -vvv
137-
138- -
139- name : Load fixtures in test application
140- run : vendor/bin/console sylius:fixtures:load -n
141-
14279 -
14380 name : Validate composer.json
14481 run : composer validate --ansi --strict
@@ -151,14 +88,6 @@ jobs:
15188 name : Run Non-unit PHPUnit tests
15289 run : vendor/bin/phpunit --colors=always --testsuite=non-unit
15390
154- -
155- name : Run Chrome Headless
156- run : google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 &
157-
158- -
159- name : Run webserver
160- run : symfony server:start --port=8080 --no-tls --daemon
161-
16291 -
16392 name : Run Behat
16493 run : vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun
0 commit comments