Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
🎉
  • Loading branch information
romm committed Aug 7, 2023
0 parents commit 4b2ae16
Show file tree
Hide file tree
Showing 67 changed files with 8,478 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.php text eol=lf

/.github/ export-ignore
/docs/ export-ignore
/tests/ export-ignore

/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/composer.lock export-ignore
/infection.json.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [romm]
47 changes: 47 additions & 0 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Mutation tests
on:
push:
branches:
- master
pull_request:
jobs:
mutation:
name: Mutation tests
runs-on: ubuntu-latest
env:
php-version: '8.2'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed for the `git diff` used below for Infection

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
coverage: pcov

- uses: "ramsey/composer-install@v2"

- name: Creating var directory
run: mkdir -p var/cache

- name: Cache Mutation results
uses: actions/cache@v3.2.5
with:
path: var/cache
key: mutation-${{ hashFiles('composer.lock') }}-${{ hashFiles('.github/workflows/mutation.yml') }}
restore-keys: mutation-${{ hashFiles('composer.lock') }}-${{ hashFiles('.github/workflows/mutation.yml') }}

- name: Running mutation tests
if: github.ref == 'refs/heads/master'
run: php vendor/bin/infection --threads=$(nproc)
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}

- name: Running mutation tests
if: github.event_name == 'pull_request'
run: |
git fetch --depth=1 origin $GITHUB_BASE_REF
php vendor/bin/infection --threads=$(nproc) --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations --only-covered
50 changes: 50 additions & 0 deletions .github/workflows/quality-assurance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Coding Standards & Static Analysis
on: [push, pull_request]
jobs:
qa:
name: Quality Assurance
runs-on: ubuntu-latest
env:
php-version: '8.2'
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
coverage: none # Xdebug is installed by default, so we remove it manually

- name: Creating var directory
run: mkdir -p var/cache

- name: Cache QA results
uses: actions/cache@v3.2.5
with:
path: var/cache
key: qa-${{ hashFiles('composer.lock') }}-${{ hashFiles('.github/workflows/quality-assurance.yml') }}
restore-keys: qa-${{ hashFiles('composer.lock') }}-${{ hashFiles('.github/workflows/quality-assurance.yml') }}

- name: Checking Composer
run: composer validate --strict

- uses: "ramsey/composer-install@v2"

- name: Checking for forgotten TODO
run: composer check-todo

- name: Warming up cache
run: php tests/App/bin/console cache:warmup --env=test

- name: TODO TMP
run: |
pwd
ls -al var/cache/test
ls -al var/cache/test/default
- name: Running PHPStan
run: php vendor/bin/phpstan

- name: Running PHP Coding Standards Fixer
run: php vendor/bin/php-cs-fixer fix --dry-run
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests
on: [push, pull_request]
jobs:
tests:
name: PHP ${{ matrix.php-version }} / ${{ matrix.dependencies }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dependencies:
- "lowest"
- "highest"
- "locked"
php-version:
- "8.1"
- "8.2"

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none # Xdebug is installed by default, so we remove it manually

- uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}

- name: Running tests
run: php vendor/bin/phpunit
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea
var
vendor
phpstan.neon
.phpunit.result.cache
22 changes: 22 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

$finder = PhpCsFixer\Finder::create()->in([
'./src',
'./tests',
]);

return (new PhpCsFixer\Config())
->setFinder($finder)
->setCacheFile('var/cache/.php_cs.cache')
->setRules([
'@PSR1' => true,
'@PSR12' => true,
'no_unused_imports' => true,
'no_extra_blank_lines' => true,
'no_empty_phpdoc' => true,
'single_line_empty_body' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
'remove_inheritdoc' => true,
],
]);
18 changes: 18 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) Romain Canon

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 4b2ae16

Please sign in to comment.