Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Mar 8, 2024
0 parents commit b6ff9ee
Show file tree
Hide file tree
Showing 32 changed files with 1,807 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = tab
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true

[*.py]
indent_style = space
indent_size = 4

[*.{yml,yaml}]
indent_style = space
indent_size = 2
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/.build export-ignore
/.github export-ignore
/.phan export-ignore
/.phpdoc export-ignore
/docs export-ignore
/examples export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.readthedocs.yml export-ignore
/composer.lock export-ignore
/phpcs.xml.dist export-ignore
/phpdoc.xml.dist export-ignore
/phpmd.xml.dist export-ignore
/phpunit.xml.dist export-ignore

*.php diff=php
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ko_fi: codemasher
51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: Bug report
about: You have found a bug? Does the library not behave as expected? That's great (ok, not that great)! Please help us to improve!
title: '[BUG]'
labels: 'bug'
---

<!--
Please FOLLOW THE ISSUE TEMPLATE unless you have a good reason not to.
If you have a question or an issue that is not a bug,
please use the Q&A section under discussions instead. Thanks!
-->

**Describe the bug or unexpected behaviour**

A clear and concise description of what the bug is.


**Steps to reproduce the behavior**

- When i do ...
- The code below ...
- Error message: ...


**Code sample** (if applicable)

```php
// your code here
```


**Expected behavior**

A clear and concise description of what you expected to happen.


**Screenshots**

If applicable, add screenshots to help explain your problem.


**Environment (please complete the following information):**

- PHP version/OS: [e.g. 7.4.12, Ubuntu 20.04]
- Library version: [e.g. 4.3.1]


**Additional context**

Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: "You have a question or an issue that is not a bug?"
about: "Please use the Q&A section under discussions. Thanks!"
url: https://github.com/chillerlan/php-library-template/discussions
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Feature request
about: You have an idea for a new feature (or improve an existing one)? Great!
title: '[ENHANCEMENT]'
labels: 'enhancement'
---

<!--
Please FOLLOW THE ISSUE TEMPLATE unless you have a good reason not to.
If you have a question or an issue that is not a feature request,
please use the Q&A section under discussions instead. Thanks!
-->

**Describe the feature**

A clear and concise description of the requested feature.


**Code sample** (if applicable)

```php
// your code here
```


**Additional context**

Add any other context here (if applicable).


**Are you (the requester) willing to submit a pull request for that feature?**

[YES|NO] (A yes will greatly increase the chance that the feature will be added)
33 changes: 33 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Proposed changes

<!-- Describe your changes here to communicate to the maintainers why you'd like to include this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue. -->


<!-- You can erase any of the parts below that are not applicable to your Pull Request. -->

## Types of changes

<!-- Put an `x` in the boxes that apply -->

What types of changes does your code introduce?

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation fix or enhancement (no code was touched)
- [ ] Other (CI, dependencies, etc., please describe)


## Checklist:

- [ ] I have checked to ensure there aren't other open [Issues](../../../issues) or [Pull Requests](../../../pulls) for the same update/change
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] Static analysis and unit tests pass locally with my changes


## Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...
162 changes: 162 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
# https://github.com/sebastianbergmann/phpunit/blob/main/.github/workflows/ci.yaml

# https://github.com/actions/checkout
# https://github.com/actions/upload-artifact
# https://github.com/shivammathur/setup-php
# https://github.com/ramsey/composer-install
# https://github.com/codecov/codecov-action
# https://github.com/codacy/codacy-coverage-reporter-action
# https://github.com/JamesIves/github-pages-deploy-action
# https://github.com/stefanzweifel/git-auto-commit-action

on:
push:
branches:
- main
pull_request:
branches:
- main

name: "Continuous Integration"

env:
PHP_EXTENSIONS: none
PHP_INI_VALUES: memory_limit=-1, error_reporting=-1, display_errors=On

jobs:

static-code-analysis:
name: "Static Code Analysis"
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"

env:
PHAN_ALLOW_XDEBUG: 0
PHAN_DISABLE_XDEBUG_WARN: 1

steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ast, ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
coverage: none

- name: "Update dependencies with composer"
uses: ramsey/composer-install@v3

- name: "Run phan"
run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}


tests:
name: "Unit Tests"
needs: static-code-analysis
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
php-version:
- "8.1"
- "8.2"
- "8.3"

steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
coverage: pcov

- name: "Install dependencies with composer"
uses: ramsey/composer-install@v3

- name: "Run tests with phpunit"
run: php vendor/bin/phpunit --colors=always --configuration=phpunit.xml.dist

- name: "Send code coverage report to Codecov.io"
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: .build/coverage/clover.xml

- name: "Send code coverage report to Codacy"
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: .build/coverage/clover.xml


build-docs:
name: "Build and publish API docs"
if: github.ref_name == 'main'
runs-on: ubuntu-latest

steps:
- name: "Checkout sources"
uses: actions/checkout@v4

- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
coverage: none
tools: phpDocumentor

- name: "Build API docs"
run: phpdoc --config=phpdoc.xml.dist

- name: "Publish API docs to branch gh-pages"
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: .build/phpdocs
clean: true


build-manual:
name: "Build and publish user manual"
if: github.ref_name == 'main'
runs-on: ubuntu-latest

steps:
- name: "Checkout sources"
uses: actions/checkout@v4

- name: "Install Sphinx"
run: pip install sphinx myst-parser sphinx-rtd-theme

- name: "Build manual"
run: |
cd docs
make html
- name: "Publish user manual to branch readthedocs"
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: readthedocs
folder: .build/sphinx/html
clean: true
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# IDE - IntelliJ
.idea/*
# Keep the code styles.
!.idea/codeStyles
.idea/codeStyles/*
!.idea/codeStyles/Project.xml
!.idea/codeStyles/codeStyleConfig.xml
# Keep the inspection levels
!.idea/inspectionProfiles
.idea/inspectionProfiles/*
!.idea/inspectionProfiles/Project_Default.xml

# project stuff
.build/*
vendor/*
composer.lock
phpcs.xml
phpdoc.xml
phpmd.xml
phpunit.xml
8 changes: 8 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b6ff9ee

Please sign in to comment.