Skip to content

Commit

Permalink
Quality of life
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiang committed May 13, 2022
1 parent 96353e5 commit 5d563b3
Show file tree
Hide file tree
Showing 63 changed files with 3,245 additions and 1,617 deletions.
10 changes: 6 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/.github export-ignore
/tests export-ignore
phpunit.xml.dist export-ignore
behat.yml export-ignore
.gitignore export-ignore
.gitattributes export-ignore
composer.lock export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpunit.xml.dist export-ignore
behat.yml export-ignore
composer.lock export-ignore
phpcs.xml export-ignore
psalm.xml export-ignore
37 changes: 37 additions & 0 deletions .github/workflows/behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Integration Tests

on:
push:
branches:
- '*'
pull_request:
- '*'

jobs:
integrationtest:
runs-on: ubuntu-latest

name: Behat

steps:
- uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run test suite
run: ./vendor/bin/behat
36 changes: 36 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Static Code Analysis

on: [push, pull_request]

jobs:
psalm:
name: Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Psalm
uses: docker://vimeo/psalm-github-actions
with:
security_analysis: true
report_file: results.sarif
composer_ignore_platform_reqs: true

- name: Upload Security Analysis results to GitHub
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: results.sarif

# we may use whatever way to install phpcs, just specify the path on the next step
# however, curl seems to be the fastest
- name: Install PHP_CodeSniffer
run: |
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
php phpcs.phar --version
- uses: tinovyatkin/action-php-codesniffer@v1
with:
files: "**.php" # you may customize glob as needed
phpcs_path: php phpcs.phar
standard: phpcs.xml

65 changes: 65 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Unit Tests

on:
push:
branches:
- '*'
pull_request:
- '*'

jobs:
unittest:
runs-on: ubuntu-latest

strategy:
matrix:
php:
- version: 7.4
coverage: false
- version: 8.0
coverage: true
- version: 8.1
coverage: false
prefer-lowest: ['', '--prefer-lowest']

name: Unit Tests - PHP ${{ matrix.php.version }} ${{ matrix.prefer-lowest }}

steps:
- uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php.version }}
extensions: mbstring

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Update dependencies
run: composer update --prefer-dist --no-progress --with-all-dependencies ${{ matrix.prefer-lowest }}

- name: Run test suite
if: ${{ ! matrix.php.coverage }}
run: ./vendor/bin/phpunit --verbose

- name: Run test suite with code coverage
if: ${{ matrix.php.coverage }}
run: ./vendor/bin/phpunit --verbose --coverage-clover=build/logs/clover.xml
env:
XDEBUG_MODE: coverage

- name: Upload code coverage to Scrutinizer
if: ${{ matrix.php.coverage }}
run: |
wget -q https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml || true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/tests/logs/*
!/tests/logs/.gitkeep
.phpunit.result.cache
.phpcs-cache
phpunit.xml
41 changes: 25 additions & 16 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
imports:
- php

build:
environment:
php: 8.0.0
nodes:
analysis:
project_setup:
override:
- 'true'
tests:
override:
- php-scrutinizer-run
-
command: phpcs-run

filter:
paths:
- src/*
excluded_paths:
- 'tests/*'
- 'bin/*'

checks:
php: true

coding_style:
php:
spaces:
around_operators:
concatenation: true

tools:
php_code_sniffer:
config:
standard: PSR2
php_sim: true
php_cpd: false
php_loc: true
php_hhvm: true
php_mess_detector: true
php_pdepend: true
php_analyzer: false
sensiolabs_security_checker: true
php_changetracking: true
php_cs_fixer: false
external_code_coverage:
runs: 1
timeout: 600
timeout: 300
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Simplified BSD License
======================

Copyright 2015 Fabian Grutschus.
Copyright 2015-2022 Fabian Grutschus.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ This is useful if you use foreign entities, which you can't change, but you like
to add own relations between them and your entities.

[![Latest Stable Version](https://poser.pugx.org/fabiang/doctrine-dynamic/version)](https://packagist.org/packages/fabiang/doctrine-dynamic)
[![License](https://poser.pugx.org/fabiang/doctrine-dynamic/license)](https://packagist.org/packages/fabiang/doctrine-dynamic)
[![Build Status](https://travis-ci.com/fabiang/doctrine-dynamic.svg?branch=master)](https://travis-ci.com/fabiang/doctrine-dynamic)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/?branch=master)
[![License](https://poser.pugx.org/fabiang/doctrine-dynamic/license)](https://packagist.org/packages/fabiang/doctrine-dynamic)
[![Unit Tests](https://github.com/fabiang/doctrine-dynamic/actions/workflows/unit.yml/badge.svg)](https://github.com/fabiang/doctrine-dynamic/actions/workflows/unit.yml)
[![Integration Tests](https://github.com/fabiang/doctrine-dynamic/actions/workflows/behat.yml/badge.svg)](https://github.com/fabiang/doctrine-dynamic/actions/workflows/behat.yml)
[![Static Code Analysis](https://github.com/fabiang/doctrine-dynamic/actions/workflows/static.yml/badge.svg)](https://github.com/fabiang/doctrine-dynamic/actions/workflows/static.yml)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/?branch=main)
[![Code Coverage](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/badges/coverage.png?b=main)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic/?branch=main)

## Features

Expand All @@ -31,7 +33,7 @@ $ composer require fabiang/doctrine-dynamic

## Framework integration

* [Laminas (also Zend Framework 2 & 3)](https://github.com/fabiang/doctrine-dynamic-laminas)
* [Laminas](https://github.com/fabiang/doctrine-dynamic-laminas)

## Usage

Expand Down
29 changes: 26 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,40 @@
},
"minimum-stability": "stable",
"require": {
"php": "^7.4 || ^8.0",
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"doctrine/common": "^3.0",
"doctrine/orm": "^2.5",
"doctrine/persistence": "^3.0",
"laminas/laminas-hydrator": "^3.0 || ^4.0",
"laminas/laminas-stdlib": "^3.0"
},
"require-dev": {
"behat/behat": "^3.8",
"dms/phpunit-arraysubset-asserts": "^0.2.1",
"dms/phpunit-arraysubset-asserts": "^0.4.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/php-invoker": "^3.1",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"symfony/cache": "^5.4 || ^6.0",
"doctrine/annotations": "^1.13",
"laminas/laminas-coding-standard": "^2.3",
"vimeo/psalm": "^4.23"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"phpcs": "phpcs",
"psalm": "psalm --no-cache",
"phpunit": "phpunit",
"behat": "behat",
"test": [
"@phpcs",
"@psalm",
"@phpunit",
"@behat"
]
}
}
Loading

0 comments on commit 5d563b3

Please sign in to comment.