Skip to content

Commit

Permalink
Merge pull request #148 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 5, 2020
2 parents 4c5588b + f1889c7 commit 373aa76
Show file tree
Hide file tree
Showing 58 changed files with 560 additions and 306 deletions.
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
46 changes: 46 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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 }}

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, intl
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
- name: Scrutinizer CI
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
4 changes: 2 additions & 2 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ checks:

tools:
external_code_coverage:
timeout: 1200
runs: 2
timeout: 600
runs: 6
php_code_sniffer:
enabled: true
config:
Expand Down
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Localization [![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 @@ -53,7 +53,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.

[badge_license]: http://img.shields.io/packagist/l/arcanedev/localization.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.x%20|%206.x-orange.svg?style=flat-square
[badge_build]: http://img.shields.io/travis/ARCANEDEV/Localization.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/Localization/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/Localization.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/Localization.svg?style=flat-square
[badge_insight]: https://img.shields.io/sensiolabs/i/30a231b2-295e-466a-8733-fe95cf2bc48d.svg?style=flat-square
Expand All @@ -64,9 +64,9 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.

[link-author]: https://github.com/arcanedev-maroc
[link-github-repo]: https://github.com/ARCANEDEV/Localization
[link-github-status]: https://github.com/ARCANEDEV/localization/actions
[link-github-issues]: https://github.com/ARCANEDEV/Localization/issues
[link-contributors]: https://github.com/ARCANEDEV/Localization/graphs/contributors
[link-packagist]: https://packagist.org/packages/arcanedev/localization
[link-travis]: https://travis-ci.org/ARCANEDEV/Localization
[link-scrutinizer]: https://scrutinizer-ci.com/g/ARCANEDEV/Localization/?branch=master
[link-insight]: https://insight.sensiolabs.com/projects/30a231b2-295e-466a-8733-fe95cf2bc48d
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
"require": {
"php": ">=7.2.0",
"ext-json": "*",
"arcanedev/support": "^5.0"
"arcanedev/support": "^5.1"
},
"require-dev": {
"ext-intl": "*",
"orchestra/testbench": "^4.0",
"mockery/mockery": "^1.0",
"mockery/mockery": "^1.3.1",
"phpunit/phpcov": "^6.0",
"phpunit/phpunit": "^8.0"
},
Expand Down
8 changes: 6 additions & 2 deletions helpers.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<?php

declare(strict_types=1);

use Arcanedev\Localization\Contracts\Localization;

if ( ! function_exists('localization')) {
/**
* Get the Localization instance.
*
* @return Arcanedev\Localization\Contracts\Localization
*/
function localization()
function localization(): Localization
{
return app(Arcanedev\Localization\Contracts\Localization::class);
return app(Localization::class);
}
}

Expand Down
12 changes: 8 additions & 4 deletions src/Contracts/LocalesManager.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\Localization\Contracts;
<?php

declare(strict_types=1);

namespace Arcanedev\Localization\Contracts;

/**
* Interface LocalesManager
Expand Down Expand Up @@ -34,7 +38,7 @@ public function getDefaultLocale();
*
* @param string $defaultLocale
*
* @return self
* @return $this
*/
public function setDefaultLocale($defaultLocale = null);

Expand All @@ -50,7 +54,7 @@ public function getCurrentLocale();
*
* @param string $currentLocale
*
* @return self
* @return $this
*/
public function setCurrentLocale($currentLocale);

Expand Down Expand Up @@ -87,7 +91,7 @@ public function getSupportedLocalesKeys();
*
* @param array $supportedLocales
*
* @return self
* @return $this
*/
public function setSupportedLocales(array $supportedLocales);

Expand Down
8 changes: 7 additions & 1 deletion src/Contracts/Localization.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\Localization\Contracts;
<?php

declare(strict_types=1);

namespace Arcanedev\Localization\Contracts;

use Illuminate\Http\Request;

Expand Down Expand Up @@ -114,6 +118,8 @@ public function setLocale($locale = null);
* Sets the base url for the site.
*
* @param string $url
*
* @return $this
*/
public function setBaseUrl($url);

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

declare(strict_types=1);

namespace Arcanedev\Localization\Contracts;

use Arcanedev\Localization\Entities\LocaleCollection;
use Illuminate\Http\Request;
Expand Down
6 changes: 5 additions & 1 deletion src/Contracts/RouteBindable.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\Localization\Contracts;
<?php

declare(strict_types=1);

namespace Arcanedev\Localization\Contracts;

/**
* Interface RouteBindable
Expand Down
6 changes: 5 additions & 1 deletion src/Contracts/RouteTranslator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\Localization\Contracts;
<?php

declare(strict_types=1);

namespace Arcanedev\Localization\Contracts;

use Arcanedev\Localization\Entities\LocaleCollection;

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

declare(strict_types=1);

namespace Arcanedev\Localization\Contracts;

/**
* Interface Url
Expand Down
22 changes: 13 additions & 9 deletions src/Entities/Locale.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\Localization\Entities;
<?php

declare(strict_types=1);

namespace Arcanedev\Localization\Entities;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
Expand Down Expand Up @@ -115,7 +119,7 @@ public function key()
*
* @param string $key
*
* @return self
* @return $this
*/
private function setKey($key)
{
Expand All @@ -140,7 +144,7 @@ public function name()
*
* @param string $name
*
* @return self
* @return $this
*/
private function setName($name)
{
Expand All @@ -164,7 +168,7 @@ public function script()
*
* @param string $script
*
* @return self
* @return $this
*/
private function setScript($script)
{
Expand Down Expand Up @@ -194,7 +198,7 @@ public function direction()
*
* @param string $direction
*
* @return self
* @return $this
*/
private function setDirection($direction)
{
Expand All @@ -219,7 +223,7 @@ public function native()
*
* @param string $native
*
* @return self
* @return $this
*/
private function setNative($native)
{
Expand All @@ -243,7 +247,7 @@ public function regional()
*
* @param string $regional
*
* @return self
* @return $this
*/
private function setRegional($regional)
{
Expand All @@ -265,7 +269,7 @@ public function isDefault()
/**
* Set locale default.
*
* @return self
* @return $this
*/
private function setDefault()
{
Expand All @@ -285,7 +289,7 @@ private function setDefault()
* @param string $key
* @param array $data
*
* @return self
* @return $this
*/
public static function make($key, array $data)
{
Expand Down
12 changes: 8 additions & 4 deletions src/Entities/LocaleCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\Localization\Entities;
<?php

declare(strict_types=1);

namespace Arcanedev\Localization\Entities;

use Illuminate\Support\Collection;

Expand Down Expand Up @@ -32,7 +36,7 @@ class LocaleCollection extends Collection
*
* @param array $supported
*
* @return self
* @return $this
*/
public function setSupportedKeys(array $supported)
{
Expand Down Expand Up @@ -88,7 +92,7 @@ public function toNative()
/**
* Load from config.
*
* @return self
* @return $this
*/
public function loadFromConfig()
{
Expand All @@ -101,7 +105,7 @@ public function loadFromConfig()
*
* @param array $locales
*
* @return self
* @return $this
*/
public function loadFromArray(array $locales)
{
Expand Down
6 changes: 5 additions & 1 deletion src/Entities/SupportedLocaleCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\Localization\Entities;
<?php

declare(strict_types=1);

namespace Arcanedev\Localization\Entities;

use Illuminate\Support\Collection;

Expand Down
6 changes: 4 additions & 2 deletions src/Events/TranslationHasBeenSet.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php namespace Arcanedev\Localization\Events;
<?php

use Illuminate\Database\Eloquent\Model;
declare(strict_types=1);

namespace Arcanedev\Localization\Events;

/**
* Class TranslationHasBeenSet
Expand Down
6 changes: 5 additions & 1 deletion src/Exceptions/InvalidTranslationException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\Localization\Exceptions;
<?php

declare(strict_types=1);

namespace Arcanedev\Localization\Exceptions;

/**
* Class InvalidTranslationException
Expand Down
Loading

0 comments on commit 373aa76

Please sign in to comment.