Skip to content

Commit

Permalink
Merge pull request #5 from onmoon/ticket_3
Browse files Browse the repository at this point in the history
php 8 compatibility, ci
  • Loading branch information
sspat authored Oct 19, 2021
2 parents 5c57763 + 89d10bb commit 7173d65
Show file tree
Hide file tree
Showing 18 changed files with 493 additions and 193 deletions.
246 changes: 246 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: CI

on:
- pull_request
- push


env:
PHP_EXTENSIONS: dom, mbstring, xml, bcmath
PHP_INI_VALUES: memory_limit=-1, assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On

jobs:
unit:
name: Unit tests ${{matrix.php-versions}}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.0']
phpunit-versions: ['latest']
compiler:
- default

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: composer:v2
coverage: none

- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-versions }}-composer-
- name: Update composer
run: composer self-update

- name: Update dependencies with composer
run: composer update --no-interaction --no-ansi --no-progress

- name: Execute tests
run: vendor/bin/phpunit

psalm:
name: Psalm ${{matrix.php-versions}}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.0']
phpunit-versions: ['latest']
compiler:
- default

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: composer:v2
coverage: none

- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-versions }}-composer-
- name: Update composer
run: composer self-update

- name: Update dependencies with composer
run: composer update --no-interaction --no-ansi --no-progress

- name: Execute Psalm
run: vendor/bin/psalm
stan:
name: PhpStan ${{matrix.php-versions}}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.0']
phpunit-versions: ['latest']
compiler:
- default

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: composer:v2
coverage: none

- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-versions }}-composer-
- name: Update composer
run: composer self-update

- name: Update dependencies with composer
run: composer update --no-interaction --no-ansi --no-progress

- name: Execute PhpStan
run: composer stan

code-style:
name: Code style ${{matrix.php-versions}}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.0']
phpunit-versions: ['latest']
compiler:
- default

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: composer:v2
coverage: none

- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-versions }}-composer-
- name: Update composer
run: composer self-update

- name: Update dependencies with composer
run: composer update --no-interaction --no-ansi --no-progress

- name: Execute PhpCs
run: composer cs

security:
name: Security check ${{matrix.php-versions}}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.0']
phpunit-versions: ['latest']
compiler:
- default

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: composer:v2
coverage: none

- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-versions }}-composer-
- name: Update composer
run: composer self-update

- name: Update dependencies with composer
run: composer update --no-interaction --no-ansi --no-progress

- name: Execute security check
run: composer sec
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# OnMoon Money

[![Latest Version](https://img.shields.io/github/v/release/onmoon/money)](https://github.com/onmoon/money/releases)
[![Build](https://img.shields.io/travis/onmoon/money/master)](https://travis-ci.org/onmoon/money)
[![Build](https://github.com/onmoon/money/actions/workflows/ci.yml/badge.svg)](https://github.com/onmoon/money/actions)
[![License](https://img.shields.io/github/license/onmoon/money)](https://github.com/onmoon/money/blob/master/LICENSE)
[![Email](https://img.shields.io/badge/[email protected]?style=flat-square)](mailto:[email protected])

Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
}
],
"require": {
"php": "^7.4",
"php": "~8.0",
"ext-bcmath": "*",
"doctrine/dbal": "^2.10",
"moneyphp/money": "^3.3",
"thecodingmachine/safe": "^1.0"
"doctrine/dbal": "^2",
"moneyphp/money": "^4.0",
"thecodingmachine/safe": "^1.3"
},
"require-dev": {
"doctrine/coding-standard": "^7.0",
"phpstan/phpstan": "^0.12.11",
"phpunit/phpunit": "^7.5",
"roave/no-floaters": "^1.3",
"doctrine/coding-standard": "^9.0",
"phpstan/phpstan": "^0.12",
"phpunit/phpunit": "^9.5",
"roave/no-floaters": "^1.4",
"sensiolabs/security-checker": "^6.0",
"squizlabs/php_codesniffer": "^3.5",
"squizlabs/php_codesniffer": "^3.6",
"thecodingmachine/phpstan-safe-rule": "^1.0",
"vimeo/psalm": "^3.9"
"vimeo/psalm": "^4.10"
},
"minimum-stability": "stable",
"config": {
Expand All @@ -56,7 +56,7 @@
"csfix": "phpcbf",
"psalm": "psalm",
"stan": "phpstan analyze src -l 8 --memory-limit=512m",
"sec": "security-checker security:check",
"sec": "rm -f local-php-security-checker && curl -s https://api.github.com/repos/fabpot/local-php-security-checker/releases/latest | grep -E \"browser_download_url(.+)linux_amd64\" | cut -d : -f 2,3 | tr -d \\\" | xargs -I % curl % -L -o local-php-security-checker && chmod +x local-php-security-checker && ./local-php-security-checker",
"test": "phpunit",
"all": "composer psalm && composer stan && composer test && composer cs && composer sec"
}
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
checkMissingIterableValueType: false
reportUnmatchedIgnoredErrors: false
includes:
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
- vendor/roave/no-floaters/rules.neon
31 changes: 12 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="./tests/bootstrap.php"
>
<testsuites>
<testsuite name="OnMoon Doctrine Money Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" colors="true" beStrictAboutOutputDuringTests="true" beStrictAboutTodoAnnotatedTests="true" bootstrap="./tests/bootstrap.php">
<coverage>
<include>
<directory>./src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="OnMoon Doctrine Money Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 0 additions & 2 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
totallyTyped="true"
resolveFromConfigFile="true"
useDocblockTypes="true"
requireVoidReturnType="true"
allowPhpStormGenerics="true"
ignoreInternalFunctionFalseReturn="false"
ignoreInternalFunctionNullReturn="false"
Expand Down Expand Up @@ -35,7 +34,6 @@
<MissingReturnType errorLevel="error"/>
<MissingPropertyType errorLevel="error"/>
<InvalidDocblock errorLevel="error"/>
<MisplacedRequiredParam errorLevel="error"/>

<PropertyNotSetInConstructor errorLevel="suppress"/>
<MissingConstructor errorLevel="error"/>
Expand Down
Loading

0 comments on commit 7173d65

Please sign in to comment.