Skip to content

Commit

Permalink
Merge pull request #8 from mychidarko/next
Browse files Browse the repository at this point in the history
Update Leaf DB
  • Loading branch information
mychidarko authored Feb 27, 2023
2 parents 588eefd + 5570913 commit 5b66375
Show file tree
Hide file tree
Showing 13 changed files with 486 additions and 84 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check & fix styling

on: [push]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs.dist.php --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore: fix styling'
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Run Tests

on: ['push', 'pull_request']

jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
php: ['7.4', '8.0', '8.1', '8.2']
fail-fast: true
max-parallel: 1

name: PHP ${{ matrix.php }} - ${{ matrix.os }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: xdebug

- name: Install PHP dependencies
run: composer update --no-interaction --no-progress

- name: All Tests
run: php vendor/bin/alchemy run
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Global
.phpunit*
.php-cs-fixer.cache
.composer
composer.lock
package-lock.json
vendor/
test/
tests/
*.tests.php

# OS Generated
.DS_Store*
Expand Down
34 changes: 34 additions & 0 deletions .php_cs.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => false,
'trailing_comma_in_multiline' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'single_trait_insert_per_statement' => true,
])
->setFinder($finder);
26 changes: 26 additions & 0 deletions alchemy.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

return [
// alchemy options
'engine' => 'pest',

// php unit options
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:noNamespaceSchemaLocation' => './vendor/phpunit/phpunit/phpunit.xsd',
'bootstrap' => 'vendor/autoload.php',
'colors' => true,

// you can have multiple testsuites
'testsuites' => [
'directory' => './tests'
],

// coverage options
'coverage' => [
'processUncoveredFiles' => true,
'include' => [
'./app' => '.php',
'./src' => '.php'
]
]
];
76 changes: 42 additions & 34 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,46 @@
{
"name": "leafs/db",
"description": "Leaf PHP db module.",
"keywords": [
"database",
"orm",
"leaf",
"php",
"framework"
],
"homepage": "https://leafphp.netlify.app/#/",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Michael Darko",
"email": "[email protected]",
"homepage": "https://mychi.netlify.app",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"Leaf\\": "src"
},
"files": [
"src/functions.php"
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"ext-mysqli": "*"
"name": "leafs/db",
"description": "Leaf PHP db module.",
"keywords": [
"database",
"orm",
"leaf",
"php",
"framework"
],
"homepage": "https://leafphp.netlify.app/#/",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Michael Darko",
"email": "[email protected]",
"homepage": "https://mychi.netlify.app",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"Leaf\\": "src"
},
"require-dev": {
"pestphp/pest": "^1.21"
"files": [
"src/functions.php"
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"pestphp/pest": "^1.21",
"leafs/alchemy": "^1.0",
"friendsofphp/php-cs-fixer": "^3.14"
},
"scripts": {
"format": "vendor/bin/php-cs-fixer fix --config=.php_cs.dist.php --allow-risky=yes",
"test": "vendor/bin/alchemy run"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
Loading

0 comments on commit 5b66375

Please sign in to comment.