Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 191 additions & 0 deletions .github/workflows/behat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: Behat

on:
push:
branches: [ master ]
paths-ignore:
- README.md
pull_request:
branches: [ master ]
paths-ignore:
- README.md

jobs:
sylius:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [7.4]
sylius: ['~1.7.0']
node: [10.x]

env:
APP_ENV: test_cached

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
extensions: intl
tools: symfony, composer:v1
coverage: none
ini-values: date.timezone=Europe/Paris

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "${{ matrix.node }}"

- uses: actions/checkout@v2
with:
path: theme

- uses: actions/cache@v1
id: cache-composer
with:
path: /home/runner/.composer/cache
key: composer-php.${{ matrix.php }}-sylius.${{ matrix.sylius }}-${{ github.sha }}
restore-keys: composer-php.${{ matrix.php }}-sylius.${{ matrix.sylius }}-

- name: Composer - Create cache directory
run: mkdir -p /home/runner/.composer/cache
if: steps.cache-composer.outputs.cache-hit != 'true'

- name: Composer - Github Auth
run: composer config -g github-oauth.github.com ${{ github.token }}

- name: Composer - Install Sylius-Standard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of similarities with what's happening in the Dockerfile of #66 here.

run: composer create-project --no-progress sylius/sylius-standard sylius "${{ matrix.sylius }}"

- name: Composer - Add path repository
working-directory: ./sylius
run: |
composer config repositories.plugin '{"type": "path", "url": "../theme/"}'

- name: Composer - Config
working-directory: ./sylius
run: |
composer config extra.symfony.allow-contrib true
composer config minimum-stability "dev"
composer config prefer-stable true

- name: Composer - Install plugin
working-directory: ./sylius
run: composer require sylius/bootstrap-theme --prefer-source --no-scripts

- name: Theme - Install Theme
working-directory: ./sylius
run: composer require encore

- name: Theme - Copy Theme
working-directory: ./sylius
run: |
mkdir -p themes/BootstrapTheme/
cp -r ../theme/* themes/BootstrapTheme/
ls -l themes/BootstrapTheme

- name: Theme - Config Webpack
working-directory: ./sylius
run: |
sed -i "s#module.exports = \[shopConfig, adminConfig\];#const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');#" webpack.config.js
echo "module.exports = [shopConfig, adminConfig, bootstrapTheme];" >> webpack.config.js
cat webpack.config.js

- name: Theme - Config Assets
working-directory: ./sylius
run: |
echo "framework:" > config/packages/assets.yaml
echo " assets:" >> config/packages/assets.yaml
echo " packages:" >> config/packages/assets.yaml
echo " bootstrapTheme:" >> config/packages/assets.yaml
echo " json_manifest_path: '%kernel.project_dir%/public/bootstrap-theme/manifest.json'" >> config/packages/assets.yaml
cat config/packages/assets.yaml

- name: Theme - Config Webpack Encore
working-directory: ./sylius
run: |
echo " builds:" >> config/packages/webpack_encore.yaml
echo " bootstrapTheme: '%kernel.project_dir%/public/bootstrap-theme'" >> config/packages/webpack_encore.yaml
cat config/packages/webpack_encore.yaml

- name: Theme - Get Yarn cache directory
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Theme - Cache Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-

- name: Theme - Install JS dependencies
working-directory: ./sylius
run: |
yarn install
yarn add @symfony/webpack-encore sass-loader@^9.0 node-sass@^4.0 lodash.throttle -D
yarn add bootstrap@^4.5 bootstrap.native@^3.0 glightbox axios form-serialize @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons

- name: Theme - Prepare test application assets
working-directory: ./sylius
run: |
php bin/console assets:install public -vvv
yarn encore dev

- name: Theme - Set in Sylius Standard
working-directory: ./sylius
run: |
sed -i "82i\ theme_name: 'sylius/bootstrap-theme'" vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Resources/config/app/fixtures/shop_configuration.yaml
cat vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Resources/config/app/fixtures/shop_configuration.yaml
sed -i "110i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultUnitedStatesChannelFactory.php
cat vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultUnitedStatesChannelFactory.php
sed -i "85i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultChannelFactory.php
cat vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultChannelFactory.php

- name: Sylius - Init database
working-directory: ./sylius
run: php bin/console doctrine:database:create --if-not-exists

- name: Sylius - Install
working-directory: ./sylius
run: php bin/console sylius:install -n -s default

- name: Symfony CLI - PHP version
working-directory: ./sylius
run: |
php -v | head -n 1 | awk '{ print $2 }' > .php-version

- name: Symfony CLI - Certificat
working-directory: ./sylius
run: symfony server:ca:install

- name: Chrome - Run
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 &

- name: Symfony CLI - Server start
working-directory: ./sylius
run: symfony server:start --port=8080 --dir=public --daemon

- name: Behat - Run Behat tests
working-directory: ./sylius
run: vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" vendor/sylius/sylius/features/account || \
vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" --rerun vendor/sylius/sylius/features/account

- name: Behat - Upload logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: Behat logs
path: sylius/etc/build/
if-no-files-found: ignore

services:
mariadb:
image: mariadb:latest
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/composer.lock
/vendor/
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"email": "[email protected]"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Sylius/SyliusShopBundle.git"
}
],
"require": {
"sylius/shop-bundle": "^1.7"
},
Expand Down