Skip to content

Commit feee2ce

Browse files
Merge pull request #17 from ARCANEDEV/update-github_actions
Using GitHub Actions for tests
2 parents 20f9a7a + eaf32f6 commit feee2ce

21 files changed

+212
-123
lines changed

.editorconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# This file is for unifying the coding style for different editors and IDEs
2-
# editorconfig.org
3-
41
root = true
52

63
[*]
7-
end_of_line = lf
84
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
97
indent_style = space
108
indent_size = 4
119
trim_trailing_whitespace = true
12-
insert_final_newline = true
1310

1411
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
1515
indent_size = 2

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
.gitattributes export-ignore
88
.gitignore export-ignore
99
.scrutinizer.yml export-ignore
10-
.travis.yml export-ignore
1110
phpunit.xml.dist export-ignore
1211
CONTRIBUTING.md export-ignore

.github/workflows/run-tests.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: run-tests
2+
3+
on: [push]
4+
5+
jobs:
6+
tests:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
fail-fast: true
11+
matrix:
12+
php: [7.2, 7.3, 7.4]
13+
laravel: [6.*]
14+
dependency-version: [prefer-lowest, prefer-stable]
15+
16+
name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v1
21+
22+
- name: Cache dependencies
23+
uses: actions/cache@v1
24+
with:
25+
path: ~/.composer/cache/files
26+
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v1
30+
with:
31+
php-version: ${{ matrix.php }}
32+
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
33+
coverage: xdebug
34+
35+
- name: Install dependencies
36+
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
37+
38+
- name: Execute tests
39+
run: |
40+
mkdir -p build/logs
41+
vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
42+
43+
- name: Scrutinizer CI
44+
run: |
45+
wget https://scrutinizer-ci.com/ocular.phar
46+
php ocular.phar code-coverage:upload --format=php-clover coverage.clover

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ checks:
2121
tools:
2222
external_code_coverage:
2323
timeout: 600
24-
runs: 2
24+
runs: 6
2525
php_code_sniffer:
2626
enabled: true
2727
config:

.travis.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Gravatar [![Packagist License][badge_license]](LICENSE.md) [![For PHP][badge_php]][link-github-repo] [![Laravel 5 Supported][badge_laravel]][link-github-repo]
22

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

4242
[badge_license]: http://img.shields.io/packagist/l/arcanedev/gravatar.svg?style=flat-square
4343
[badge_php]: https://img.shields.io/badge/PHP-Framework%20agnostic-4F5B93.svg?style=flat-square
44-
[badge_build]: http://img.shields.io/travis/ARCANEDEV/Gravatar.svg?style=flat-square
44+
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/Gravatar/run-tests?style=flat-square
4545
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/Gravatar.svg?style=flat-square
4646
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/Gravatar.svg?style=flat-square
4747
[badge_insight]: https://img.shields.io/sensiolabs/i/b295ae87-bc10-4a43-9ca4-fbeab5c7fcda.svg?style=flat-square
@@ -53,9 +53,9 @@ Any ideas are welcome. Feel free to submit any issues or pull requests, please c
5353

5454
[link-author]: https://github.com/arcanedev-maroc
5555
[link-github-repo]: https://github.com/ARCANEDEV/Gravatar
56+
[link-github-status]: https://github.com/ARCANEDEV/Gravatar/actions
5657
[link-github-issues]: https://github.com/ARCANEDEV/Gravatar/issues
5758
[link-contributors]: https://github.com/ARCANEDEV/Gravatar/graphs/contributors
5859
[link-packagist]: https://packagist.org/packages/arcanedev/gravatar
59-
[link-travis]: https://travis-ci.org/ARCANEDEV/Gravatar
6060
[link-scrutinizer]: https://scrutinizer-ci.com/g/ARCANEDEV/Gravatar/?branch=master
6161
[link-insight]: https://insight.sensiolabs.com/projects/b295ae87-bc10-4a43-9ca4-fbeab5c7fcda

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php" : ">=7.2.0",
2020
"ext-curl": "*",
21-
"arcanedev/support": "^5.0",
21+
"arcanedev/support": "^5.1",
2222
"arcanedev/php-html": "^3.0"
2323
},
2424
"require-dev": {

src/Concerns/HashEmail.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
<?php namespace Arcanedev\Gravatar\Concerns;
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Arcanedev\Gravatar\Concerns;
26

37
/**
48
* Trait HashEmail
@@ -20,7 +24,7 @@ trait HashEmail
2024
*
2125
* @return string
2226
*/
23-
public static function hashEmail($email)
27+
public static function hashEmail(string $email): string
2428
{
2529
return hash('md5', strtolower(trim($email)));
2630
}

src/Contracts/Gravatar.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
<?php namespace Arcanedev\Gravatar\Contracts;
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Arcanedev\Gravatar\Contracts;
26

37
/**
48
* Interface Gravatar
@@ -152,5 +156,5 @@ public function exists($email);
152156
*
153157
* @return string
154158
*/
155-
public static function hashEmail($email);
159+
public static function hashEmail(string $email): string;
156160
}

src/Exceptions/InvalidImageRatingException.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
<?php namespace Arcanedev\Gravatar\Exceptions;
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Arcanedev\Gravatar\Exceptions;
26

37
use InvalidArgumentException;
48

@@ -10,6 +14,16 @@
1014
*/
1115
class InvalidImageRatingException extends InvalidArgumentException
1216
{
17+
/* -----------------------------------------------------------------
18+
| Main Methods
19+
| -----------------------------------------------------------------
20+
*/
21+
22+
/**
23+
* @param string $rating
24+
*
25+
* @return static
26+
*/
1327
public static function make(string $rating)
1428
{
1529
return new static(

0 commit comments

Comments
 (0)