-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* a Little thing 😅 * Applying PHP-CS-Fixer * Update CI workflow + Adding new Release workflow to automate creating releases based on tags * Add PHPStan config file * Stop ignoring developer/machine specific folders Using the global .gitignore instead for ignoring such files & folders * Update README.md * Raising PHP support baseline to 8.2 * Seems that `shivammathur/setup-php` does not support enabling imagick extension on windows platforms * Small-Fix: Uppercasing directory name * Replace Annotations with Attributes in Unit Tests * Fix Style typo
- Loading branch information
1 parent
fd570d0
commit 39b8c17
Showing
22 changed files
with
238 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: CI | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
tests: | ||
name: Tests | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
os: | ||
- ubuntu-latest | ||
|
||
php-version: | ||
- 8.2 | ||
- 8.3 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install PHP with extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: imagick, gd | ||
ini-values: memory_limit=-1, assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On | ||
|
||
- name: Install dependencies with Composer | ||
run: composer install --prefer-dist --no-ansi --no-interaction --no-progress | ||
|
||
- name: Run PHP-CS-Fixer in Linter Mode | ||
run: composer run-script php-cs-fixer -- --dry-run --show-progress=dots --using-cache=no --verbose | ||
|
||
- name: Run PHPStan | ||
run: composer run-script phpstan | ||
|
||
- name: Install Tesseract | ||
run: sudo apt install tesseract-ocr | ||
|
||
- name: Run test-suites | ||
run: composer run-script test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "**" | ||
|
||
jobs: | ||
create-release: | ||
name: Create Release | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Determine tag | ||
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ env.RELEASE_TAG }} | ||
name: Release v${{ env.RELEASE_TAG }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
/.idea/ | ||
/examples/ | ||
/vendor/ | ||
/.phpunit.cache/ | ||
/composer.lock | ||
/phpunit.xml | ||
/.phpunit.result.cache | ||
/.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
$header = <<<EOF | ||
This file is part of the TesseractOCR package. | ||
(c) Ahmed Ghanem <[email protected]> | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
EOF; | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
->ignoreVCSIgnored(true); | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRules([ | ||
'@PSR12' => true, | ||
'@PSR12:risky' => true | ||
]) | ||
->setUsingCache(true) | ||
->setRiskyAllowed(true) | ||
->setFinder($finder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,46 +3,63 @@ | |
"description": "A PHP wrapper for Tesseract-OCR binary", | ||
"type": "library", | ||
"license": "MIT", | ||
|
||
"keywords": [ | ||
"tesseract", | ||
"ocr", | ||
"text recognition", | ||
"ocr recognition", | ||
"php-wrapper" | ||
], | ||
|
||
"authors": [ | ||
{ | ||
"name": "Ahmed Ghanem", | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/ahmedghanem00" | ||
} | ||
], | ||
|
||
"autoload": { | ||
"psr-4": { | ||
"ahmedghanem00\\TesseractOCR\\": "src/" | ||
} | ||
}, | ||
|
||
"autoload-dev": { | ||
"psr-4": { | ||
"ahmedghanem00\\TesseractOCR\\Tests\\": "tests/" | ||
} | ||
}, | ||
|
||
"require": { | ||
"php": ">=8.1", | ||
"ext-gd": "*", | ||
"symfony/string": "6.*", | ||
"symfony/process": "6.*", | ||
"intervention/image": "2.7.*" | ||
"php": "^8.2", | ||
"symfony/string": "^6.0 || ^7.0", | ||
"symfony/process": "^6.0 || ^7.0", | ||
"intervention/image": "^2.7.0" | ||
}, | ||
|
||
"require-dev": { | ||
"ext-gd": "*", | ||
"ext-imagick": "*", | ||
"phpunit/phpunit": "dev-main", | ||
"phpstan/phpstan": "1.10.x-dev", | ||
"phpstan/extension-installer": "^1.3", | ||
"friendsofphp/php-cs-fixer": "^3.54", | ||
"smalot/pdfparser": "dev-master" | ||
}, | ||
|
||
"scripts": { | ||
"test": "@php vendor/bin/phpunit", | ||
"phpstan": "@php vendor/bin/phpstan analyse src tests" | ||
"test": "vendor/bin/phpunit", | ||
"phpstan": "vendor/bin/phpstan analyse", | ||
"php-cs-fixer": "vendor/bin/php-cs-fixer fix" | ||
}, | ||
"minimum-stability": "dev" | ||
|
||
"minimum-stability": "stable", | ||
|
||
"config": { | ||
"allow-plugins": { | ||
"phpstan/extension-installer": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
# Ignore this error temporary for now | ||
message: "#^Method ahmedghanem00\\\\TesseractOCR\\\\Exception\\\\Execution\\\\UnsuccessfulExecutionException\\:\\:newFromProcess\\(\\) should return static\\(ahmedghanem00\\\\TesseractOCR\\\\Exception\\\\Execution\\\\UnsuccessfulExecutionException\\) but returns ahmedghanem00\\\\TesseractOCR\\\\Exception\\\\Execution\\\\UnsuccessfulExecutionException\\.$#" | ||
count: 1 | ||
path: src/Exception/Execution/UnsuccessfulExecutionException.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
level: 5 | ||
|
||
paths: | ||
- src/ | ||
- tests/ | ||
|
||
reportUnmatchedIgnoredErrors: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
cacheDirectory=".phpunit.cache" | ||
executionOrder="depends,defects" | ||
requireCoverageMetadata="true" | ||
beStrictAboutCoverageMetadata="true" | ||
beStrictAboutOutputDuringTests="true" | ||
failOnRisky="true" | ||
failOnWarning="true"> | ||
<testsuites> | ||
<testsuite name="unit"> | ||
<directory>tests/unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true"> | ||
<include> | ||
<directory>src</directory> | ||
</include> | ||
</source> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd" bootstrap="vendor/autoload.php" cacheDirectory=".phpunit.cache" executionOrder="depends,defects" requireCoverageMetadata="true" beStrictAboutCoverageMetadata="true" beStrictAboutOutputDuringTests="true" failOnRisky="true" failOnWarning="true"> | ||
<testsuites> | ||
<testsuite name="Unit"> | ||
<directory>tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
<source restrictNotices="true" restrictWarnings="true" ignoreIndirectDeprecations="true"> | ||
<include> | ||
<directory>src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.