-
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.
Merge pull request #1 from tai-sho/features/improve-env
Improvement of the environment
- Loading branch information
Showing
11 changed files
with
4,011 additions
and
852 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,87 @@ | ||
name: Code quality check | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run PHPStan | ||
run: vendor/bin/phpstan analyse -c phpstan.neon | ||
|
||
phpunit: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run PHPUnit | ||
run: vendor/bin/phpunit | ||
|
||
phpmd: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run PHPMD | ||
run: vendor/bin/phpmd src github phpmd.xml | ||
|
||
php-cs-fixer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run PHP CS Fixer | ||
run: ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --allow-risky=yes | ||
|
||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Fix styling | ||
|
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
vendor | ||
.idea | ||
.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,88 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__ . '/src') | ||
->in(__DIR__ . '/tests'); | ||
|
||
$config = new PhpCsFixer\Config(); | ||
return $config->setRules([ | ||
'@PSR12' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'binary_operator_spaces' => [ | ||
'default' => 'single_space', | ||
], | ||
'blank_line_after_namespace' => true, | ||
'blank_line_after_opening_tag' => true, | ||
'blank_line_before_statement' => [ | ||
'statements' => ['return'] | ||
], | ||
'braces' => [ | ||
'position_after_functions_and_oop_constructs' => 'next' | ||
], | ||
'cast_spaces' => ['space' => 'single'], | ||
'class_definition' => ['multi_line_extends_each_single_line' => true], | ||
'concat_space' => ['spacing' => 'one'], | ||
'declare_strict_types' => true, | ||
'function_typehint_space' => true, | ||
'include' => true, | ||
'lowercase_cast' => true, | ||
'native_function_casing' => true, | ||
'no_blank_lines_after_class_opening' => true, | ||
'no_blank_lines_after_phpdoc' => true, | ||
'no_empty_comment' => true, | ||
'no_empty_phpdoc' => true, | ||
'no_empty_statement' => true, | ||
'no_extra_blank_lines' => [ | ||
'tokens' => [ | ||
'curly_brace_block', | ||
'extra', | ||
'parenthesis_brace_block', | ||
'square_brace_block', | ||
'throw', | ||
'use' | ||
] | ||
], | ||
'no_leading_import_slash' => true, | ||
'no_leading_namespace_whitespace' => true, | ||
'no_mixed_echo_print' => ['use' => 'echo'], | ||
'no_multiline_whitespace_around_double_arrow' => true, | ||
'no_short_bool_cast' => true, | ||
'no_singleline_whitespace_before_semicolons' => true, | ||
'no_spaces_around_offset' => ['positions' => ['inside', 'outside']], | ||
'no_unused_imports' => true, | ||
'no_whitespace_before_comma_in_array' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'normalize_index_brace' => true, | ||
'object_operator_without_whitespace' => true, | ||
'ordered_imports' => ['sort_algorithm' => 'alpha'], | ||
'phpdoc_indent' => true, | ||
'phpdoc_tag_type' => true, | ||
'phpdoc_no_access' => true, | ||
'phpdoc_no_package' => true, | ||
'phpdoc_no_useless_inheritdoc' => true, | ||
'phpdoc_scalar' => true, | ||
'phpdoc_single_line_var_spacing' => true, | ||
'phpdoc_summary' => false, | ||
'phpdoc_to_comment' => true, | ||
'phpdoc_trim' => true, | ||
'phpdoc_types_order' => [ | ||
'null_adjustment' => 'always_last', | ||
'sort_algorithm' => 'none' | ||
], | ||
'semicolon_after_instruction' => true, | ||
'single_blank_line_at_eof' => true, | ||
'single_import_per_statement' => true, | ||
'single_line_after_imports' => true, | ||
'single_quote' => true, | ||
'space_after_semicolon' => true, | ||
'standardize_not_equals' => true, | ||
'ternary_operator_spaces' => true, | ||
'trailing_comma_in_multiline' => ['elements' => ['arrays']], | ||
'trim_array_spaces' => true, | ||
'unary_operator_spaces' => true, | ||
'whitespace_after_comma_in_array' => true, | ||
'general_phpdoc_tag_rename' => true, | ||
'phpdoc_inline_tag_normalizer' => 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Contributing to Oura API PHP Client | ||
|
||
First off, thanks for taking the time to contribute! 🎉 | ||
|
||
The following is a set of guidelines for contributing to this project. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. | ||
|
||
## How Can I Contribute? | ||
|
||
### Reporting Bugs | ||
|
||
This section guides you through submitting a bug report for the Oura API PHP Client. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports. | ||
|
||
Before creating a bug report, please check if an issue has already been reported. | ||
|
||
1. **Check the [issues](https://github.com/your-username/oura-api-php/issues) for similar problems.** | ||
2. **If you find a related issue, add a comment with any additional details.** | ||
3. **If your issue is unique, open a new issue:** | ||
- Use a clear and descriptive title for the issue to identify the problem. | ||
- Provide as much relevant information as possible to help others understand the problem and how to reproduce it. | ||
|
||
### Suggesting Enhancements | ||
|
||
This section guides you through submitting an enhancement suggestion for the Oura API PHP Client, including completely new features and minor improvements to existing functionality. | ||
|
||
1. **Check the [issues](https://github.com/your-username/oura-api-php/issues) for similar suggestions.** | ||
2. **If you find a related suggestion, add a comment with your thoughts.** | ||
3. **If your suggestion is new, open a new issue:** | ||
- Use a clear and descriptive title for the issue to identify the suggestion. | ||
- Provide a detailed description of the suggested enhancement and explain why it would be beneficial. | ||
|
||
### Submitting a Pull Request | ||
|
||
1. Fork the repository. | ||
2. Clone your fork to your local machine: | ||
```sh | ||
git clone https://github.com/your-username/oura-api-php.git | ||
cd oura-api-php | ||
``` | ||
3. Create a new branch for your changes: | ||
``` | ||
git checkout -b feature/your-feature-name | ||
``` | ||
4. Make your changes in your branch. | ||
5. Commit your changes: | ||
```sh | ||
git commit -m "Description of your changes" | ||
``` | ||
6. Push to your fork: | ||
```sh | ||
git push origin feature/your-feature-name | ||
``` | ||
7. Open a pull request from your forked repository to the main repository. | ||
|
||
### Pull Request Guidelines | ||
- Ensure any install or build dependencies are removed before the end of the layer when doing a build. | ||
- Update the README.md and any other relevant documentation with details of changes to the interface. | ||
- Ensure the test suite passes. | ||
- Make sure your code lints. | ||
|
||
## Development | ||
### Using Docker for Development | ||
We provide a Docker setup to ensure a consistent development environment. To use Docker: | ||
1. Build the Docker image: | ||
```sh | ||
docker-compose build | ||
``` | ||
2. Run the development environment: | ||
```sh | ||
docker-compose up | ||
``` | ||
3. Use the php environment: | ||
```sh | ||
docker-compose exec app bash | ||
``` | ||
|
||
The Docker setup will automatically install dependencies and run tests, code style checks and static analysis. | ||
|
||
### Code Style, Analysis and Testing | ||
Please ensure your code adheres to our coding standards and passes all checks: | ||
1. PHP-CS-Fixer: Ensures code style consistency. | ||
```sh | ||
composer fix | ||
``` | ||
2. PHPStan: Performs static analysis to detect potential issues. | ||
```sh | ||
composer analyse | ||
``` | ||
3. PHPMD: Checks for code smells and potential bugs. | ||
```sh | ||
composer md | ||
``` | ||
4. PHPUnit: Unit testing. | ||
```sh | ||
composer test | ||
``` | ||
|
||
You can run all tests and checks with a single command: | ||
```sh | ||
composer all-checks | ||
``` | ||
|
||
## Code of Conduct | ||
This project and everyone participating in it is governed by the Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected]. | ||
|
||
## Thank You | ||
Thank you for considering contributing to the Oura API PHP Client! We look forward to building something amazing with you. |
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.