Add GitHub workflows, test on PHP 8 (#31)

* Add GitHub workflows, test on PHP 8

* Reflect that package is not installable under PHP <5.6 due to deps
This commit is contained in:
Alexey Kopytko 2021-01-01 20:29:43 +09:00 committed by GitHub
parent c98a4309ac
commit f6e1821bf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 4 deletions

60
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,60 @@
# yamllint disable rule:line-length
# yamllint disable rule:braces
name: Continuous Integration
on:
pull_request:
push:
branches:
- main
- master
jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-latest']
php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
name: CI on ${{ matrix.operating-system }} with PHP ${{ matrix.php-version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-${{ matrix.composer-flags }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
- name: Install dependencies
run: |
composer update --no-interaction --prefer-dist --no-progress ${{ matrix.composer-flags }}
- name: Run tests
run: |
vendor/bin/phpunit
- name: Lint code
run: |
find Spreadsheet/ -type f -name \*.php | xargs -n1 php -l

View File

@ -31,14 +31,15 @@
} }
], ],
"require": { "require": {
"php": ">=5.3.3 <7.5", "php": ">=5.6",
"pear/ole": ">=1.0.0RC4", "pear/ole": ">=1.0.0RC4",
"pear/pear-core-minimal": "^1.10" "pear/pear-core-minimal": "^1.10"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^2", "friendsofphp/php-cs-fixer": "^2",
"php-coveralls/php-coveralls": "^2.2", "php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "<6.0" "phpunit/phpunit": ">=5 <10",
"sanmai/phpunit-legacy-adapter": "^6 || ^8"
}, },
"autoload": { "autoload": {
"psr-0": { "psr-0": {

View File

@ -6,7 +6,7 @@
*/ */
class Test_Spreadsheet_Excel_Writer_WorkbookTest extends Test_Spreadsheet_Excel_WriterTestCase class Test_Spreadsheet_Excel_Writer_WorkbookTest extends Test_Spreadsheet_Excel_WriterTestCase
{ {
public static function setUpBeforeClass() public static function doSetUpBeforeClass()
{ {
// Preload constants from OLE // Preload constants from OLE
@class_exists(OLE::class); @class_exists(OLE::class);

View File

@ -4,7 +4,7 @@
* @author stev leibelt <artodeto@bazzline.net> * @author stev leibelt <artodeto@bazzline.net>
* @since 2016-01-17 * @since 2016-01-17
*/ */
class Test_Spreadsheet_Excel_WriterTestCase extends PHPUnit_Framework_TestCase class Test_Spreadsheet_Excel_WriterTestCase extends \LegacyPHPUnit\TestCase
{ {
const FIXTURES_PATH = 'test/fixture/'; const FIXTURES_PATH = 'test/fixture/';