diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..093a1c7 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,60 @@ +name: tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + php: [7.4, 7.3, 7.2] + laravel: [8.*, 7.*, 6.*, 5.8.*] + dependency-version: [prefer-lowest, prefer-stable] + os: [ubuntu-latest] + include: + - laravel: 8.* + testbench: 6.* + - laravel: 7.* + testbench: 5.* + - laravel: 6.* + testbench: 4.* + - laravel: 5.8.* + testbench: 3.8.* + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: laravel-discounts + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.composer/cache/files + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v1 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick + coverage: none + + - name: Install dependencies + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest + + - name: Execute tests + run: vendor/bin/phpunit + env: + DB_PORT: ${{ job.services.mysql.ports[3306] }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e0cf461..0000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -language: php - -matrix: - fast_finish: true - include: - - php: 7.1 - env: LARAVEL='5.7.*' COMPOSER_FLAGS='--prefer-stable' - - php: 7.2 - env: LARAVEL='6.*' COMPOSER_FLAGS='--prefer-lowest' - - php: 7.2 - env: LARAVEL='6.*' COMPOSER_FLAGS='--prefer-stable' - - php: 7.3 - env: LARAVEL='6.*' COMPOSER_FLAGS='--prefer-lowest' - - php: 7.3 - env: LARAVEL='6.*' COMPOSER_FLAGS='--prefer-stable' - - php: 7.2 - env: LARAVEL='7.*' COMPOSER_FLAGS='--prefer-lowest' - - php: 7.2 - env: LARAVEL='7.*' COMPOSER_FLAGS='--prefer-stable' - - php: 7.3 - env: LARAVEL='7.*' COMPOSER_FLAGS='--prefer-lowest' - - php: 7.3 - env: LARAVEL='7.*' COMPOSER_FLAGS='--prefer-stable' - - php: 7.3 - env: LARAVEL='8.*' COMPOSER_FLAGS='--prefer-lowest' - - php: 7.3 - env: LARAVEL='8.*' COMPOSER_FLAGS='--prefer-stable' - -before_install: - - composer self-update - - composer require --no-update --no-interaction "illuminate/database:${LARAVEL}" "illuminate/support:${LARAVEL}" - -install: - - phpenv config-rm xdebug.ini - - composer update ${COMPOSER_FLAGS} --no-interaction --no-suggest --prefer-dist - -script: - - vendor/bin/phpunit diff --git a/README.md b/README.md index d714eae..6787a72 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ $item = Item::find(1); $item->createDiscount(100); ``` +## Requirements +The Laravel Discounts package requires **PHP 7.2** or above and **Laravel 5.8** or above. ## Installation diff --git a/composer.json b/composer.json index d16dc42..aa4d409 100644 --- a/composer.json +++ b/composer.json @@ -10,13 +10,13 @@ } ], "require": { - "php": "^7.1", - "illuminate/database": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0", - "illuminate/support": "~5.5.0|~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0" + "php": "^7.2", + "illuminate/database": "~5.8.0|^6.0|^7.0|^8.0", + "illuminate/support": "~5.8.0|^6.0|^7.0|^8.0" }, "require-dev": { "phpunit/phpunit": "^7.0|^8.0|^9.0", - "orchestra/testbench": "~3.6.0|~3.7.0|~3.8.0|^4.0|^5.0|^6.0" + "orchestra/testbench": "~3.8.0|^4.0|^5.0|^6.0" }, "autoload": { "psr-4": {