-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test case and fixed Baidu accesstoken error fix#10 (#11)
* Add test case and fixed Baidu accesstoken error fix#10 * Refine test cases * Run php-cs-fixer * Fixed test fail * Add github action support * Add github action support * environment support * environment support * Add php8.0 support * Update documentation * Change codecov version to v0.1.15
- Loading branch information
Showing
61 changed files
with
2,634 additions
and
1,173 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,95 @@ | ||
name: php | ||
on: | ||
pull_request: | ||
push: | ||
jobs: | ||
phptests: | ||
runs-on: ${{ matrix.operating-system }} | ||
environment: OCR | ||
strategy: | ||
matrix: | ||
operating-system: ['ubuntu-latest'] | ||
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
tools: composer:v2 | ||
extensions: gd | ||
coverage: none | ||
|
||
- name: Install dependencies | ||
uses: nick-invision/retry@v1 | ||
with: | ||
timeout_minutes: 5 | ||
max_attempts: 5 | ||
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress | ||
|
||
- name: PHPUnit Test | ||
run: vendor/bin/phpunit --verbose | ||
env: | ||
BAIDU_ACCESS_KEY: ${{ secrets.BAIDU_ACCESS_KEY }} | ||
BAIDU_SECRET_KEY: ${{ secrets.BAIDU_SECRET_KEY }} | ||
ALIYUN_APPCODE: ${{ secrets.ALIYUN_APPCODE }} | ||
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }} | ||
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }} | ||
|
||
code-coverage: | ||
name: Code Coverage | ||
runs-on: ubuntu-latest | ||
environment: OCR | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- 8.0 | ||
dependencies: | ||
- highest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install PHP with extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
coverage: pcov | ||
extensions: gd | ||
tools: composer:v2, php-cs-fixer | ||
|
||
- name: Coding Guidelines | ||
run: php-cs-fixer fix --config=.php-cs-fixer.php | ||
|
||
- name: Install lowest dependencies with composer | ||
if: matrix.dependencies == 'lowest' | ||
run: composer update --no-ansi --no-interaction --no-progress --prefer-lowest | ||
|
||
- name: Install highest dependencies with composer | ||
if: matrix.dependencies == 'highest' | ||
run: composer update --no-ansi --no-interaction --no-progress | ||
|
||
- name: Collect code coverage with phpunit | ||
run: vendor/bin/phpunit --coverage-clover=coverage.xml | ||
env: | ||
BAIDU_ACCESS_KEY: ${{ secrets.BAIDU_ACCESS_KEY }} | ||
BAIDU_SECRET_KEY: ${{ secrets.BAIDU_SECRET_KEY }} | ||
ALIYUN_APPCODE: ${{ secrets.ALIYUN_APPCODE }} | ||
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }} | ||
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }} | ||
|
||
- name: Send code coverage report to Codecov.io | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage.xml | ||
version: "v0.1.15" | ||
env: | ||
BAIDU_ACCESS_KEY: ${{ secrets.BAIDU_ACCESS_KEY }} | ||
BAIDU_SECRET_KEY: ${{ secrets.BAIDU_SECRET_KEY }} | ||
ALIYUN_APPCODE: ${{ secrets.ALIYUN_APPCODE }} | ||
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }} | ||
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }} |
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,12 +1,10 @@ | ||
vendor | ||
composer.lock | ||
tests/stubs/*.jpg | ||
tests/stubs/*.png | ||
tests/stubs/*.jpeg | ||
tests/stubs/config.php | ||
.DS_Store | ||
.php_cs.cache | ||
.idea | ||
*.DS_Store | ||
composer.lock | ||
*.log | ||
/.php-cs-fixer.cache | ||
/.phpunit.result.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,30 @@ | ||
<?php | ||
|
||
$header = <<<EOF | ||
This file is part of the godruoyi/ocr. | ||
(c) Godruoyi <gmail@godruoyi.com> | ||
This source file is subject to the MIT license that is bundled. | ||
EOF; | ||
|
||
use PhpCsFixer\Config; | ||
use PhpCsFixer\Finder; | ||
|
||
return (new Config())->setRules([ | ||
'@PSR2' => true, | ||
'header_comment' => ['header' => $header], | ||
'array_syntax' => ['syntax' => 'short'], | ||
'ordered_imports' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
]) | ||
->setFinder( | ||
Finder::create() | ||
->in(__DIR__) | ||
->exclude('vendor') | ||
->name('*.php') | ||
->notName('*.blade.php') | ||
) | ||
->setUsingCache(false) | ||
->setRiskyAllowed(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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<phpunit backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Application Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
|
||
<coverage processUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
</include> | ||
</coverage> | ||
|
||
<php> | ||
<env name="ENVIRONMENT" value="" /> | ||
<env name="BAIDU_ACCESS_KEY" value="" /> | ||
<env name="BAIDU_SECRET_KEY" value="" /> | ||
<env name="ALIYUN_APPCODE" value="" /> | ||
<env name="TENCENT_SECRET_ID" value="" /> | ||
<env name="TENCENT_SECRET_KEY" value="" /> | ||
</php> | ||
|
||
</phpunit> |
Oops, something went wrong.