Skip to content

Commit

Permalink
Add CI and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Feb 17, 2020
1 parent eb225e1 commit 3ada691
Show file tree
Hide file tree
Showing 88 changed files with 973 additions and 240 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@

/behat.yml
/phpspec.yml

/package-lock.json

/.php-version
/.phpunit.result.cache
39 changes: 6 additions & 33 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ sudo: false

php:
- '7.2'
- '7.3'

cache:
yarn: true
Expand All @@ -18,7 +17,6 @@ env:
global:
- APP_ENV=test
- SYLIUS_CACHE_DIR=$HOME/.sylius-cache
- SYLIUS_BUILD_DIR=etc/build

before_install:
- phpenv config-rm xdebug.ini
Expand All @@ -30,48 +28,23 @@ install:
- (cd tests/Application && yarn install)

before_script:
- ln -s tests/Application/node_modules node_modules
- (cd tests/Application && bin/console doctrine:database:create -vvv)
- (cd tests/Application && bin/console doctrine:schema:create -vvv)
- (cd tests/Application && bin/console assets:install public -vvv)
- (cd tests/Application && bin/console cache:warmup -vvv)
- (cd tests/Application && yarn build)

# Configure display
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16
- export DISPLAY=:99

# Download and configure ChromeDriver
- |
if [ ! -f $SYLIUS_CACHE_DIR/chromedriver ] || [ "$($SYLIUS_CACHE_DIR/chromedriver --version | grep -c 2.34)" = "0" ]; then
curl http://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip > chromedriver.zip
unzip chromedriver.zip
chmod +x chromedriver
mv chromedriver $SYLIUS_CACHE_DIR
fi
# Run ChromeDriver
- $SYLIUS_CACHE_DIR/chromedriver > /dev/null 2>&1 &

# Download and configure Selenium
- |
if [ ! -f $SYLIUS_CACHE_DIR/selenium.jar ] || [ "$(java -jar $SYLIUS_CACHE_DIR/selenium.jar --version | grep -c 3.4.0)" = "0" ]; then
curl http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar > selenium.jar
mv selenium.jar $SYLIUS_CACHE_DIR
fi
# Run Selenium
- java -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver -jar $SYLIUS_CACHE_DIR/selenium.jar > /dev/null 2>&1 &

# Run webserver
- (cd tests/Application && bin/console server:run 127.0.0.1:8080 --quiet > /dev/null 2>&1 &)

script:
- composer validate
- vendor/bin/phpstan analyse -c phpstan.neon -l max src/
- composer validate --strict
- vendor/bin/phpstan analyse -c phpstan.neon src/

- vendor/bin/phpunit
- vendor/bin/phpspec run
- vendor/bin/behat --strict -vvv --no-interaction || vendor/bin/behat --strict -vvv --no-interaction --rerun

after_failure:
- vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles "${SYLIUS_BUILD_DIR}/*.log"
branches:
only:
- master
7 changes: 7 additions & 0 deletions LICENCE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2020 Monsieur Biz

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50 changes: 34 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,54 @@
# Monsieur Biz Sylius sales report plugin
<p align="center">
<a href="https://monsieurbiz.com" target="_blank">
<img src="https://monsieurbiz.com/logo.png" width="250px" />
</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://sylius.com" target="_blank">
<img src="https://demo.sylius.com/assets/shop/img/logo.png" width="200px" />
</a>
</p>

## Install
<h1 align="center">Sales Reports</h1>

Without symfony binary :

`composer require monsieurbiz/sylius-sales-reports-plugin=dev-master`

With symfony binary :

`symfony composer require monsieurbiz/sylius-sales-reports-plugin=dev-master`
[![Sales Reports Plugin license](https://img.shields.io/github/license/monsieurbiz/SyliusSalesReportsPlugin)](https://github.com/monsieurbiz/SyliusSalesReportsPlugin/blob/master/LICENSE.txt)
[![Build Status](https://travis-ci.com/monsieurbiz/SyliusSalesReportsPlugin.svg?branch=master)](https://travis-ci.com/monsieurbiz/SyliusSalesReportsPlugin)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/monsieurbiz/SyliusSalesReportsPlugin/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/monsieurbiz/SyliusSalesReportsPlugin/?branch=master)

> We will make tagged release when the plugin development will be ended. Use it carefully until this moment
A simple plugin to have sales reports in Sylius

## Configure

Edit your `config/bundles.php` to add this line :
## Installation

```bash
`composer require monsieurbiz/sylius-sales-reports-plugin
```

Change your `config/bundles.php` file to add the line for the plugin :

```php
<?php
return [
//..
MonsieurBiz\SyliusSalesReportsPlugin\MonsieurBizSyliusSalesReportsPlugin::class => ['all' => true],
```
];
```

Import plugin config in `config/packages/monsieur_biz_sales_reports_plugin.yaml` :
Then create the config file in `config/packages/monsieur_biz_sales_reports_plugin.yaml` :

```yaml
imports:
- { resource: "@MonsieurBizSyliusSalesReportsPlugin/Resources/config/config.yaml" }
```
Import plugin routing in `config/routes.yaml` :
Finally import the routes in `config/routes.yaml` :
```yaml
monsieur_biz_sales_reports_plugin:
resource: "@MonsieurBizSyliusSalesReportsPlugin/Resources/config/routing.yaml"
```
## Contributing
You can open an issue or a Pull Request if you want! 😘
Thank you!
55 changes: 55 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Testing

## Installation

1. From the plugin root directory, run the following commands:

```bash
$ (cd tests/Application && yarn install)
$ (cd tests/Application && yarn build)
$ (cd tests/Application && bin/console assets:install public -e test)

$ (cd tests/Application && bin/console doctrine:database:create -e test)
$ (cd tests/Application && bin/console doctrine:schema:create -e test)
```

To be able to setup the plugin's database, remember to configure your database credentials in `tests/Application/.env`
and `tests/Application/.env.test`. You can also add custom configuration in `tests/Application/.env.test.local`.
## Usage
### Running plugin tests
- PHPUnit
```bash
$ vendor/bin/phpunit
```
- PHPSpec
```bash
$ vendor/bin/phpspec run
```
- PHPStan
```bash
$ vendor/bin/phpstan analyse src
```
### Opening Sylius with the plugin
- Using `test` environment:
```bash
$ (cd tests/Application && bin/console sylius:fixtures:load -e test)
$ (cd tests/Application && bin/console server:run -d public -e test)
```
- Using `dev` environment:
```bash
$ (cd tests/Application && bin/console sylius:fixtures:load -e dev)
$ (cd tests/Application && bin/console server:run -d public -e dev)
```
28 changes: 0 additions & 28 deletions UPGRADE-1.3.md

This file was deleted.

86 changes: 0 additions & 86 deletions UPGRADE-1.4.md

This file was deleted.

47 changes: 0 additions & 47 deletions behat.yml.dist

This file was deleted.

Loading

0 comments on commit 3ada691

Please sign in to comment.