Skip to content
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

Switch from Travis to GitHub Actions #227

Merged
merged 4 commits into from
Nov 11, 2020
Merged
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
159 changes: 159 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
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 }}, Node ${{ matrix.node }}"

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

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: 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: Output PHP version for Symfony CLI
run: php -v | head -n 1 | awk '{ print $2 }' > .php-version

-
name: Install certificates
run: symfony server:ca:install

-
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: |
(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)

-
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
79 changes: 0 additions & 79 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"friends-of-phpspec/phpspec-code-coverage": "^4.3",
"lakion/mink-debug-extension": "^1.2.3",
"phpspec/phpspec": "^6.0",
"phpstan/phpstan": "0.12.29",
Expand All @@ -62,12 +61,13 @@
"symplify/package-builder": "^8.3.25"
},
"scripts": {
"fix": [
"vendor/bin/ecs check src/ spec/ --fix"
],
"analyse": [
"@composer validate --strict",
"vendor/bin/phpstan.phar analyse -c phpstan.neon -l max src/",
"vendor/bin/ecs check src/ spec/"
],
"fix": [
"vendor/bin/ecs check src/ spec/ --fix"
]
},
"config": {
Expand Down
18 changes: 0 additions & 18 deletions phpspec.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,3 @@ suites:
sylius_refund:
namespace: Sylius\RefundPlugin
psr4_prefix: Sylius\RefundPlugin

extensions:
FriendsOfPhpSpec\PhpSpec\CodeCoverage\CodeCoverageExtension:
blacklist:
- src/Action #controllers should not be unit tests, as they only translates request to response (with some operations in the meantime)
- src/DependencyInjection #configuration
- src/Entity #anemic classes with no logic
- src/File/TemporaryFileManager.php #covered with phpunit
- src/Form #builders, no value in testing them
- src/Menu #builders, no value in testing them
- src/StateResolver/OrderTransitions.php #only constants
- src/StateResolver/RefundPaymentTransitions.php #only constants
- src/SyliusRefundPlugin.php #configuration
- src/Twig #covered with behat (strictly UI-oriented classes)
format:
- text
lower_upper_bound: 95
high_lower_bound: 100