This commit is contained in:
Daniil Gentili 2024-03-31 19:38:58 +02:00
parent 9110d6692c
commit e6c87ecfaa
12 changed files with 88 additions and 15 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
github: danog

73
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,73 @@
name: build
on:
pull_request:
push:
jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
php-versions: ["8.1", "8.2", "8.3"]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, sockets
coverage: xdebug
- name: Check environment
run: |
php --version
composer --version
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ matrix.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.os }}-composer-${{ matrix.php-versions }}-
- name: Install dependencies
run: |
composer install --prefer-dist
wget https://github.com/infection/infection/releases/download/0.27.0/infection.phar -O /usr/local/bin/infection
chmod +x /usr/local/bin/infection
- name: Run codestyle check
env:
PHP_CS_FIXER_IGNORE_ENV: 1
run: |
vendor/bin/php-cs-fixer --diff --dry-run -v fix
- name: Run unit tests
run: |
vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml
- name: Run mutation tests
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
run: |
infection --show-mutations --threads=$(nproc)
- name: Run Psalm analysis
run: |
vendor/bin/psalm.phar --shepherd
- name: Upload coverage to Codecov
env:
OS: ${{ matrix.os }}
PHP: ${{ matrix.php-versions }}
uses: codecov/codecov-action@v1
with:
file: build/logs/clover.xml
env_vars: OS,PHP

View File

@ -6,7 +6,6 @@ use Amp\Redis\RedisConfig;
use danog\AsyncOrm\Annotations\OrmMappedArray;
use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\DbAutoProperties;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\DbObject;
use danog\AsyncOrm\KeyType;
use danog\AsyncOrm\Settings;
@ -70,7 +69,7 @@ final class Application
/**
* This field is automatically connected to the database using the specified Settings.
*
*
* @var DbArray<string, MyObject>
*/
#[OrmMappedArray(KeyType::STRING, ValueType::OBJECT)]
@ -78,7 +77,7 @@ final class Application
/**
* This field is automatically connected to the database using the specified Settings.
*
*
* @var DbArray<string, int>
*/
#[OrmMappedArray(KeyType::STRING, ValueType::INT)]
@ -97,7 +96,7 @@ final class Application
// Can store integers, strings, arrays or objects depending on the specified ValueType
$this->dbProperty2['someKey'] = 123;
var_dump($this->dbProperty2['someKey']);
var_dump($this->dbProperty2['someKey']);
}
public function businessLogic2(string $value): void

View File

@ -3,8 +3,8 @@
use Amp\Mysql\MysqlConfig;
use Amp\Postgres\PostgresConfig;
use Amp\Redis\RedisConfig;
use danog\AsyncOrm\DbObject;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\DbObject;
use danog\AsyncOrm\KeyType;
use danog\AsyncOrm\Settings\MysqlSettings;
use danog\AsyncOrm\Settings\PostgresSettings;

View File

@ -34,10 +34,10 @@ use ReflectionClass;
use function Amp\async;
use function Amp\Future\await;
/**
/**
* Trait that provides autoconfiguration of OrmMappedArray properties.
*
* @api
*
* @api
*/
trait DbAutoProperties
{

View File

@ -20,8 +20,8 @@ namespace danog\AsyncOrm\Internal\Containers;
use Amp\Sync\LocalMutex;
use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\DbObject;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\DbObject;
use Revolt\EventLoop;
use Traversable;

View File

@ -29,9 +29,9 @@ use Amp\Mysql\MysqlConnectionPool;
use Amp\Sql\SqlResult;
use Amp\Sync\LocalKeyedMutex;
use AssertionError;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\Driver\Mysql;
use danog\AsyncOrm\Driver\SqlArray;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\Internal\Serializer\BoolInt;
use danog\AsyncOrm\Internal\Serializer\Passthrough;
use danog\AsyncOrm\KeyType;

View File

@ -26,9 +26,9 @@
namespace danog\AsyncOrm\Internal\Driver;
use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\DbObject;
use danog\AsyncOrm\Driver\MemoryArray;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\Internal\Containers\ObjectContainer;
use danog\AsyncOrm\Settings\DriverSettings;
use Traversable;

View File

@ -27,8 +27,8 @@ namespace danog\AsyncOrm\Internal\Driver;
use Amp\Postgres\PostgresConnectionPool;
use Amp\Sync\LocalKeyedMutex;
use danog\AsyncOrm\Driver\SqlArray;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\Driver\SqlArray;
use danog\AsyncOrm\Internal\Serializer\ByteaSerializer;
use danog\AsyncOrm\Internal\Serializer\Passthrough;
use danog\AsyncOrm\KeyType;

View File

@ -28,8 +28,8 @@ namespace danog\AsyncOrm\Internal\Driver;
use Amp\Redis\Connection\ReconnectingRedisLink;
use Amp\Redis\RedisClient;
use Amp\Sync\LocalKeyedMutex;
use danog\AsyncOrm\Driver\DriverArray;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\Driver\DriverArray;
use danog\AsyncOrm\Internal\Serializer\BoolString;
use danog\AsyncOrm\Internal\Serializer\FloatString;
use danog\AsyncOrm\Internal\Serializer\IntString;

View File

@ -30,9 +30,9 @@ use Amp\Postgres\PostgresConfig;
use Amp\Process\Process;
use Amp\Redis\RedisConfig;
use AssertionError;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\DbObject;
use danog\AsyncOrm\Driver\MemoryArray;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\Internal\Driver\CachedArray;
use danog\AsyncOrm\Internal\Driver\ObjectArray;
use danog\AsyncOrm\KeyType;

View File

@ -25,9 +25,9 @@ namespace danog\TestAsyncOrm;
use danog\AsyncOrm\Annotations\OrmMappedArray;
use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\DbAutoProperties;
use danog\AsyncOrm\DbObject;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\KeyType;
use danog\AsyncOrm\ValueType;