Skip to content

Commit

Permalink
minor #156 Introduce GitHub Actions (SirDomin)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.0-dev branch.

Discussion
----------



Commits
-------

4a0d9b7 Introduce github Actions
  • Loading branch information
pamil authored Nov 11, 2020
2 parents 9a6a4e5 + 4a0d9b7 commit e42eea2
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 94 deletions.
170 changes: 170 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: Build

on:
push: ~
pull_request: ~
release:
types: [created]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday

jobs:
tests:
runs-on: ubuntu-latest

name: "PHP ${{ matrix.php }}, MySQL ${{ matrix.mysql }}, Sylius ${{ matrix.sylius }}"

strategy:
fail-fast: false
matrix:
php: [7.4, 7.3]
node: [10.x]
mysql: [5.7, 8.0]
sylius: [1.7.*, 1.8.*]

exclude:
-
php: 7.3
mysql: 8.0

env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"

steps:
-
uses: actions/checkout@v2

-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
extensions: intl
tools: symfony
coverage: none

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

-
name: Require Sylius
run: composer require sylius/sylius:${{ matrix.sylius }} --no-interaction --no-update

-
name: Sylius 1.8 conflicts
if: matrix.sylius == '1.8.*'
run: |
composer require sylius-labs/doctrine-migrations-extra-bundle --no-interaction --no-update
cp etc/travis/sylius18/bundles.php tests/Application/config/
cp etc/travis/sylius18/doctrine_migrations.yaml tests/Application/config/packages/
cp etc/travis/sylius18/lexik_jwt_authentication.yaml tests/Application/config/packages/
cp etc/travis/sylius18/security.yaml tests/Application/config/packages/
cp etc/travis/sylius18/sylius_api.yaml tests/Application/config/routes/
rm tests/Application/src/Migrations/Version20200604080033.php
-
name: Shutdown default MySQL
run: sudo service mysql stop

-
name: Setup MySQL
uses: mirromutth/[email protected]
with:
mysql version: "${{ matrix.mysql }}"
mysql root password: "root"

-
name: Run Chrome Headless
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: Run webserver
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)

-
name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

-
name: Cache Composer
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-composer-
-
name: Install PHP dependencies
run: composer install --no-interaction

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

-
name: 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: Install JS dependencies
run: (cd tests/Application && yarn install)

-
name: Prepare test application database
run: |
cp -R migrations/* tests/Application/src/Migrations/
(cd tests/Application && bin/console doctrine:database:create -vvv)
(cd tests/Application && bin/console doctrine:migrations:migrate -n -vvv -q)
-
name: Prepare test application assets
run: |
(cd tests/Application && bin/console assets:install public -vvv)
(cd tests/Application && yarn build)
composer link-templates
-
name: Prepare test application cache
run: (cd tests/Application && bin/console cache:warmup -vvv)

-
name: Load fixtures in test application
run: (cd tests/Application && bin/console sylius:fixtures:load -n)

-
name: Run analysis
run: composer analyse

-
name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction

-
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always

-
name: Run Behat
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun

-
name: Upload Behat logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: Behat logs
path: etc/build/
if-no-files-found: ignore
91 changes: 0 additions & 91 deletions .travis.yml

This file was deleted.

7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@
}
},
"scripts": {
"fix": [
"vendor/bin/ecs check src/ spec/ --fix"
],
"analyse": [
"@composer validate --strict",
"vendor/bin/ecs check src/ spec/",
"vendor/bin/phpstan.phar analyse -c phpstan.neon -l max src/",
"vendor/bin/psalm"
],
"fix": [
"vendor/bin/ecs check src/ spec/ --fix"
],
"link-templates": [
"ln -s $(pwd)/src/Resources/views/bundles/* $(pwd)/tests/Application/templates/bundles"
]
Expand Down

0 comments on commit e42eea2

Please sign in to comment.