From f6e1821bf20cbcd8202b21dc5104b0e5688386c5 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Fri, 1 Jan 2021 20:29:43 +0900 Subject: [PATCH] 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 --- .github/workflows/ci.yaml | 60 +++++++++++++++++++ composer.json | 5 +- .../Spreadsheet/Excel/Writer/WorkbookTest.php | 2 +- .../Test/Spreadsheet/Excel/WriterTestCase.php | 2 +- 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..f50f278 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/composer.json b/composer.json index 1ae459d..29f3f17 100644 --- a/composer.json +++ b/composer.json @@ -31,14 +31,15 @@ } ], "require": { - "php": ">=5.3.3 <7.5", + "php": ">=5.6", "pear/ole": ">=1.0.0RC4", "pear/pear-core-minimal": "^1.10" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2", "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "<6.0" + "phpunit/phpunit": ">=5 <10", + "sanmai/phpunit-legacy-adapter": "^6 || ^8" }, "autoload": { "psr-0": { diff --git a/test/Test/Spreadsheet/Excel/Writer/WorkbookTest.php b/test/Test/Spreadsheet/Excel/Writer/WorkbookTest.php index 301c4c9..d15590a 100644 --- a/test/Test/Spreadsheet/Excel/Writer/WorkbookTest.php +++ b/test/Test/Spreadsheet/Excel/Writer/WorkbookTest.php @@ -6,7 +6,7 @@ */ class Test_Spreadsheet_Excel_Writer_WorkbookTest extends Test_Spreadsheet_Excel_WriterTestCase { - public static function setUpBeforeClass() + public static function doSetUpBeforeClass() { // Preload constants from OLE @class_exists(OLE::class); diff --git a/test/Test/Spreadsheet/Excel/WriterTestCase.php b/test/Test/Spreadsheet/Excel/WriterTestCase.php index 7d7d2a8..1e57b82 100644 --- a/test/Test/Spreadsheet/Excel/WriterTestCase.php +++ b/test/Test/Spreadsheet/Excel/WriterTestCase.php @@ -4,7 +4,7 @@ * @author stev leibelt * @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/';