Skip to content

Commit

Permalink
Update illuminate up to 6.x (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
korobovn authored and tarampampam committed Oct 22, 2019
1 parent db6c4a4 commit 47cb735
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Fixes # (issue)
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I wrote unit tests for my code
- [ ] I wrote unit tests for my code _(if tests is required for my changes)_
- [ ] I have made changes in [CHANGELOG.md](https://github.com/avto-dev/data-migrations-laravel/blob/master/CHANGELOG.md) file

> About your changes in `CHANGELOG.md`:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/execute-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Execute tests

on:
push:
branches:
- master
tags-ignore:
- '**'
pull_request:

jobs: # Docs: <https://help.github.com/en/articles/workflow-syntax-for-github-actions>
tests:
name: PHP ${{ matrix.php }}, ${{ matrix.setup }} setup
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
setup: ['basic', 'lowest']
php: ['7.1', '7.2', '7.3']
steps:
- name: Check out code
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master # Action page: <https://github.com/shivammathur/setup-php>
with:
php-version: ${{ matrix.php }}

- name: Install Composer 'hirak/prestissimo' package
run: composer global require hirak/prestissimo --update-no-dev

- name: Install lowest Composer dependencies
if: matrix.setup == 'lowest'
run: composer update --prefer-dist --no-interaction --no-suggest --prefer-lowest

- name: Install basic Composer dependencies
if: matrix.setup == 'basic'
run: composer update --prefer-dist --no-interaction --no-suggest

- name: Show most important packages versions
run: composer info | grep -e laravel/laravel -e phpunit/phpunit -e phpstan/phpstan

- name: Execute tests
run: composer test
21 changes: 11 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
- setup=basic
- coverage=false
- laravel=default
- phpunit=default

sudo: false

Expand All @@ -25,6 +26,7 @@ install:
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-lowest; fi
- if [[ $laravel != 'default' ]]; then travis_retry composer require --dev --update-with-dependencies --prefer-dist --no-interaction --no-suggest laravel/laravel "$laravel"; fi
- if [[ $phpunit != 'default' ]]; then travis_retry composer require --dev --update-with-dependencies --prefer-dist --no-interaction --no-suggest phpunit/phpunit "$phpunit"; fi
- composer info | grep -e laravel/laravel -e phpunit/phpunit -e phpstan/phpstan

script:
Expand All @@ -35,35 +37,34 @@ after_success:

matrix:
include:
- php: 7.1.3
- php: 7.1.3
env: setup=lowest
- php: 7.1.3
env: laravel=5.6
env: laravel=5.5 phpunit=~6.4
- php: 7.1.3
env: laravel=5.7
env: laravel=5.6
- php: 7.1.3
env: coverage=true

- php: 7.2
- php: 7.2
env: setup=lowest
- php: 7.2
env: laravel=5.6
env: laravel=5.8
- php: 7.2
env: laravel=5.7
- php: 7.2
env: coverage=true
env: coverage=true laravel=6.*

- php: 7.3
- php: 7.3
env: setup=lowest
- php: 7.3
env: laravel=5.5 phpunit=~6.4
- php: 7.3
env: laravel=5.6
- php: 7.3
env: laravel=5.7
- php: 7.3
env: coverage=true
env: laravel=5.8
- php: 7.3
env: coverage=true laravel=6.*

- php: nightly

Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].

## v2.1.0

### Changed

- Maximal `illuminate/*` packages version now is `6.*`

### Added

- GitHub actions for a tests running

## v2.0.0

### Added
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM composer:1.8.6 AS composer

FROM php:7.1.3-alpine
FROM php:7.2.0-alpine

ENV \
COMPOSER_ALLOW_SUPERUSER="1" \
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
"require": {
"php": "^7.1.3",
"ext-pdo": "*",
"illuminate/support": ">=5.5.0 <5.9.0",
"illuminate/config": ">=5.5.0 <5.9.0",
"illuminate/database": ">=5.5.0 <5.9.0",
"illuminate/filesystem": ">=5.5.0 <5.9.0",
"illuminate/console": ">=5.5.0 <5.9.0",
"illuminate/contracts": ">=5.5.0 <5.9.0"
"illuminate/support": ">=5.5.0 <5.9.0 || ~6.0",
"illuminate/config": ">=5.5.0 <5.9.0 || ~6.0",
"illuminate/database": ">=5.5.0 <5.9.0 || ~6.0",
"illuminate/filesystem": ">=5.5.0 <5.9.0 || ~6.0",
"illuminate/console": ">=5.5.0 <5.9.0 || ~6.0",
"illuminate/contracts": ">=5.5.0 <5.9.0 || ~6.0"
},
"require-dev": {
"ext-pdo_sqlite": "*",
"ext-sqlite3": "*",
"ext-zlib": "*",
"laravel/laravel": ">=5.5.0 <5.9.0",
"laravel/laravel": ">=5.5.0 <5.9.0 || ~6.0",
"mockery/mockery": "^1.0",
"phpstan/phpstan": "^0.11.3",
"phpunit/phpunit": "^6.4 || ~7.5"
Expand Down
3 changes: 2 additions & 1 deletion src/Commands/MigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace AvtoDev\DataMigrationsLaravel\Commands;

use Illuminate\Support\Arr;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use AvtoDev\DataMigrationsLaravel\Migrator;
Expand Down Expand Up @@ -47,7 +48,7 @@ public function handle(MigratorContract $migrator): void
$this->call('data-migrate:install');
}

if (! empty($need_to_migrate = array_flatten($migrator->needToMigrateList()))) {
if (! empty($need_to_migrate = Arr::flatten($migrator->needToMigrateList()))) {
/** @var ProgressBar|null $progress */
$progress = null;

Expand Down
3 changes: 2 additions & 1 deletion src/Commands/StatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace AvtoDev\DataMigrationsLaravel\Commands;

use Illuminate\Support\Arr;
use Illuminate\Console\Command;
use AvtoDev\DataMigrationsLaravel\Contracts\SourceContract;
use AvtoDev\DataMigrationsLaravel\Contracts\RepositoryContract;
Expand Down Expand Up @@ -40,7 +41,7 @@ public function handle(RepositoryContract $repository, SourceContract $source):
return;
}

$summary = array_unique(array_merge($migrated = $repository->migrations(), array_flatten($source->all())));
$summary = array_unique(array_merge($migrated = $repository->migrations(), Arr::flatten($source->all())));

if (\count($summary) > 0) {
$table_rows = array_map(function ($migration_name) use (&$migrated) {
Expand Down
2 changes: 1 addition & 1 deletion src/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function migrate(?string $connection_name = null, ?Closure $migrating_clo
{
$migrated = [];

if (! empty($all_migrations = array_flatten($not_migrated = $this->needToMigrateList()))) {
if (! empty($all_migrations = Arr::flatten($not_migrated = $this->needToMigrateList()))) {
// Leave only passed connection name, if passed
if ($connection_name !== null) {
$not_migrated = array_filter($not_migrated, function ($not_migrated_connection) use ($connection_name) {
Expand Down
3 changes: 2 additions & 1 deletion tests/Commands/MigrateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace AvtoDev\DataMigrationsLaravel\Tests\Commands;

use Mockery as m;
use Illuminate\Support\Arr;
use Illuminate\Contracts\Console\Kernel;
use AvtoDev\DataMigrationsLaravel\Commands\MigrateCommand;
use AvtoDev\DataMigrationsLaravel\Contracts\MigratorContract;
Expand Down Expand Up @@ -48,7 +49,7 @@ public function testRepositoryAutoCreation(): void
public function testCommandExecution(): void
{
$not_migrated = ['2000_01_01_000020_simple_sql_data.sql'];
$all = array_flatten($this->migrator->source()->all());
$all = Arr::flatten($this->migrator->source()->all());
$filtered = array_filter($all, function ($migration_name) use (&$not_migrated) {
return ! in_array($migration_name, $not_migrated, true);
});
Expand Down
3 changes: 2 additions & 1 deletion tests/Commands/StatusCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AvtoDev\DataMigrationsLaravel\Tests\Commands;

use Illuminate\Support\Arr;
use AvtoDev\DataMigrationsLaravel\Contracts\MigratorContract;
use AvtoDev\DataMigrationsLaravel\DataMigrationsServiceProvider;

Expand Down Expand Up @@ -33,7 +34,7 @@ public function setUp(): void
public function testCommandExecution(): void
{
$not_migrated = ['2000_01_01_000020_simple_sql_data.sql'];
$all = array_flatten($this->migrator->source()->all());
$all = Arr::flatten($this->migrator->source()->all());
$filtered = array_filter($all, function ($migration_name) use (&$not_migrated) {
return ! in_array($migration_name, $not_migrated, true);
});
Expand Down
3 changes: 2 additions & 1 deletion tests/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AvtoDev\DataMigrationsLaravel\Tests;

use Illuminate\Support\Arr;
use AvtoDev\DataMigrationsLaravel\Migrator;
use AvtoDev\DataMigrationsLaravel\Sources\Files;
use AvtoDev\DataMigrationsLaravel\Contracts\SourceContract;
Expand Down Expand Up @@ -224,7 +225,7 @@ protected function assertRepositoryHasNotMigrations(array $migrations_names)
*/
protected function initRepositoryExcepts(array $migrations_names)
{
$all = array_flatten($this->migrator->source()->all());
$all = Arr::flatten($this->migrator->source()->all());
$filtered = array_filter($all, function ($migration_name) use (&$migrations_names) {
return ! in_array($migration_name, $migrations_names, true);
});
Expand Down

0 comments on commit 47cb735

Please sign in to comment.