Skip to content

Commit

Permalink
chore: initialize project using ramsey/php-library-starter-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophWurst committed Sep 10, 2024
0 parents commit cd791f9
Show file tree
Hide file tree
Showing 37 changed files with 1,855 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 @@
# EditorConfig http://EditorConfig.org

# top-most EditorConfig file
root = true

# This applies to all files
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4

[*.{yml,yaml}]
indent_size = 2
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/.allowed-licenses export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/bin/ export-ignore
/build/ export-ignore
/captainhook.json export-ignore
/CHANGELOG.md export-ignore
/codecov.yml export-ignore
/CODE_OF_CONDUCT.md export-ignore
/CONTRIBUTING.md export-ignore
/conventional-commits.json export-ignore
/docs/ export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm-baseline.xml export-ignore
/psalm.xml export-ignore
/resources/ export-ignore
/SECURITY.md export-ignore
/tests/ export-ignore
Empty file added .github/CODEOWNERS
Empty file.
Empty file added .github/FUNDING.yml
Empty file.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug_Report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug Report
about: Create a bug report to help us improve
labels: bug
assignees:
---
<!--- Provide a general summary of the issue you're having in the title above. -->

## Description
<!-- Provide a short and clear description of the bug. -->

## Steps to reproduce
<!--
Provide steps to reproduce the behavior you are experiencing. Please try to keep
this as short as possible. If able, create a reproducible script outside of any
framework you are using. This will help us to quickly debug the issue.
-->
1. Step one...
2. Step two...
3. Step three...

## Expected behavior
<!-- Provide a short and clear description of what you expect to happen. -->

## Screenshots or output
<!-- If applicable, add screenshots or program output to help explain your problem. -->

## Environment details
<!-- Provide details about the system where you're using this package. -->
- version of this package: *e.g. 1.0.0, 1.0.1, 1.1.0*
- PHP version: *e.g. 7.3.16, 7.4.4*
- OS: *e.g. Windows 10, Linux (Ubuntu 18.04.1), macOS Catalina (10.15.3)*

## Additional context
<!-- Provide any additional context that may help us debug the problem. -->
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature_Request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Feature Request
about: Suggest a feature for this project
labels: enhancement
assignees:
---
<!--- Provide a general summary of your feature request in the title above. -->

<!-- Give your feature a short title here. -->
## My feature title
<!-- Provide a short and clear description of the feature. -->

## Background/problem
<!--
Provide background details to show why this feature is necessary. Is your
feature request related to a problem? If so, please describe the problem.
Provide as much detail as possible.
-->

## Proposal/solution
<!--
Provide a short and clear description of the solution you'd like. Include code
examples, if possible. Feel free to use pseudo-code to show how you think the
feature should work.
-->

## Alternatives
<!-- Describe any alternative solutions or features you've considered. -->

## Additional context
<!-- Please provide any other context or code examples that may help. -->
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/Question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Question
about: Ask a question about how to use this library
labels: question
assignees:
---
<!--- Provide a general summary of your question in the title above. -->

<!-- Write your question here. -->
## How do I... ?
<!-- Provide any additional context that may help us answer your question. -->

## Example code
<!--
If your question is about code that you've written, provide a short and clear
example of what you're trying to accomplish. Try to keep this as short as
possible. If able, please provide an example outside of any framework you are
using. This will help us to quickly respond to your question.
-->
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "monthly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
27 changes: 27 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--- Provide a general summary of your changes in the title above. -->

## Description
<!--- Describe your changes in detail. -->

## Motivation and context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How has this been tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (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 change)

## PR checklist
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **CONTRIBUTING.md** document.
- [ ] I have added tests to cover my changes.
186 changes: 186 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# GitHub Actions Documentation: https://docs.github.com/en/actions

name: "Continuous Integration"

on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
branches:
- "main"

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
COMPOSER_ROOT_VERSION: "1.99.99"

jobs:
coding-standards:
name: "Coding standards"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout repository"
uses: "actions/[email protected]"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
with:
php-version: "latest"
coverage: "none"

- name: "Install dependencies (Composer)"
uses: "ramsey/[email protected]"

- name: "Check syntax (php-parallel-lint)"
run: "composer dev:lint:syntax"

- name: "Check coding standards (PHP_CodeSniffer)"
run: "composer dev:lint:style"

static-analysis:
name: "Static analysis"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout repository"
uses: "actions/[email protected]"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
with:
php-version: "latest"
coverage: "none"
ini-values: "memory_limit=-1"

- name: "Install dependencies (Composer)"
uses: "ramsey/[email protected]"

- name: "Statically analyze code (PHPStan)"
run: "composer dev:analyze:phpstan"

- name: "Statically analyze code (Psalm)"
run: "composer dev:analyze:psalm -- --shepherd"

security-analysis:
name: "Security analysis"
needs: ["coding-standards", "static-analysis"]
runs-on: "ubuntu-latest"

# If you encounter "Resource not accessible by integration" errors on
# GitHub Actions for this job, uncomment the following lines. Your
# organization permissions may not be set to allow writing security events.
permissions:
security-events: write

steps:
- name: "Checkout repository"
uses: "actions/[email protected]"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
with:
php-version: "latest"
coverage: "none"

- name: "Install dependencies (Composer)"
uses: "ramsey/[email protected]"

- name: "Analyze security of code (Psalm)"
run: "./vendor/bin/psalm --taint-analysis --report=build/logs/psalm.sarif"

- name: "Upload security analysis results to GitHub"
uses: "github/codeql-action/upload-sarif@v2"
with:
sarif_file: "build/logs/psalm.sarif"

code-coverage:
name: "Code coverage"
needs: ["coding-standards", "static-analysis"]
runs-on: "ubuntu-latest"

steps:
- name: "Checkout repository"
uses: "actions/[email protected]"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
with:
php-version: "latest"
coverage: "pcov"
ini-values: "memory_limit=-1"

- name: "Install dependencies (Composer)"
uses: "ramsey/[email protected]"

- name: "Run unit tests (PHPUnit)"
run: "composer dev:test:coverage:ci"

- name: "Publish coverage report to Codecov"
uses: "codecov/[email protected]"

unit-tests:
name: "Unit tests"
needs: ["code-coverage"]
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
php:
- "8.1"
- "8.2"
os:
- "macos-latest"
- "ubuntu-latest"
- "windows-latest"
composer-deps:
- "lowest"
- "highest"
include:
- php: "8.3"
os: "macos-latest"
composer-deps: "highest"
composer-options: "--ignore-platform-reqs"
- php: "8.3"
os: "ubuntu-latest"
composer-deps: "highest"
composer-options: "--ignore-platform-reqs"
- php: "8.3"
os: "windows-latest"
composer-deps: "highest"
composer-options: "--ignore-platform-reqs"

steps:
- name: "Configure Git (for Windows)"
if: ${{ matrix.os == 'windows-latest' }}
shell: "bash"
run: |
git config --system core.autocrlf false
git config --system core.eol lf
- name: "Checkout repository"
uses: "actions/[email protected]"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
with:
php-version: "${{ matrix.php }}"
coverage: "none"

- name: "Install dependencies (Composer)"
uses: "ramsey/[email protected]"
with:
dependency-versions: "${{ matrix.composer-deps }}"
composer-options: "${{ matrix.composer-options }}"

- name: "Run unit tests (PHPUnit)"
shell: "bash"
run: "composer dev:test:unit"
29 changes: 29 additions & 0 deletions .github/workflows/merge-me.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Merge Me! Documentation: https://github.com/ridedott/merge-me-action/

name: "Merge Dependabot PRs"

on:
workflow_run:
types:
- "completed"
workflows:
- "Continuous Integration"

jobs:
merge-me:
name: "Merge me!"
runs-on: "ubuntu-latest"
steps:
- name: "Auto-merge"
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: "ridedott/[email protected]"
with:
# This must be used as GitHub Actions token does not support pushing
# to protected branches.
#
# Create a token with repository permissions:
# https://github.com/settings/tokens/new?scopes=repo&description=Merge+Me!+GitHub+Actions+Workflow
#
# Set MERGE_TOKEN as an environment variable on your repository:
# https://github.com/yourname/repo-name/settings/secrets/actions/new
GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.phpunit.result.cache
/captainhook.config.json
/composer.lock
/phpcs.xml
/phpunit.xml
/vendor/
Loading

0 comments on commit cd791f9

Please sign in to comment.