Skip to content

Commit 45a2648

Browse files
committed
add behat to github actions
1 parent f6ba585 commit 45a2648

File tree

3 files changed

+175
-0
lines changed

3 files changed

+175
-0
lines changed

.github/workflows/behat.yaml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: Behat
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths-ignore:
7+
- README.md
8+
pull_request:
9+
branches: [ master ]
10+
paths-ignore:
11+
- README.md
12+
13+
jobs:
14+
sylius:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
php: [7.4]
20+
sylius: ['~1.7.0']
21+
22+
env:
23+
APP_ENV: test
24+
25+
steps:
26+
- name: PHP - Switch
27+
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php }} && php -v
28+
29+
- name: PHP - Setup timezone
30+
run: |
31+
echo "date.timezone=UTC" >> /tmp/timezone.ini; \
32+
sudo mv /tmp/timezone.ini /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini
33+
34+
- uses: actions/checkout@v2
35+
with:
36+
path: theme
37+
38+
- uses: actions/cache@v1
39+
id: cache-composer
40+
with:
41+
path: /home/runner/.composer/cache
42+
key: composer-php.${{ matrix.php }}-sylius.${{ matrix.sylius }}-${{ github.sha }}
43+
restore-keys: composer-php.${{ matrix.php }}-sylius.${{ matrix.sylius }}-
44+
45+
- name: Composer - Create cache directory
46+
run: mkdir -p /home/runner/.composer/cache
47+
if: steps.cache-composer.outputs.cache-hit != 'true'
48+
49+
- name: Composer - Self Update
50+
run: |
51+
mkdir -p /home/runner/.composer/
52+
sudo composer self-update
53+
54+
- name: Composer - Github Auth
55+
run: composer config -g github-oauth.github.com ${{ github.token }}
56+
57+
- name: Composer - Install Sylius-Standard
58+
run: composer create-project --no-progress sylius/sylius-standard sylius "${{ matrix.sylius }}"
59+
60+
- name: Composer - Add path repository
61+
working-directory: ./sylius
62+
run: |
63+
composer config repositories.plugin '{"type": "path", "url": "../theme/"}'
64+
65+
- name: Theme - Install Theme
66+
working-directory: ./sylius
67+
run: composer require sylius/bootstrap-theme encore
68+
69+
- name: Theme - Copy Theme
70+
working-directory: ./sylius
71+
run: |
72+
mkdir -p themes/BootstrapTheme/
73+
cp -r ../theme/* themes/BootstrapTheme/
74+
75+
- name: Theme - Install dependencies
76+
working-directory: ./sylius
77+
run: |
78+
yarn
79+
yarn add @symfony/webpack-encore sass-loader@^7.0.0 node-sass lodash.throttle -D
80+
yarn add bootstrap@^4.5.0 bootstrap.native@^3.0.0 glightbox axios form-serialize @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons
81+
82+
- name: Theme - Config Webpack
83+
working-directory: ./sylius
84+
run: |
85+
echo "const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');" >> webpack.config.js
86+
echo "module.exports = [bootstrapTheme];" >> webpack.config.js
87+
88+
- name: Theme - Config Assets
89+
working-directory: ./sylius
90+
run: |
91+
echo "framework:" > config/packages/assets.yaml
92+
echo " assets:" >> config/packages/assets.yaml
93+
echo " packages:" >> config/packages/assets.yaml
94+
echo " bootstrapTheme:" >> config/packages/assets.yaml
95+
echo " json_manifest_path: '%kernel.project_dir%/public/bootstrap-theme/manifest.json'" >> config/packages/assets.yaml
96+
97+
- name: Theme - Config Webpack Encore
98+
working-directory: ./sylius
99+
run: |
100+
echo " builds:" >> config/packages/webpack_encore.yaml
101+
echo " bootstrapTheme: '%kernel.project_dir%/public/bootstrap-theme'" >> config/packages/webpack_encore.yaml
102+
103+
- name: Theme - Build
104+
working-directory: ./sylius
105+
run: yarn build
106+
107+
- name: Theme - Set in Sylius Standard
108+
working-directory: ./sylius
109+
run: |
110+
sed -i "82i\ theme_name: 'sylius/bootstrap-theme'" vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Resources/config/app/fixtures/shop_configuration.yaml
111+
sed -i "113i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultUnitedStatesChannelFactory.php
112+
sed -i "88i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultChannelFactory.php
113+
114+
- name: Sylius - Init database
115+
working-directory: ./sylius
116+
run: php bin/console doctrine:database:create --if-not-exists
117+
118+
- name: Sylius - Install
119+
working-directory: ./sylius
120+
run: php bin/console sylius:install -n -s default
121+
122+
- name: Behat - Configure display
123+
working-directory: ./sylius
124+
run: |
125+
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16
126+
export DISPLAY=:99
127+
128+
- name: Behat - Download and configure ChromeDriver
129+
working-directory: ./sylius
130+
run: |
131+
if [ ! -f chromedriver ] || [ "$(chromedriver --version | grep -c 2.34)" = "0" ]; then
132+
curl http://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip > chromedriver.zip
133+
unzip chromedriver.zip
134+
chmod +x chromedriver
135+
fi
136+
137+
- name: Behat - Run ChromeDriver
138+
working-directory: ./sylius
139+
run: chromedriver > /dev/null 2>&1 &
140+
141+
- name: Behat - Download and configure Selenium
142+
working-directory: ./sylius
143+
run: |
144+
if [ ! -f selenium.jar ] || [ "$(java -jar selenium.jar --version | grep -c 3.4.0)" = "0" ]; then
145+
curl http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar > selenium.jar
146+
fi
147+
148+
- name: Behat - Run Selenium
149+
working-directory: ./sylius
150+
run: java -Dwebdriver.chrome.driver=chromedriver -jar selenium.jar > /dev/null 2>&1 &
151+
152+
- name: Behat - Run webserver
153+
working-directory: ./sylius
154+
run: bin/console server:run 127.0.0.1:8080 --quiet > /dev/null 2>&1 &
155+
156+
- name: Behat - Run Behat tests
157+
working-directory: ./sylius
158+
run: vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" vendor/sylius/sylius/features/account/registering.feature || \
159+
vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" vendor/sylius/sylius/features/account/registering.feature --rerun
160+
161+
services:
162+
mariadb:
163+
image: mariadb:latest
164+
ports:
165+
- 3306:3306
166+
env:
167+
MYSQL_ALLOW_EMPTY_PASSWORD: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/composer.lock
2+
/vendor/

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
"email": "[email protected]"
99
}
1010
],
11+
"repositories": [
12+
{
13+
"type": "vcs",
14+
"url": "https://github.com/Sylius/SyliusShopBundle.git"
15+
}
16+
],
1117
"require": {
1218
"sylius/shop-bundle": "^1.7"
1319
},

0 commit comments

Comments
 (0)