Skip to content

Commit

Permalink
Merge pull request #12 from swooletw/feature/ci
Browse files Browse the repository at this point in the history
add ci script
  • Loading branch information
albertcht authored Oct 2, 2023
2 parents 585856f + 3681a9a commit 697dfbc
Show file tree
Hide file tree
Showing 55 changed files with 194 additions and 369 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: tests

on:
push:
pull_request:

jobs:
linux_tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"

strategy:
fail-fast: true
matrix:
include:
- php: "8.1"
swoole: "5.0.3"
- php: "8.2"
swoole: "5.0.3"

name: PHP ${{ matrix.php }} (swoole-${{ matrix.swoole }})

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: swoole-${{ matrix.swoole }}
coverage: none

- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: |
COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-dist -n -o
- name: Execute tests
run: |
vendor/bin/php-cs-fixer fix --dry-run --diff
vendor/bin/phpunit -c phpunit.xml.dist.xml
112 changes: 84 additions & 28 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,28 @@
},
"autoload": {
"psr-4": {
"SwooleTW\\Hyperf\\": "src/"
}
"SwooleTW\\Hyperf\\Auth\\": "src/auth/src/",
"SwooleTW\\Hyperf\\Cache\\": "src/cache/src/",
"SwooleTW\\Hyperf\\Container\\": "src/container/src/",
"SwooleTW\\Hyperf\\Cookie\\": "src/cookie/src/",
"SwooleTW\\Hyperf\\Database\\": "src/sqlite/src/",
"SwooleTW\\Hyperf\\Dispatcher\\": "src/dispatcher/src/",
"SwooleTW\\Hyperf\\Encryption\\": "src/encryption/src/",
"SwooleTW\\Hyperf\\Foundation\\": "src/foundation/src/",
"SwooleTW\\Hyperf\\Hashing\\": "src/hashing/src/",
"SwooleTW\\Hyperf\\JWT\\": "src/jwt/src/",
"SwooleTW\\Hyperf\\Log\\": "src/log/src/",
"SwooleTW\\Hyperf\\ObjectPool\\": "src/object-pool/src/",
"SwooleTW\\Hyperf\\Router\\": "src/router/src/",
"SwooleTW\\Hyperf\\Support\\": "src/support/src/"
},
"files": [
"src/auth/src/Functions.php",
"src/cache/src/Functions.php",
"src/foundation/src/helpers.php",
"src/router/src/Functions.php",
"src/support/src/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
Expand All @@ -32,48 +52,84 @@
},
"require": {
"php": "^8.1",
"ext-hash": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"hyperf/async-queue": "^3.1",
"hyperf/collection": "^3.1",
"hyperf/command": "^3.1",
"hyperf/config": "^3.1",
"hyperf/context": "^3.1",
"hyperf/contract": "^3.1",
"hyperf/coordinator": "^3.1",
"hyperf/coroutine": "^3.1",
"hyperf/crontab": "^3.1",
"hyperf/database": "^3.1",
"hyperf/db-connection": "^3.1",
"hyperf/di": "^3.1",
"hyperf/redis": "^3.1",
"swooletw/hyperf-auth": "@dev",
"swooletw/hyperf-cache": "@dev",
"swooletw/hyperf-container": "@dev",
"swooletw/hyperf-cookie": "@dev",
"swooletw/hyperf-dispatcher": "@dev",
"swooletw/hyperf-encryption": "@dev",
"swooletw/hyperf-foundation": "@dev",
"swooletw/hyperf-hashing": "@dev",
"swooletw/hyperf-jwt": "@dev",
"swooletw/hyperf-log": "@dev",
"swooletw/hyperf-object-pool": "@dev",
"swooletw/hyperf-router": "@dev",
"swooletw/hyperf-sqlite": "@dev",
"swooletw/hyperf-support": "@dev"
"hyperf/engine": "^2.1",
"hyperf/http-message": "^3.1",
"hyperf/http-server": "^3.1",
"hyperf/macroable": "^3.1",
"hyperf/signal": "^3.1",
"hyperf/stringable": "^3.1",
"hyperf/support": "^3.1",
"hyperf/tappable": "^3.1",
"lcobucci/jwt": "^5.0",
"monolog/monolog": "^3.1",
"nesbot/carbon": "^2.16",
"psr/simple-cache": "^3.0",
"ramsey/uuid": "^4.7"
},
"replace": {
"swooletw/hyperf-auth": "self.version",
"swooletw/hyperf-cache": "self.version",
"swooletw/hyperf-container": "self.version",
"swooletw/hyperf-cookie": "self.version",
"swooletw/hyperf-dispatcher": "self.version",
"swooletw/hyperf-encryption": "self.version",
"swooletw/hyperf-foundation": "self.version",
"swooletw/hyperf-hashing": "self.version",
"swooletw/hyperf-jwt": "self.version",
"swooletw/hyperf-log": "self.version",
"swooletw/hyperf-object-pool": "self.version",
"swooletw/hyperf-router": "self.version",
"swooletw/hyperf-sqlite": "self.version",
"swooletw/hyperf-support": "self.version"
},
"suggest": {
"doctrine/dbal": "Required to rename SQLite indexs (^3.5.1)."
"doctrine/dbal": "Required to rename SQLite indexs (^3.5.1).",
"hyperf/redis": "Required to use redis driver. (^3.1)",
"hyperf/session": "Required to use session guard. (^3.1)"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "dev-master",
"hyperf/redis": "^3.1",
"mockery/mockery": "^1.5.1",
"phpunit/phpunit": "^10.0.7"
},
"config": {
"sort-packages": true
},
"extra": {
"hyperf": {
"config": [
"SwooleTW\\Hyperf\\Auth\\ConfigProvider",
"SwooleTW\\Hyperf\\Cache\\ConfigProvider",
"SwooleTW\\Hyperf\\Cookie\\ConfigProvider",
"SwooleTW\\Hyperf\\Database\\ConfigProvider",
"SwooleTW\\Hyperf\\Dispatcher\\ConfigProvider",
"SwooleTW\\Hyperf\\Encryption\\ConfigProvider",
"SwooleTW\\Hyperf\\Foundation\\ConfigProvider",
"SwooleTW\\Hyperf\\Hashing\\ConfigProvider",
"SwooleTW\\Hyperf\\JWT\\ConfigProvider",
"SwooleTW\\Hyperf\\Log\\ConfigProvider",
"SwooleTW\\Hyperf\\Router\\ConfigProvider"
]
},
"branch-alias": {
"dev-main": "3.1-dev"
}
},
"minimum-stability": "dev",
"repositories": [
{
"type": "path",
"url": "src/*",
"options": {
"symlink": true
}
}
]
"minimum-stability": "dev"
}
7 changes: 4 additions & 3 deletions phpunit.xml.dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
backupStaticProperties="false">
backupStaticProperties="false"
displayDetailsOnTestsThatTriggerDeprecations="true">
<testsuites>
<testsuite name="Laravel Test Suite">
<testsuite name="Hyperf Packages Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="memory_limit" value="1024M" />
</php>
</phpunit>
</phpunit>
8 changes: 4 additions & 4 deletions src/auth/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"hyperf/config": "^3.1",
"hyperf/database": "^3.1",
"hyperf/http-server": "^3.1",
"swooletw/hyperf-hashing": "^3.1|dev-master",
"swooletw/hyperf-jwt": "^3.1|dev-master"
"swooletw/hyperf-hashing": "^3.1",
"swooletw/hyperf-jwt": "^3.1"
},
"suggest": {
"hyperf/session": "Required to use session guard."
"hyperf/session": "Required to use session guard. (^3.1)"
},
"autoload": {
"psr-4": {
Expand All @@ -56,4 +56,4 @@
"sort-packages": true
},
"minimum-stability": "dev"
}
}
2 changes: 2 additions & 0 deletions src/auth/src/Contracts/Authorizable.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace SwooleTW\Hyperf\Auth\Contracts;

interface Authorizable
Expand Down
3 changes: 1 addition & 2 deletions src/auth/src/Guards/JwtGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public function __construct(
protected ManagerContract $jwtManager,
protected RequestInterface $request,
protected int $ttl = 120
) {
}
) {}

/**
* Attempt to authenticate a user using the given credentials.
Expand Down
3 changes: 1 addition & 2 deletions src/auth/src/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class Authenticate implements MiddlewareInterface

public function __construct(
protected AuthManager $auth
) {
}
) {}

public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
Expand Down
3 changes: 1 addition & 2 deletions src/auth/src/Providers/DatabaseUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public function __construct(
protected ConnectionInterface $connection,
protected HashContract $hasher,
protected string $table
) {
}
) {}

/**
* Retrieve a user by their unique identifier.
Expand Down
3 changes: 1 addition & 2 deletions src/auth/src/Providers/EloquentUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class EloquentUserProvider implements UserProvider
public function __construct(
protected HashContract $hasher,
protected string $model
) {
}
) {}

/**
* Retrieve a user by their unique identifier.
Expand Down
6 changes: 3 additions & 3 deletions src/cache/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"hyperf/support": "^3.1",
"psr/simple-cache": "^3.0"
},
"suggests": {
"hyperf/redis": "Required to use redis driver. (^2.0)"
"suggest": {
"hyperf/redis": "Required to use redis driver. (^3.1)"
},
"config": {
"sort-packages": true
Expand All @@ -48,4 +48,4 @@
"dev-main": "3.1-dev"
}
}
}
}
3 changes: 1 addition & 2 deletions src/cache/src/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class CacheManager implements FactoryContract
*/
public function __construct(
protected ContainerInterface $app
) {
}
) {}

/**
* Dynamically call the default driver instance.
Expand Down
4 changes: 1 addition & 3 deletions src/cache/src/Contracts/LockTimeoutException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use Exception;

class LockTimeoutException extends Exception
{
}
class LockTimeoutException extends Exception {}
4 changes: 1 addition & 3 deletions src/cache/src/Events/CacheMissed.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace SwooleTW\Hyperf\Cache\Events;

class CacheMissed extends CacheEvent
{
}
class CacheMissed extends CacheEvent {}
4 changes: 1 addition & 3 deletions src/cache/src/Events/KeyForgotten.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace SwooleTW\Hyperf\Cache\Events;

class KeyForgotten extends CacheEvent
{
}
class KeyForgotten extends CacheEvent {}
4 changes: 1 addition & 3 deletions src/cache/src/Exceptions/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace SwooleTW\Hyperf\Cache\Exceptions;

class InvalidArgumentException extends \InvalidArgumentException
{
}
class InvalidArgumentException extends \InvalidArgumentException {}
4 changes: 1 addition & 3 deletions src/cache/src/Exceptions/NotSupportedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use RuntimeException;

class NotSupportedException extends RuntimeException
{
}
class NotSupportedException extends RuntimeException {}
4 changes: 1 addition & 3 deletions src/cache/src/NoLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public function release()
/**
* Releases this lock in disregard of ownership.
*/
public function forceRelease()
{
}
public function forceRelease() {}

/**
* Returns the owner value written into the driver for this lock.
Expand Down
4 changes: 1 addition & 3 deletions src/cache/src/NullStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class NullStore extends TaggableStore implements LockProvider
* @param string $key
* @return mixed
*/
public function get($key)
{
}
public function get($key) {}

/**
* Store an item in the cache for a given number of seconds.
Expand Down
2 changes: 0 additions & 2 deletions src/cache/src/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ public function missing($key)

/**
* Retrieve an item from the cache by key.
*
* @param mixed $default
*/
public function get(string|array $key, mixed $default = null): mixed
{
Expand Down
3 changes: 1 addition & 2 deletions src/cookie/src/CookieManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class CookieManager implements CookieContract

public function __construct(
protected RequestInterface $request
) {
}
) {}

public function has(string $key): bool
{
Expand Down
3 changes: 1 addition & 2 deletions src/cookie/src/Middleware/AddQueuedCookiesToResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class AddQueuedCookiesToResponse implements MiddlewareInterface
{
public function __construct(
protected CookieContract $cookie
) {
}
) {}

public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
Expand Down
1 change: 0 additions & 1 deletion src/dispatcher/class_map/HttpRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Hyperf\Dispatcher;

use Hyperf\Dispatcher\AbstractRequestHandler;
use InvalidArgumentException;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand Down
Loading

0 comments on commit 697dfbc

Please sign in to comment.