Skip to content

Commit

Permalink
Drop php<8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fab2s committed Aug 28, 2023
1 parent 0aedae3 commit af64a06
Show file tree
Hide file tree
Showing 11 changed files with 378 additions and 710 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI
on: [pull_request]
jobs:
tests:
name: Math CI PHP ${{ matrix.php-versions }}
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '8.2', '8.1', '8.0' ]

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, gmp, bcmath

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Remove composer.lock
run: rm -f composer.lock

- name: Remove Pint
run: composer remove "laravel/pint" --dev --no-update

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Test with phpunit
run: vendor/bin/phpunit
52 changes: 52 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: QA
on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize ]
jobs:
tests:
name: Math QA
runs-on: ubuntu-latest

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: mbstring, dom, fileinfo, gmp, bcmath
coverage: xdebug

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Remove composer.lock
run: rm -f composer.lock

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Check code style
run: vendor/bin/pint --config pint.json --test

- name: Compute Coverage
run: vendor/bin/phpunit --coverage-clover ./coverage.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests
name: codecov-math
141 changes: 0 additions & 141 deletions .php_cs

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ $number->setPrecision(14); // will use precision 14 for any further calculations

## Requirements

`Math` is tested against php 7.1, 7.2, 7.3, 7.4 and 8.0
`Math` is tested against php 8.0, 8.1 and 8.2

## Contributing

Expand Down
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
"MIT"
],
"require" : {
"php": ">=7.1",
"php": "^8.0",
"ext-bcmath": "*"
},
"require-dev": {
"phpunit/phpunit": "~7.0|~8.0"
"phpunit/phpunit": "^10.0",
"laravel/pint": "^1.11"
},
"autoload": {
"classmap": [
Expand All @@ -33,6 +34,15 @@
"fab2s\\Math\\Tests\\": "tests/"
}
},
"scripts": {
"post-update-cmd": [
"rm -rf .*.cache"
],
"post-install-cmd": [
"rm -rf .*.cache"
],
"fix": "@php vendor/bin/pint --config pint.json"
},
"suggest": {
"ext-gmp": "For faster Math::baseConvert up to base62"
}
Expand Down
37 changes: 14 additions & 23 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
</php>
</phpunit>
77 changes: 77 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"preset": "laravel",
"rules": {
"header_comment": {
"header": "This file is part of fab2s/Math.\n(c) Fabrice de Stefanis / https://github.com/fab2s/Math\nThis source file is licensed under the MIT license which you will\nfind in the LICENSE file or at https://opensource.org/licenses/MIT"
},
"assign_null_coalescing_to_coalesce_equal": true,
"binary_operator_spaces": {
"default": "align_single_space_minimal"
},
"class_definition": true,
"blank_lines_before_namespace": true,
"align_multiline_comment": true,
"class_attributes_separation": {
"elements": {
"method": "one",
"const": "only_if_meta",
"property": "only_if_meta",
"trait_import": "only_if_meta"
}
},
"concat_space": {
"spacing": "one"
},
"global_namespace_import": {
"import_classes": true,
"import_functions": false,
"import_constants": false
},
"no_superfluous_phpdoc_tags": true,
"method_argument_space": {
"on_multiline": "ensure_fully_multiline"
},
"method_chaining_indentation": true,
"multiline_whitespace_before_semicolons": {
"strategy": "new_line_for_chained_calls"
},
"operator_linebreak": {
"position": "beginning"
},
"ordered_class_elements": {
"order": [
"use_trait",
"constant",
"case",
"property",
"method"
]
},
"phpdoc_align": true,
"phpdoc_separation": {
"groups": [
[
"param"
],
[
"return"
]
]
},
"php_unit_method_casing": {
"case": "snake_case"
},
"return_type_declaration": true,
"simplified_null_return": true,
"single_trait_insert_per_statement": true,
"trailing_comma_in_multiline": {
"elements": [
"parameters",
"arguments"
]
}
},
"exclude": [
"vendor"
]
}
Loading

0 comments on commit af64a06

Please sign in to comment.