Skip to content

Commit

Permalink
feat: switch to alchemy v2
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Oct 13, 2024
1 parent 362352f commit 68ed2d2
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 131 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint code

on: [push]

jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: true

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: json, zip
tools: composer:v2
coverage: none

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

- name: Run Linter
run: composer run lint

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore: fix styling'
23 changes: 0 additions & 23 deletions .github/workflows/php-cs-fixer.yml

This file was deleted.

13 changes: 7 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: Run Tests

on: ['push', 'pull_request']
on: ["push","pull_request"]

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

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

Expand All @@ -27,5 +28,5 @@ jobs:
- name: Install PHP dependencies
run: composer update --no-interaction --no-progress

- name: All Tests
run: php vendor/bin/pest --colors=always --coverage
- name: Run Tests
run: composer run test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ Thumbs.db
*.swp

# phpstorm
.idea/*
.idea/*

# Alchemy
.alchemy
34 changes: 0 additions & 34 deletions .php_cs.dist.php

This file was deleted.

61 changes: 61 additions & 0 deletions alchemy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
app:
- src

tests:
engine: pest
parallel: true
paths:
- tests
files:
- '*.test.php'
coverage:
processUncoveredFiles: true

lint:
preset: PSR12
rules:
single_quote: true
phpdoc_scalar: true
no_unused_imports: true
unary_operator_spaces: true
binary_operator_spaces: true
phpdoc_var_without_name: true
trailing_comma_in_multiline: true
phpdoc_single_line_var_spacing: true
single_trait_insert_per_statement: true
not_operator_with_successor_space: false
array_syntax:
syntax: short
ordered_imports:
sort_algorithm: alpha
method_argument_space:
on_multiline: ensure_fully_multiline
keep_multiple_spaces_after_comma: true
blank_line_before_statement:
statements:
- break
- continue
- declare
- return
- throw
- try

actions:
run:
- lint
- tests
os:
- ubuntu-latest
- macos-latest
- windows-latest
php:
extensions: json, zip
versions:
- '8.3'
- '8.2'
- '8.1'
- '8.0'
- '7.4'
events:
- push
- pull_request
100 changes: 52 additions & 48 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,56 @@
{
"name": "leafs/leaf",
"description": "Elegant PHP for modern developers",
"keywords": [
"microframework",
"rest",
"router",
"leaf",
"php",
"framework"
],
"homepage": "https://leafphp.dev",
"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": {
"php": "^7.4|^8.0",
"leafs/http": "*",
"leafs/anchor": "*",
"leafs/exception": "*"
},
"require-dev": {
"pestphp/pest": "^1.21",
"friendsofphp/php-cs-fixer": "^3.0"
},
"scripts": {
"name": "leafs/leaf",
"description": "Elegant PHP for modern developers",
"keywords": [
"microframework",
"rest",
"router",
"leaf",
"php",
"framework"
],
"homepage": "https://leafphp.dev",
"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": {
"php": "^7.4|^8.0",
"leafs/http": "*",
"leafs/anchor": "*",
"leafs/exception": "*",
"leafs/alchemy": "dev-next"
},
"scripts": {
"format": "vendor/bin/php-cs-fixer fix --config=.php_cs.dist.php --allow-risky=yes",
"test": "vendor/bin/pest"
"test": "./vendor/bin/alchemy setup --test",
"alchemy": "./vendor/bin/alchemy setup",
"lint": "./vendor/bin/alchemy setup --lint",
"actions": "./vendor/bin/alchemy setup --actions"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
"require-dev": {
"pestphp/pest": "^3.3",
"friendsofphp/php-cs-fixer": "^3.64"
}
}
18 changes: 0 additions & 18 deletions phpunit.xml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public static function reset()

protected static function getDiIndex($class)
{
$fullName = \explode("\\", \strtolower(\get_class($class)));
$fullName = \explode('\\', \strtolower(\get_class($class)));
$className = $fullName[\count($fullName) - 1];

return $className;
Expand Down

0 comments on commit 68ed2d2

Please sign in to comment.