-
Notifications
You must be signed in to change notification settings - Fork 57
[WIP][PoC] add behat to github actions #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
oallain
wants to merge
2
commits into
SyliusCrafts:master
Choose a base branch
from
oallain:github-actions-behat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /composer.lock | ||
| /vendor/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,12 @@ | |
| "email": "[email protected]" | ||
| } | ||
| ], | ||
| "repositories": [ | ||
| { | ||
| "type": "vcs", | ||
| "url": "https://github.com/Sylius/SyliusShopBundle.git" | ||
| } | ||
| ], | ||
| "require": { | ||
| "sylius/shop-bundle": "^1.7" | ||
| }, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.