Skip to content

Commit

Permalink
Optimize 3.x (#3)
Browse files Browse the repository at this point in the history
* Optimize 3.x

* Fix

* Update tests.yml

* Update tests.yml

* Update tests.yml

* Update tests.yml

* Update tests.yml
  • Loading branch information
huangdijia committed Aug 6, 2023
1 parent 97bf545 commit 24142a3
Show file tree
Hide file tree
Showing 65 changed files with 129 additions and 180 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v1.0.0

name: Release

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
42 changes: 19 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@
name: tests

on: [push]
on:
push:
pull_request:
schedule:
- cron: '0 2 * * *'

jobs:
build:
runs-on: ${{ matrix.operating-system }}

name: Test on PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
runs-on: "${{ matrix.os }}"
strategy:
max-parallel: 15
max-parallel: 32
matrix:
operating-system: [ubuntu-latest]
php-versions: ["8.0", "8.1"]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

os: [ubuntu-latest]
php: ['8.0', '8.1', '8.2']
laravel: ['9', '10']
exclude:
- php: 8.0
laravel: 10
steps:
- name: Checkout
uses: actions/checkout@master

- name: Install PHP
uses: shivammathur/setup-php@master

with:
php-version: ${{ matrix.php-versions }}
php-version: ${{ matrix.php }}
extension-csv: mbstring, xdebug
ini-values-csv: "post_max_size=256M, short_open_tag=On"
coverage: xdebug

- name: Check PHP Version
run: php -v

- name: Check Composer Version
run: composer -V

- name: Check PHP Extensions
run: php -m

# - uses: actions/checkout@v1

- name: Install dependencies
- name: Install Dependencies
run: |
composer install --dev
composer require "laravel/framework:^${{ matrix.laravel }}" --no-update
composer update --prefer-dist --no-interaction --no-progress
- name: Test
run: |
composer test
# vendor/bin/phpunit
run: composer test
93 changes: 14 additions & 79 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,98 +2,33 @@

declare(strict_types=1);
/**
* This file is part of hyperf/helpers.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
* @contact [email protected]
*/
$header = <<<'EOF'
This file is part of laravel-youdu.
use Huangdijia\PhpCsFixer\Config;

@link https://github.com/huangdijia/laravel-youdu
@document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
@contact [email protected]
EOF;
require __DIR__ . '/vendor/autoload.php';

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => $header,
'separate' => 'none',
'location' => 'after_declare_strict',
return (new Config())
->setHeaderComment(
projectName: 'huangdijia/laravel-youdu',
projectLink: 'https://github.com/huangdijia/laravel-youdu',
projectDocument: 'https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md',
contacts: [
'[email protected]',
],
'array_syntax' => [
'syntax' => 'short',
],
'list_syntax' => [
'syntax' => 'short',
],
'concat_space' => [
'spacing' => 'one',
],
'blank_line_before_statement' => [
'statements' => [
'declare',
],
],
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author',
],
],
'ordered_imports' => [
'imports_order' => [
'class', 'function', 'const',
],
'sort_algorithm' => 'alpha',
],
'single_line_comment_style' => [
'comment_types' => [
],
],
'yoda_style' => [
'always_move_variable' => false,
'equal' => false,
'identical' => false,
],
'phpdoc_align' => [
'align' => 'left',
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'constant_case' => [
'case' => 'lower',
],
'class_attributes_separation' => true,
'combine_consecutive_unsets' => true,
'declare_strict_types' => true,
'linebreak_after_opening_tag' => true,
'lowercase_static_reference' => true,
'no_useless_else' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'not_operator_with_space' => false,
'ordered_class_elements' => true,
'php_unit_strict' => false,
'phpdoc_separation' => false,
'single_quote' => true,
'standardize_not_equals' => true,
'multiline_comment_opening_closing' => true,
])
)
->setFinder(
PhpCsFixer\Finder::create()
->exclude('bin')
->exclude('public')
->exclude('runtime')
->exclude('vendor')
->in(__DIR__)
->append([
__FILE__,
])
)
->setUsingCache(false);
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
}],
"require": {
"php": ">=8.0",
"illuminate/support": "^9.0",
"illuminate/notifications": "^9.0",
"illuminate/contracts": "^9.0",
"illuminate/support": "^9.0|^10.0",
"illuminate/notifications": "^9.0|^10.0",
"illuminate/contracts": "^9.0|^10.0",
"guzzlehttp/guzzle": "^6.4|^7.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"phpstan/phpstan": "^1.0",
"orchestra/testbench": "^7.0"
"huangdijia/php-coding-standard": "^1.2",
"orchestra/testbench": "^7.0|^8.0",
"phpstan/phpstan": "^1.0"
},
"autoload": {
"files": [
Expand Down Expand Up @@ -52,4 +52,4 @@
"config": {
"sort-packages": true
}
}
}
2 changes: 1 addition & 1 deletion config/youdu.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Channels/YouduChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Console/SendToDeptCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Console/SendToUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/AppMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/AppMessageItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/SessionMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Crypt/PKCS7Encoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Crypt/Prpcrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
3 changes: 1 addition & 2 deletions src/Crypt/SHA1.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand All @@ -20,7 +20,6 @@ class SHA1
* @param string $token 票据
* @param string $timestamp 时间戳
* @param string $nonce 随机字符串
* @param string $encrypt 密文消息
* @param mixed $encrypt_msg
*/
public function getSHA1($token, $timestamp, $nonce, $encrypt_msg)
Expand Down
2 changes: 1 addition & 1 deletion src/Dept.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/AccessTokenDoesNotExistException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* This file is part of laravel-youdu.
* This file is part of huangdijia/laravel-youdu.
*
* @link https://github.com/huangdijia/laravel-youdu
* @document https://github.com/huangdijia/laravel-youdu/blob/3.x/README.md
Expand Down
Loading

0 comments on commit 24142a3

Please sign in to comment.