Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): Move to GH actions and remove (most) EOL php versions #2065

Merged
merged 20 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Run tests

on:
push:
release:
types:
- published

jobs:
php-tests:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4, 8.0]
laravel: [6.*, 7.*, 8.*]
os: [ubuntu-latest]
coverage: [none]
include:
- php: 8.0
laravel: 8.*
os: ubuntu-latest
coverage: xdebug
exclude:
- php: 7.2
laravel: 8.*
- php: 8.0
laravel: 6.*

name: '[P${{ matrix.php }}] [L${{ matrix.laravel }}] [${{ matrix.coverage }}]'

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring json openssl
coverage: ${{ matrix.coverage }}
ini-values: memory_limit=-1

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }}"

- name: Install dependencies
run: |
composer require "illuminate/contracts:${{ matrix.laravel }}" --no-interaction --no-progress --no-update
composer update --no-progress --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: composer test:ci

- name: Upload coverage
uses: codecov/codecov-action@v1
if: matrix.coverage == 'xdebug'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
yml: ./codecov.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.lock
build
coverage.xml
.phpunit.result.cache
114 changes: 0 additions & 114 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
],
"require": {
"php": "^5.5.9|^7.0",
"php": "^7.2|^8.0",
"illuminate/auth": "^5.2|^6|^7|^8",
"illuminate/contracts": "^5.2|^6|^7|^8",
"illuminate/http": "^5.2|^6|^7|^8",
Expand All @@ -37,7 +37,8 @@
"illuminate/database": "^5.2|^6|^7|^8",
"illuminate/routing": "^5.2|^6|^7|^8",
"mockery/mockery": ">=0.9.9",
"phpunit/phpunit": "~4.8|~6.0"
"phpunit/phpunit": "^8.5|^9.4",
"yoast/phpunit-polyfills": "^0.2.0"
},
"autoload": {
"psr-4": {
Expand Down
82 changes: 43 additions & 39 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="false"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true">
<testsuites>
<testsuite name="jwt-auth Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
<exclude>
<file>src/Providers/AbstractServiceProvider.php</file>
<file>src/Providers/LaravelServiceProvider.php</file>
<file>src/Providers/LumenServiceProvider.php</file>
<directory suffix=".php">src/Facades/</directory>
<directory suffix=".php">src/Console/</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="false"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<file>src/Providers/AbstractServiceProvider.php</file>
<file>src/Providers/LaravelServiceProvider.php</file>
<file>src/Providers/LumenServiceProvider.php</file>
<directory suffix=".php">src/Facades/</directory>
<directory suffix=".php">src/Console/</directory>
</exclude>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<testsuites>
<testsuite name="jwt-auth Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
</phpunit>
1 change: 1 addition & 0 deletions src/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Closure;

/** @deprecated */
class Authenticate extends BaseMiddleware
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Http/Middleware/AuthenticateAndRenew.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Closure;

/** @deprecated */
class AuthenticateAndRenew extends BaseMiddleware
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Http/Middleware/BaseMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\JWTAuth;

/** @deprecated */
abstract class BaseMiddleware
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Http/Middleware/Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Closure;
use Exception;

/** @deprecated */
class Check extends BaseMiddleware
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Http/Middleware/RefreshToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use Tymon\JWTAuth\Exceptions\JWTException;

/** @deprecated */
class RefreshToken extends BaseMiddleware
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/JWTAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Tymon\JWTAuth\Contracts\Providers\Auth;
use Tymon\JWTAuth\Http\Parser\Parser;

/** @deprecated */
class JWTAuth extends JWT
{
/**
Expand Down
3 changes: 2 additions & 1 deletion src/Payload.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use JsonSerializable;
use Tymon\JWTAuth\Claims\Claim;
use Tymon\JWTAuth\Claims\Collection;
Expand Down Expand Up @@ -286,6 +287,6 @@ public function __call($method, $parameters)
}
}

throw new BadMethodCallException(sprintf('The claim [%s] does not exist on the payload.', $method));
throw new BadMethodCallException(sprintf('The claim [%s] does not exist on the payload.', Str::after($method, 'get')));
}
}
6 changes: 3 additions & 3 deletions tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Carbon\Carbon;
use Mockery;
use PHPUnit\Framework\TestCase;
use Yoast\PHPUnitPolyfills\TestCases\TestCase;

abstract class AbstractTestCase extends TestCase
{
Expand All @@ -22,15 +22,15 @@ abstract class AbstractTestCase extends TestCase
*/
protected $testNowTimestamp;

public function setUp()
public function setUp(): void
{
parent::setUp();

Carbon::setTestNow($now = Carbon::now());
$this->testNowTimestamp = $now->getTimestamp();
}

public function tearDown()
public function tearDown(): void
{
Carbon::setTestNow();
Mockery::close();
Expand Down
2 changes: 1 addition & 1 deletion tests/BlacklistTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BlacklistTest extends AbstractTestCase
*/
protected $validator;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
Loading