Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility for PHP8 #116

Merged
merged 10 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-18.04' ] #, macos-latest, windows-latest ]
php-version: [ '7.2', '7.3', '7.4' ]
php-version: [ '7.3', '7.4', '8.0' ]

name: PHP ${{ matrix.php-version }} on OS ${{ matrix.os }}
steps:

- name: Acquire sources
uses: actions/checkout@v2
with:
fetch-depth: 2

# With GHA's "services", you cannot map volumes to your codebase BEFORE checking out the codebase.
# So, let's use `docker-compose` to bring in services AFTER checking out the code.
Expand All @@ -32,8 +34,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
# Select PHPUnit version suitable for PHP 7.2.
tools: composer, phpunit:^8.5
tools: composer, phpunit:^9.5

# Cache Composer Dependencies
# https://github.com/marketplace/actions/setup-php-action#cache-composer-dependencies
Expand All @@ -51,22 +52,21 @@ jobs:
run: composer install

- name: Run code style checks
run: composer run style
run: composer run check-style

- name: Run tests
run: composer run test

# https://github.com/php-coveralls/php-coveralls#github-actions
- name: Upload coverage results to Coveralls
if: always() && matrix.php-version == '7.4'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
# https://github.com/codecov/codecov-action
- name: Upload coverage results to Codecov
uses: codecov/codecov-action@v1
if: always() && (matrix.php-version == '7.4' || matrix.php-version == '8.0')
with:
files: ./build/logs/clover.xml
fail_ci_if_error: true

- name: Upload coverage results to Scrutinizer CI
if: always() && matrix.php-version == '7.4'
if: always() && (matrix.php-version == '7.4' || matrix.php-version == '8.0')
run: |
echo "Git HEAD ref:"
git log --pretty=%P -n1 HEAD
Expand Down
10 changes: 8 additions & 2 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ build:
analysis:
environment:
php:
version: 7.4
version: 8.0
tests:
override:
- php-scrutinizer-run --enable-security-analysis
Expand All @@ -39,4 +39,10 @@ build:

# https://scrutinizer-ci.com/docs/tools/external-code-coverage/
tools:
external_code_coverage: true
external_code_coverage:

enabled: true

# Scrutinizer will wait for two code coverage submissions
# in order to cover both PHP7 and PHP8.
runs: 2
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
Unreleased
==========

- Added support for PHP 8.0

- Removed support for PHP 7.2, it has reached end of life

- Bumped required guzzle http client dependency to ``^7.2``

2020/09/28 1.1.0
Expand Down
30 changes: 26 additions & 4 deletions DEVELOP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,22 @@ Installation

Install prerequisites::

brew install [email protected] composer
# Install different PHP releases and Composer.
brew install [email protected] [email protected] [email protected] brew-php-switcher composer

# Select PHP version.
brew-php-switcher 7.3
brew-php-switcher 7.4
brew-php-switcher 8.0

# Install `xdebug` extension into each environment for tracking code coverage.
pecl install xdebug

Get the sources::

git clone [email protected]:crate/crate-pdo.git

Setup environment::
Setup project dependencies::

composer install

Expand All @@ -105,11 +113,25 @@ Running the Tests
--mount type=bind,source=$PWD/test/provisioning/truststore,target=/vagrant/test/provisioning/truststore \
--publish 4200:4200 --publish 5432:5432 crate/crate:nightly

# Run test suite
# Run test suite on current/default version of PHP
composer run test

# Run tests on both PHP7 and PHP8 to get the full picture of coverage
composer run multicover
open build/multicover/html/index.html


Invoke code style checks
========================

::

# Run code style checks
composer run style
composer run check-style

# Some code style quirks can be automatically fixed
composer run fix-style



****************************
Expand Down
14 changes: 9 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ CrateDB PDO Adapter
:target: https://github.com/crate/crate-pdo/actions?workflow=Docs
:alt: Build status (documentation)

.. image:: https://coveralls.io/repos/github/crate/crate-pdo/badge.svg?branch=main
:target: https://coveralls.io/github/crate/crate-pdo
.. image:: https://codecov.io/gh/crate/crate-pdo/branch/main/graph/badge.svg
:target: https://app.codecov.io/gh/crate/crate-pdo
:alt: Coverage

.. image:: https://scrutinizer-ci.com/g/crate/crate-pdo/badges/quality-score.png?b=main
Expand All @@ -22,9 +22,13 @@ CrateDB PDO Adapter
:target: https://packagist.org/packages/crate/crate-pdo
:alt: Latest stable version

.. image:: https://poser.pugx.org/crate/crate-pdo/downloads
.. image:: https://img.shields.io/badge/PHP-7.3%2C%207.4%2C%208.0-green.svg
:target: https://packagist.org/packages/crate/crate-pdo
:alt: Total downloads
:alt: Supported PHP versions

.. image:: https://poser.pugx.org/crate/crate-pdo/d/monthly
:target: https://packagist.org/packages/crate/crate-pdo
:alt: Monthly downloads

.. image:: https://poser.pugx.org/crate/crate-pdo/license
:target: https://packagist.org/packages/crate/crate-pdo
Expand All @@ -48,7 +52,7 @@ Installation

The CrateDB PDO adapter is available as a Composer package. Install it like::

composer add crate/crate-pdo
composer require crate/crate-pdo

See the `installation documentation`_ for more info.

Expand Down
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# https://docs.codecov.io/docs/common-recipe-list
# https://docs.codecov.io/docs/commit-status#patch-status

coverage:
status:
project:
default:
target: 85% # the required coverage value
threshold: 3% # the leniency in hitting the target
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"homepage": "https://github.com/crate/crate-pdo",
"keywords": ["database", "pdo", "cratedb"],
"require": {
"php": "^7.2",
"php": "^7.3|^8.0|^8.1",
"ext-pdo": "*",
"guzzlehttp/guzzle": "^7.2"
},
Expand All @@ -23,7 +23,7 @@
}
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^0.12",
"squizlabs/php_codesniffer": "^3.5"
},
Expand All @@ -35,6 +35,9 @@
},
"scripts": {
"test": "XDEBUG_MODE=coverage phpunit --coverage-clover build/logs/clover.xml",
"style": "phpcs"
"coverage-html": "XDEBUG_MODE=coverage phpunit --coverage-html build/logs/html",
"multicover": "./devtools/php-multicover.sh",
amotl marked this conversation as resolved.
Show resolved Hide resolved
"check-style": "phpcs",
"fix-style": "phpcbf"
}
}
Loading