Skip to content

Commit 47eb8e6

Browse files
committed
Retry
1 parent 30188a9 commit 47eb8e6

34 files changed

+6711
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Continuous Integration"
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- "master"
10+
11+
jobs:
12+
phpunit:
13+
name: "PHPUnit tests"
14+
15+
runs-on: ${{ matrix.operating-system }}
16+
17+
strategy:
18+
matrix:
19+
dependencies:
20+
- "lowest"
21+
- "highest"
22+
- "locked"
23+
php-version:
24+
- "8.1"
25+
- "8.2"
26+
- "8.3"
27+
operating-system:
28+
- "ubuntu-latest"
29+
30+
steps:
31+
- name: "Checkout"
32+
uses: "actions/checkout@v2"
33+
34+
- name: "Install PHP"
35+
uses: "shivammathur/setup-php@v2"
36+
with:
37+
coverage: "pcov"
38+
php-version: "${{ matrix.php-version }}"
39+
ini-values: memory_limit=-1
40+
41+
- name: "Install dependencies"
42+
uses: "ramsey/composer-install@v2"
43+
with:
44+
dependency-versions: "${{ matrix.dependencies }}"
45+
46+
- name: "Tests"
47+
run: "vendor/bin/phpunit"
48+
49+
static-analysis-phpstan:
50+
name: "Static Analysis by PHPStan"
51+
52+
runs-on: ${{ matrix.operating-system }}
53+
54+
strategy:
55+
matrix:
56+
dependencies:
57+
- "locked"
58+
php-version:
59+
- "8.1"
60+
operating-system:
61+
- "ubuntu-latest"
62+
63+
steps:
64+
- name: "Checkout"
65+
uses: "actions/checkout@v2"
66+
67+
- name: "Install PHP"
68+
uses: "shivammathur/setup-php@v2"
69+
with:
70+
coverage: "none"
71+
php-version: "${{ matrix.php-version }}"
72+
ini-values: memory_limit=-1
73+
74+
- name: "Install dependencies"
75+
uses: "ramsey/composer-install@v2"
76+
with:
77+
dependency-versions: "${{ matrix.dependencies }}"
78+
79+
- name: "PHPStan"
80+
run: "vendor/bin/phpstan analyse --memory-limit=-1"
81+
82+
coding-standards:
83+
name: "Check Coding Standards with PHP_CodeSniffer"
84+
85+
runs-on: ${{ matrix.operating-system }}
86+
87+
strategy:
88+
matrix:
89+
dependencies:
90+
- "locked"
91+
php-version:
92+
- "8.1"
93+
operating-system:
94+
- "ubuntu-latest"
95+
96+
steps:
97+
- name: "Checkout"
98+
uses: "actions/checkout@v2"
99+
100+
- name: "Install PHP"
101+
uses: "shivammathur/setup-php@v2"
102+
with:
103+
coverage: "none"
104+
php-version: "${{ matrix.php-version }}"
105+
ini-values: memory_limit=-1
106+
107+
- name: "Install dependencies"
108+
uses: "ramsey/composer-install@v2"
109+
with:
110+
dependency-versions: "${{ matrix.dependencies }}"
111+
112+
- name: "Coding Standard"
113+
run: "vendor/bin/phpcs"
114+
115+
cs-fixer:
116+
name: "Check Coding Standards with php-cs-fixer"
117+
118+
runs-on: ${{ matrix.operating-system }}
119+
120+
strategy:
121+
matrix:
122+
dependencies:
123+
- "locked"
124+
php-version:
125+
- "8.1"
126+
operating-system:
127+
- "ubuntu-latest"
128+
129+
steps:
130+
- name: "Checkout"
131+
uses: "actions/checkout@v2"
132+
133+
- name: "Install PHP"
134+
uses: "shivammathur/setup-php@v2"
135+
with:
136+
coverage: "none"
137+
php-version: "${{ matrix.php-version }}"
138+
ini-values: memory_limit=-1
139+
140+
- name: "Install dependencies"
141+
uses: "ramsey/composer-install@v2"
142+
with:
143+
dependency-versions: "${{ matrix.dependencies }}"
144+
145+
- name: "Coding Standard"
146+
run: "vendor/bin/php-cs-fixer fix --dry-run --diff"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.php-cs-fixer.cache
2+
/.phpunit.result.cache
3+
/tags
4+
/vendor

.php-cs-fixer.php

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
<?php
2+
/**
3+
* PHP CS Fixer config.
4+
*/
5+
$finder = PhpCsFixer\Finder::create()
6+
->in(__DIR__.'/src')
7+
->in(__DIR__.'/tests')
8+
->name('*.php')
9+
->append([__FILE__])
10+
;
11+
12+
return (new PhpCsFixer\Config())
13+
->setRules([
14+
'array_syntax' => ['syntax' => 'short'], // Differs from Symfony, where array syntax is long
15+
'binary_operator_spaces' => true,
16+
'blank_line_after_namespace' => true,
17+
'blank_line_after_opening_tag' => true,
18+
'blank_line_before_statement' => true,
19+
'braces' => true,
20+
'cast_spaces' => true,
21+
'class_attributes_separation' => true,
22+
'class_definition' => true,
23+
'constant_case' => true,
24+
'combine_consecutive_issets' => true,
25+
'combine_consecutive_unsets' => true,
26+
'compact_nullable_typehint' => true,
27+
'concat_space' => true,
28+
'declare_equal_normalize' => true,
29+
'dir_constant' => true,
30+
'doctrine_annotation_array_assignment' => true,
31+
'doctrine_annotation_braces' => true,
32+
'doctrine_annotation_indentation' => true,
33+
'doctrine_annotation_spaces' => false, // broken
34+
'elseif' => true,
35+
'encoding' => true,
36+
'escape_implicit_backslashes' => true,
37+
'explicit_indirect_variable' => true,
38+
'explicit_string_variable' => true,
39+
'full_opening_tag' => true,
40+
'fully_qualified_strict_types' => true,
41+
'function_declaration' => true,
42+
'function_to_constant' => true,
43+
'function_typehint_space' => true,
44+
'general_phpdoc_tag_rename' => true,
45+
'include' => true,
46+
'increment_style' => ['style' => 'post'], // Differs from symfony
47+
'indentation_type' => true,
48+
'is_null' => true,
49+
'line_ending' => true,
50+
'linebreak_after_opening_tag' => true,
51+
'list_syntax' => ['syntax' => 'short'],
52+
'logical_operators' => true,
53+
'lowercase_keywords' => true,
54+
'lowercase_static_reference' => true,
55+
'magic_constant_casing' => true,
56+
'method_argument_space' => true,
57+
// strval($f) is better than ((string)$f)
58+
// when outter parenthese are required
59+
'modernize_types_casting' => false,
60+
'multiline_comment_opening_closing' => true,
61+
'native_function_casing' => true,
62+
'new_with_braces' => true,
63+
'no_alias_functions' => true,
64+
'no_alternative_syntax' => true,
65+
'no_binary_string' => true,
66+
'no_blank_lines_after_class_opening' => true,
67+
'no_blank_lines_after_phpdoc' => true,
68+
'no_break_comment' => true,
69+
'no_closing_tag' => true,
70+
'no_empty_comment' => true,
71+
'no_empty_phpdoc' => true,
72+
'no_empty_statement' => true,
73+
'no_extra_blank_lines' => true,
74+
'no_homoglyph_names' => true,
75+
'no_leading_import_slash' => true,
76+
'no_leading_namespace_whitespace' => true,
77+
'no_mixed_echo_print' => true,
78+
'no_multiline_whitespace_around_double_arrow' => true,
79+
'no_php4_constructor' => true,
80+
'no_short_bool_cast' => true,
81+
'no_singleline_whitespace_before_semicolons' => true,
82+
'no_spaces_after_function_name' => true,
83+
'no_spaces_around_offset' => true,
84+
'no_spaces_inside_parenthesis' => true,
85+
'no_superfluous_elseif' => true,
86+
'no_superfluous_phpdoc_tags' => false, // removes 'mixed' type annotations
87+
'no_trailing_comma_in_list_call' => true,
88+
'no_trailing_comma_in_singleline_array' => true,
89+
'no_trailing_whitespace' => true,
90+
'no_trailing_whitespace_in_comment' => true,
91+
'no_unneeded_control_parentheses' => true,
92+
'no_unneeded_curly_braces' => true,
93+
'no_unneeded_final_method' => true,
94+
'no_unused_imports' => true,
95+
'no_useless_else' => true,
96+
'no_useless_return' => true,
97+
'no_whitespace_before_comma_in_array' => true,
98+
'no_whitespace_in_blank_line' => true,
99+
'non_printable_character' => true,
100+
'normalize_index_brace' => true,
101+
'object_operator_without_whitespace' => true,
102+
'ordered_class_elements' => true,
103+
'ordered_imports' => true,
104+
'php_unit_construct' => true,
105+
'php_unit_dedicate_assert' => true,
106+
'php_unit_expectation' => true,
107+
'php_unit_fqcn_annotation' => true,
108+
'php_unit_mock' => true,
109+
'php_unit_namespaced' => false, // incompleted / bogus
110+
'php_unit_no_expectation_annotation' => true,
111+
'php_unit_set_up_tear_down_visibility' => true,
112+
'php_unit_test_annotation' => [
113+
'style' => 'prefix',
114+
],
115+
'phpdoc_align' => true,
116+
'phpdoc_annotation_without_dot' => true,
117+
'phpdoc_indent' => true,
118+
'phpdoc_inline_tag_normalizer' => true,
119+
'phpdoc_no_access' => true,
120+
'phpdoc_no_alias_tag' => true,
121+
'phpdoc_no_empty_return' => true,
122+
'phpdoc_no_package' => true,
123+
'phpdoc_no_useless_inheritdoc' => true,
124+
'phpdoc_order' => true,
125+
'phpdoc_order_by_value' => true,
126+
'phpdoc_return_self_reference' => true,
127+
'phpdoc_scalar' => true,
128+
'phpdoc_separation' => true,
129+
'phpdoc_single_line_var_spacing' => true,
130+
'phpdoc_summary' => true,
131+
'phpdoc_tag_type' => true,
132+
'phpdoc_to_comment' => true,
133+
'phpdoc_trim' => true,
134+
'phpdoc_trim_consecutive_blank_line_separation' => true,
135+
'phpdoc_types' => true,
136+
'phpdoc_types_order' => false, // puts null before the type
137+
'phpdoc_var_without_name' => false,
138+
'psr_autoloading' => true,
139+
'return_assignment' => false,
140+
'return_type_declaration' => true,
141+
'self_accessor' => true,
142+
'semicolon_after_instruction' => true,
143+
'set_type_to_cast' => true,
144+
'short_scalar_cast' => true,
145+
'single_blank_line_at_eof' => true,
146+
'single_blank_line_before_namespace' => true,
147+
'single_class_element_per_statement' => true,
148+
'single_import_per_statement' => true,
149+
'single_line_after_imports' => true,
150+
'single_line_comment_style' => true,
151+
'single_quote' => true,
152+
'space_after_semicolon' => true,
153+
'standardize_not_equals' => true,
154+
'switch_case_semicolon_to_colon' => true,
155+
'switch_case_space' => true,
156+
'ternary_operator_spaces' => true,
157+
'ternary_to_null_coalescing' => true,
158+
'trailing_comma_in_multiline' => true,
159+
'trim_array_spaces' => true,
160+
'unary_operator_spaces' => true,
161+
'visibility_required' => [
162+
'elements' => ['property', 'method', 'const'],
163+
],
164+
'whitespace_after_comma_in_array' => false, // freezes with 100% cpu
165+
'yoda_style' => false, // Maybe later
166+
])
167+
->setRiskyAllowed(true)
168+
->setFinder($finder);

composer.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "mention/retry",
3+
"description": "A Retry library for PHP",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Arnaud Le Blanc",
9+
"email": "arnaud.lb@gmail.com"
10+
}
11+
],
12+
"config": {
13+
"sort-packages": true,
14+
"allow-plugins": {
15+
"phpstan/extension-installer": true
16+
}
17+
},
18+
"autoload": {
19+
"psr-4": {
20+
"Mention\\Retry\\": "src"
21+
}
22+
},
23+
"autoload-dev": {
24+
"classmap": ["tests"]
25+
},
26+
"require": {
27+
"php": ">=8.1",
28+
"cuyz/valinor": "^1.1",
29+
"lstrojny/functional-php": "^1.0",
30+
"mention/kebab": "^1.4.2",
31+
"react/event-loop": "^1.2",
32+
"react/promise": "^3.0"
33+
},
34+
"require-dev": {
35+
"friendsofphp/php-cs-fixer": "^3.6",
36+
"mockery/mockery": "^1.6",
37+
"phpstan/extension-installer": "^1.3",
38+
"phpstan/phpstan": "^1.4.6",
39+
"phpstan/phpstan-beberlei-assert": "^1.0",
40+
"phpstan/phpstan-mockery": "^1.1",
41+
"phpstan/phpstan-strict-rules": "^1.0",
42+
"phpunit/phpunit": "^9.0",
43+
"react/async": "^4.0",
44+
"squizlabs/php_codesniffer": "^3.4"
45+
}
46+
}

0 commit comments

Comments
 (0)