Skip to content

Commit

Permalink
Merge pull request #1 from Lctrs/feature/initial
Browse files Browse the repository at this point in the history
feat: initial implementation
  • Loading branch information
Lctrs committed Oct 16, 2021
2 parents d22d26a + acebc85 commit 65d2c2b
Show file tree
Hide file tree
Showing 42 changed files with 10,016 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .editorconfig
@@ -0,0 +1,23 @@
root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.json{,.dist}]
indent_size = 2

[*.neon{,.dist}]
indent_style = tab

[*.{yml,yaml}{,.dist}]
indent_size = 2

[Makefile]
indent_style = tab
17 changes: 17 additions & 0 deletions .gitattributes
@@ -0,0 +1,17 @@
/.github/ export-ignore
/.tools/ export-ignore
/test/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.yamllint.yaml export-ignore
/composer-require-checker.json export-ignore
/composer.lock export-ignore
/infection.json.dist export-ignore
/Makefile export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
/update-license.php export-ignore
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -0,0 +1 @@
* @lctrs-bot @Lctrs
107 changes: 107 additions & 0 deletions .github/CONTRIBUTING.md
@@ -0,0 +1,107 @@
# CONTRIBUTING

We are using [GitHub Actions](https://github.com/features/actions) as a continuous integration system.

For details, take a look at the following workflow configuration files:

- [`workflows/integrate.yaml`](workflows/integrate.yaml)
- [`workflows/merge.yaml`](workflows/merge.yaml)
- [`workflows/release.yaml`](workflows/release.yaml)
- [`workflows/renew.yaml`](workflows/renew.yaml)
- [`workflows/triage.yaml`](workflows/triage.yaml)

## Coding Standards

We are using [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`.

We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files.

We are using [`doctrine/coding-standard`](https://github.com/doctrine-coding-standard) to enforce coding standards.

Run

```sh
$ make coding-standards
```

to automatically fix coding standard violations.

## Dependency Analysis

We are using [`maglnet/composer-require-checker`](https://github.com/maglnet/ComposerRequireChecker) to prevent the use of unknown symbols in production code.

Run

```sh
$ make dependency-analysis
```

to run a dependency analysis.

## Static Code Analysis

We are using [`phpstan/phpstan`](https://github.com/phpstan/phpstan) and [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code.

Run

```sh
$ make static-code-analysis
```

to run a static code analysis.

We are also using the baseline features of [`phpstan/phpstan`](https://phpstan.org/user-guide/baseline) and [`vimeo/psalm`](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file).

Run

```sh
$ make static-code-analysis-baseline
```

to regenerate the baselines in [`../phpstan-baseline.neon`](../phpstan-baseline.neon) and [`../psalm-baseline.xml`](../psalm-baseline.xml).

:exclamation: Ideally, the baselines should shrink over time.

## Tests

We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.

Run

```sh
$ make tests
```

to run all the tests.

## Mutation Tests

We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests.

Enable `pcov` or `Xdebug` and run

```sh
$ make mutation-tests
```

to run mutation tests.

## Extra lazy?

Run

```sh
$ make
```

to enforce coding standards, run a dependency analysis, run a static code analysis, and run tests!

## Help

:bulb: Run

```sh
$ make help
```

to display a list of available targets with corresponding descriptions.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,22 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: Lctrs

---

#### Steps required to reproduce the problem

1.
2.
3.

#### Expected Result

*

#### Actual Result

*
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,8 @@
This PR

* [x]
* [ ]

Follows #.
Related to #.
Fixes #.
@@ -0,0 +1,16 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions
# https://getcomposer.org/doc/03-cli.md#composer-cache-dir

name: "Determine composer cache directory"

description: "Determines the composer cache directory and exports it as COMPOSER_CACHE_DIR environment variable"

runs:
using: "composite"

steps:
- name: "Determine composer cache directory"
shell: "bash"
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV"
27 changes: 27 additions & 0 deletions .github/actions/composer/composer/install/action.yaml
@@ -0,0 +1,27 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions

name: "Install dependencies with composer"

description: "Installs dependencies with composer"

inputs:
dependencies:
description: "Which dependencies to install, one of \"lowest\", \"locked\", \"highest\""
required: true
working-directory:
default: "."
description: "Directory in which composer will run, defaults to current directory"
required: false

runs:
using: "composite"

steps:
- name: "Install ${{ inputs.dependencies }} dependencies with composer"
shell: "bash"
run: "${{ github.action_path }}/run.sh"
env:
COMPOSER_INSTALL_DEPENDENCIES: "${{ inputs.dependencies }}"
COMPOSER_WORKING_DIRECTORY: "${{ inputs.working-directory }}"
26 changes: 26 additions & 0 deletions .github/actions/composer/composer/install/run.sh
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

dependencies="${COMPOSER_INSTALL_DEPENDENCIES}"
working_directory="${COMPOSER_WORKING_DIRECTORY}"

if [[ ${dependencies} == "lowest" ]]; then
composer update --no-interaction --no-progress --prefer-lowest --working-dir="${working_directory}"

exit $?
fi

if [[ ${dependencies} == "locked" ]]; then
composer install --no-interaction --no-progress --working-dir="${working_directory}"

exit $?
fi

if [[ ${dependencies} == "highest" ]]; then
composer update --no-interaction --no-progress --working-dir="${working_directory}"

exit $?
fi

echo "::error::The value for the \"dependencies\" input needs to be one of \"lowest\", \"locked\"', \"highest\"' - got \"${dependencies}\" instead."

exit 1
51 changes: 51 additions & 0 deletions .github/dependabot.yaml
@@ -0,0 +1,51 @@
# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2

updates:
- commit-message:
include: "scope"
prefix: "tools"
directory: "/.tools/composer-require-checker"
labels:
- "dependency"
open-pull-requests-limit: 10
package-ecosystem: "composer"
schedule:
interval: "daily"
versioning-strategy: "increase"

- commit-message:
include: "scope"
prefix: "tools"
directory: "/.tools/infection"
labels:
- "dependency"
open-pull-requests-limit: 10
package-ecosystem: "composer"
schedule:
interval: "daily"
versioning-strategy: "increase"

- commit-message:
include: "scope"
prefix: "composer"
directory: "/"
labels:
- "dependency"
open-pull-requests-limit: 10
package-ecosystem: "composer"
schedule:
interval: "daily"
versioning-strategy: "increase"

- commit-message:
include: "scope"
prefix: "github-actions"
directory: "/"
labels:
- "dependency"
open-pull-requests-limit: 10
package-ecosystem: "github-actions"
schedule:
interval: "daily"
87 changes: 87 additions & 0 deletions .github/settings.yml
@@ -0,0 +1,87 @@
# https://github.com/probot/settings

branches:
- name: "master"

# https://docs.github.com/en/rest/reference/repos#delete-branch-protection
# https://docs.github.com/en/rest/reference/repos#update-branch-protection

protection:
enforce_admins: false
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_approving_review_count: 1
required_status_checks:
contexts:
- "Code Coverage (8.0, locked)"
- "Coding Standards (8.0, locked)"
- "Dependency Analysis (8.0, locked)"
- "Mutation Tests (8.0, locked)"
- "Static Code Analysis (8.0, locked)"
- "Tests (7.3, highest)"
- "Tests (7.3, locked)"
- "Tests (7.3, lowest)"
- "Tests (7.4, highest)"
- "Tests (7.4, locked)"
- "Tests (7.4, lowest)"
- "Tests (8.0, highest)"
- "Tests (8.0, locked)"
- "Tests (8.0, lowest)"
- "Tests (8.1, highest)"
- "Tests (8.1, locked)"
- "Tests (8.1, lowest)"
strict: false
restrictions: null

# https://docs.github.com/en/rest/reference/issues#create-a-label
# https://docs.github.com/en/rest/reference/issues#update-a-label

labels:
- name: "bug"
color: "ee0701"
description: ""

- name: "dependency"
color: "0366d6"
description: ""

- name: "enhancement"
color: "0e8a16"
description: ""

- name: "question"
color: "cc317c"
description: ""

- name: "security"
color: "ee0701"
description: ""

- name: "stale"
color: "eeeeee"
description: ""

# https://docs.github.com/en/rest/reference/repos#update-a-repository

repository:
allow_merge_commit: true
allow_rebase_merge: false
allow_squash_merge: false
archived: false
default_branch: "master"
delete_branch_on_merge: true
description: "A circular buffer implementation in PHP"
enable_automated_security_fixes: true
enable_vulnerability_alerts: true
has_downloads: true
has_issues: true
has_pages: false
has_projects: false
has_wiki: false
name: "circular-buffer"
private: false

# https://docs.github.com/en/rest/reference/repos#replace-all-repository-topics

topics: "php, circular, buffer, queue, ring, cyclic"

0 comments on commit 65d2c2b

Please sign in to comment.