Skip to content

Commit cb93df3

Browse files
committed
完善 ci 相关
1 parent 40980d0 commit cb93df3

9 files changed

+506
-17
lines changed

.coveralls.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage_clover: clover.xml
2+
json_path: coveralls-upload.json

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ sftp-config.json
66
composer.lock
77
.subsplit
88
.php_cs.cache
9+
phpunit.xml
10+
.phpunit.result.cache
11+
clover.xml

.php_cs

+88-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,98 @@
11
<?php
2-
$header = <<<EOF
3-
This file is part of the calchen/laravel-dingtalk-robot-notification.
42

5-
(c) 陈恺垣 <[email protected]>
3+
/**
4+
* 根据 StyleCI 的 Laravel Preset 整理的 PHP Coding Standards Fixer 规则
5+
* 注释掉的是 Fixer 中不存在的
6+
* 行尾注释,表示该行规则命名存在差异
7+
*/
8+
$rules = [
9+
'@PSR2' => true,
10+
'phpdoc_align' => true, // align_phpdoc
11+
'binary_operator_spaces' => true,
12+
'blank_line_after_opening_tag' => true,
13+
'blank_line_before_return' => true,
14+
'cast_spaces' => true,
15+
'concat_space' => true, // concat_without_spaces
16+
'declare_equal_normalize' => true,
17+
'function_typehint_space' => true,
18+
'hash_to_slash_comment' => true,
19+
'heredoc_to_nowdoc' => true,
20+
'include' => true,
21+
// length_ordered_imports 根据 .styleci.yml 禁用
22+
'lowercase_cast' => true,
23+
'lowercase_static_reference' => true,
24+
'magic_constant_casing' => true,
25+
'magic_method_casing' => true,
26+
'method_separation' => true,
27+
'native_function_casing' => true,
28+
'native_function_type_declaration_casing' => true,
29+
'no_alias_functions' => true,
30+
'no_blank_lines_after_class_opening' => true,
31+
'no_blank_lines_after_phpdoc' => true,
32+
// 'no_blank_lines_after_throw' => true,
33+
// 'no_blank_lines_between_imports' => true,
34+
// 'no_blank_lines_between_traits' => true,
35+
'no_empty_phpdoc' => true,
36+
'no_empty_statement' => true,
37+
'no_extra_consecutive_blank_lines' => true,
38+
'no_leading_import_slash' => true,
39+
'no_leading_namespace_whitespace' => true,
40+
'no_multiline_whitespace_around_double_arrow' => true,
41+
'no_multiline_whitespace_before_semicolons' => true,
42+
'no_short_bool_cast' => true,
43+
'no_singleline_whitespace_before_semicolons' => true,
44+
'no_spaces_around_offset' => ['positions' => ['inside']], // no_spaces_inside_offset
45+
'no_trailing_comma_in_list_call' => true,
46+
'no_trailing_comma_in_singleline_array' => true,
47+
'no_unneeded_control_parentheses' => true,
48+
'no_unreachable_default_argument_value' => true,
49+
// no_unused_imports 根据 .styleci.yml 禁用
50+
'no_useless_return' => true,
51+
'no_whitespace_before_comma_in_array' => true,
52+
'no_whitespace_in_blank_line' => true,
53+
'normalize_index_brace' => true,
54+
'not_operator_with_successor_space' => true,
55+
'object_operator_without_whitespace' => true,
56+
'phpdoc_indent' => true,
57+
'phpdoc_inline_tag' => true,
58+
'phpdoc_no_access' => true,
59+
'phpdoc_no_package' => true,
60+
'phpdoc_no_useless_inheritdoc' => true,
61+
'phpdoc_scalar' => true,
62+
'phpdoc_single_line_var_spacing' => true,
63+
'phpdoc_summary' => true,
64+
'phpdoc_to_comment' => true,
65+
'phpdoc_trim' => true,
66+
// 'phpdoc_type_to_var' => true,
67+
'phpdoc_types' => true,
68+
'phpdoc_var_without_name' => true,
69+
'pre_increment' => true, // post_increment
70+
'no_mixed_echo_print' => true, // print_to_echo
71+
'self_accessor' => true,
72+
'array_syntax' => ['syntax' => 'short'], // short_array_syntax
73+
'list_syntax' => ['syntax' => 'short' ], // short_list_syntax
74+
'short_scalar_cast' => true,
75+
'simplified_null_return' => true,
76+
'single_blank_line_before_namespace' => true,
77+
'single_quote' => true,
78+
'space_after_semicolon' => true,
79+
'standardize_not_equals' => true,
80+
'ternary_operator_spaces' => true,
81+
'trailing_comma_in_multiline_array' => true,
82+
'trim_array_spaces' => true,
83+
// 'unalign_equals' => true,
84+
'unary_operator_spaces' => true,
85+
'whitespace_after_comma_in_array' => true,
686

7-
This source file is subject to the MIT license that is bundled.
8-
EOF;
87+
// 根据 .styleci.yml 启用额外规则
88+
'ordered_imports' => true,
989

90+
];
1091
return PhpCsFixer\Config::create()
1192
->setRiskyAllowed(true)
12-
->setRules(array(
13-
'@Symfony' => true,
14-
'header_comment' => array('header' => $header),
15-
'array_syntax' => array('syntax' => 'short'),
16-
'ordered_imports' => true,
17-
'no_useless_else' => true,
18-
'no_useless_return' => true,
19-
'php_unit_construct' => true,
20-
'php_unit_strict' => true,
21-
))
93+
->setRules($rules)
2294
->setFinder(
2395
PhpCsFixer\Finder::create()
2496
->exclude('vendor')
2597
->in(__DIR__)
26-
)
27-
;
98+
);

.styleci.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
preset: laravel
2+
3+
enabled:
4+
- alpha_ordered_imports
5+
disabled:
6+
- length_ordered_imports
7+
- no_unused_imports
8+
- short_list_syntax

.travis.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
language: php
2+
3+
cache:
4+
directories:
5+
- $HOME/.cache/pip
6+
- $HOME/.composer/cache/files
7+
8+
# 7.0 for Laravel 5.5
9+
# 7.1.3 for Laravel 5.6 - 5.8
10+
# 7.2 for Laravel 6.x
11+
php:
12+
- 7.0.0
13+
- 7.1.3
14+
- 7.2.0
15+
16+
env:
17+
- TESTBENCH_VERSION=~3.5.0
18+
- TESTBENCH_VERSION=~3.6.0
19+
- TESTBENCH_VERSION=~3.7.0
20+
- TESTBENCH_VERSION=~3.8.0
21+
- TESTBENCH_VERSION=~4.0.0
22+
23+
matrix:
24+
exclude:
25+
- php: 7.0.0
26+
env: TESTBENCH_VERSION=~3.6.0
27+
- php: 7.0.0
28+
env: TESTBENCH_VERSION=~3.7.0
29+
- php: 7.0.0
30+
env: TESTBENCH_VERSION=~3.8.0
31+
- php: 7.0.0
32+
env: TESTBENCH_VERSION=~4.0.0
33+
- php: 7.1.3
34+
env: TESTBENCH_VERSION=~3.5.0
35+
- php: 7.1.3
36+
env: TESTBENCH_VERSION=~4.0.0
37+
- php: 7.2.0
38+
env: TESTBENCH_VERSION=~3.5.0
39+
- php: 7.2.0
40+
env: TESTBENCH_VERSION=~3.6.0
41+
- php: 7.2.0
42+
env: TESTBENCH_VERSION=~3.7.0
43+
- php: 7.2.0
44+
env: TESTBENCH_VERSION=~3.8.0
45+
46+
before_install:
47+
- cp ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ~/xdebug.ini
48+
- phpenv config-rm xdebug.ini
49+
- composer global require hirak/prestissimo --update-no-dev
50+
- composer require "orchestra/testbench:${TESTBENCH_VERSION}" --no-update --prefer-dist
51+
52+
install: travis_retry composer install --no-interaction --prefer-dist
53+
54+
before_script: phpenv config-add ~/xdebug.ini
55+
56+
script:
57+
- composer show
58+
- vendor/bin/phpunit -v
59+
60+
after_success:
61+
- php vendor/bin/php-coveralls
62+
63+
notifications:
64+
email: false

0 commit comments

Comments
 (0)