Skip to content

Commit

Permalink
Merge pull request #24 from ARCANEDEV/update-github_actions
Browse files Browse the repository at this point in the history
Using GitHub Actions for testing
  • Loading branch information
arcanedev-maroc authored Feb 15, 2020
2 parents c4bb764 + f47c9b7 commit 080672b
Show file tree
Hide file tree
Showing 32 changed files with 273 additions and 191 deletions.
10 changes: 5 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpunit.xml.dist export-ignore
CONTRIBUTING.md export-ignore
55 changes: 55 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: run-tests

on: [push]

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4]
laravel: [6.*]
dependency-version: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}

services:
redis:
image: redis
ports:
- 6379/tcp
options: --health-cmd="redis-cli 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: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
coverage: xdebug

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: |
mkdir -p build/logs
vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
env:
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}

- name: Scrutinizer CI
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 2
runs: 6
php_code_sniffer:
enabled: true
config:
Expand Down
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017-2019 | ARCANEDEV <[email protected]> - LaravelImpersonator
Copyright (c) 2017-2020 | ARCANEDEV <[email protected]> - LaravelImpersonator

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LaravelSettings [![Packagist License][badge_license]](LICENSE.md) [![For Laravel][badge_laravel]][link-github-repo]

[![Travis Status][badge_build]][link-travis]
[![Github Workflow Status][badge_build]][link-github-status]
[![Coverage Status][badge_coverage]][link-scrutinizer]
[![Scrutinizer Code Quality][badge_quality]][link-scrutinizer]
[![SensioLabs Insight][badge_insight]][link-insight]
Expand Down Expand Up @@ -46,7 +46,7 @@ Any ideas are welcome. Feel free to submit any issues or pull requests, please c

[badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-settings.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.2%20to%206.x-orange.svg?style=flat-square
[badge_build]: https://img.shields.io/travis/ARCANEDEV/LaravelSettings.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/LaravelSettings/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelSettings.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/LaravelSettings.svg?style=flat-square
[badge_insight]: https://img.shields.io/sensiolabs/i/1ba3f1b4-4475-4db5-8f99-0af6fb6a80be.svg?style=flat-square
Expand All @@ -57,9 +57,9 @@ Any ideas are welcome. Feel free to submit any issues or pull requests, please c

[link-author]: https://github.com/arcanedev-maroc
[link-github-repo]: https://github.com/ARCANEDEV/LaravelSettings
[link-github-status]: https://github.com/ARCANEDEV/LaravelSettings/actions
[link-github-issues]: https://github.com/ARCANEDEV/LaravelSettings/issues
[link-contributors]: https://github.com/ARCANEDEV/LaravelSettings/graphs/contributors
[link-packagist]: https://packagist.org/packages/arcanedev/laravel-settings
[link-travis]: https://travis-ci.org/ARCANEDEV/LaravelSettings
[link-scrutinizer]: https://scrutinizer-ci.com/g/ARCANEDEV/LaravelSettings/?branch=master
[link-insight]: https://insight.sensiolabs.com/projects/1ba3f1b4-4475-4db5-8f99-0af6fb6a80be
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require": {
"php": ">=7.2.0",
"ext-json": "*",
"arcanedev/support": "^5.0"
"arcanedev/support": "^5.1.1"
},
"require-dev": {
"orchestra/testbench": "^4.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Arcanedev\Support\Database\Migration;
use Illuminate\Database\Schema\Blueprint;

Expand Down Expand Up @@ -32,9 +34,9 @@ public function __construct()
/**
* {@inheritdoc}
*/
public function up()
public function up(): void
{
$this->createSchema(function(Blueprint $table) {
$this->createSchema(function(Blueprint $table): void {
$table->unsignedBigInteger('user_id')->default(0);
$table->string('key');
$table->text('value');
Expand Down
2 changes: 2 additions & 0 deletions helpers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Arcanedev\LaravelSettings\Contracts\Manager;

if ( ! function_exists('settings')) {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="DB_CONNECTION" value="testing"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="testing"/>
<env name="SESSION_DRIVER" value="array"/>
</php>
<logging>
Expand Down
10 changes: 7 additions & 3 deletions src/Contracts/Manager.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelSettings\Contracts;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelSettings\Contracts;

use Closure;

Expand Down Expand Up @@ -49,7 +53,7 @@ public function driver($driver = null);
* @param string $driver
* @param \Closure $callback
*
* @return \Arcanedev\LaravelSettings\Contracts\Manager
* @return $this
*/
public function extend($driver, Closure $callback);

Expand All @@ -59,7 +63,7 @@ public function extend($driver, Closure $callback);
* @param string $driver
* @param array $params
*
* @return \Arcanedev\LaravelSettings\Contracts\Manager
* @return $this
*/
public function registerStore(string $driver, array $params);
}
14 changes: 9 additions & 5 deletions src/Contracts/Store.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelSettings\Contracts;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelSettings\Contracts;

/**
* Interface Store
Expand Down Expand Up @@ -38,7 +42,7 @@ public function has($key);
* @param string|array $key
* @param mixed $value
*
* @return self
* @return $this
*/
public function set($key, $value = null);

Expand All @@ -47,14 +51,14 @@ public function set($key, $value = null);
*
* @param string $key
*
* @return self
* @return $this
*/
public function forget($key);

/**
* Flushing all data.
*
* @return self
* @return $this
*/
public function flush();

Expand All @@ -68,7 +72,7 @@ public function all();
/**
* Save any changes done to the settings data.
*
* @return self
* @return $this
*/
public function save();

Expand Down
6 changes: 5 additions & 1 deletion src/Middleware/SaveSettings.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelSettings\Middleware;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelSettings\Middleware;

use Arcanedev\LaravelSettings\Contracts\Store;
use Closure;
Expand Down
6 changes: 5 additions & 1 deletion src/Models/Setting.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelSettings\Models;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelSettings\Models;

use Arcanedev\Support\Database\Model;

Expand Down
13 changes: 9 additions & 4 deletions src/SettingsManager.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php namespace Arcanedev\LaravelSettings;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelSettings;

use Arcanedev\LaravelSettings\Contracts\Store as StoreContract;
use Arcanedev\LaravelSettings\Contracts\Manager as SettingsManagerContract;
use Illuminate\Support\{Arr, Manager};

Expand Down Expand Up @@ -35,7 +40,7 @@ class SettingsManager extends Manager implements SettingsManagerContract
*/
public function getDefaultDriver()
{
return $this->container['config']->get('settings.default', 'json');
return $this->config->get('settings.default', 'json');
}

/**
Expand All @@ -44,11 +49,11 @@ public function getDefaultDriver()
* @param string $driver
* @param array $params
*
* @return \Arcanedev\LaravelSettings\SettingsManager
* @return $this
*/
public function registerStore(string $driver, array $params)
{
return $this->extend($driver, function () use ($params) {
return $this->extend($driver, function () use ($params) : StoreContract {
return $this->container->make($params['driver'], [
'options' => Arr::get($params, 'options', []),
]);
Expand Down
13 changes: 9 additions & 4 deletions src/SettingsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php namespace Arcanedev\LaravelSettings;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelSettings;

use Arcanedev\LaravelSettings\Contracts\Manager as ManagerContract;
use Arcanedev\LaravelSettings\Contracts\Store as StoreContract;
use Arcanedev\Support\Providers\PackageServiceProvider;
use Illuminate\Contracts\Support\DeferrableProvider;

Expand Down Expand Up @@ -59,8 +64,8 @@ public function boot(): void
public function provides(): array
{
return [
Contracts\Manager::class,
Contracts\Store::class,
ManagerContract::class,
StoreContract::class,
];
}

Expand All @@ -76,7 +81,7 @@ private function registerSettingsManager(): void
{
$this->singleton(ManagerContract::class, SettingsManager::class);

$this->singleton(Contracts\Store::class, function ($app) {
$this->singleton(StoreContract::class, function ($app): StoreContract {
return $app[ManagerContract::class]->driver();
});

Expand Down
Loading

0 comments on commit 080672b

Please sign in to comment.