Merge pull request #345 from kowsar89/suppress-warnings #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
env: | |
WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-20.04, windows-2022] # We pick something other than in coverage.yml, which is also run on pushes | |
php: [5.6, 7.2] # We pick something other than in coverage.yml, which is also run on pushes | |
exclude: # phpunit is malfunctioning on Windows / PHP 5.6, so disable those tests | |
- os: windows-2019 | |
php: 5.6 | |
- os: windows-2022 | |
php: 5.6 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: none | |
extensions: exif, mbstring, fileinfo, gd, vips, gmagick, imagick | |
- name: Validate composer.json | |
run: composer validate --strict | |
- name: Composer alterations for PHP 7.2 | |
if: matrix.php == '7.2' | |
run: | | |
echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" | |
composer require "phpunit/phpunit:^8.0" --dev --no-update | |
- name: Composer alterations for PHP 7.1 | |
if: matrix.php == '7.1' | |
run: | | |
echo "Removing phpstan, as it does not work on PHP 7.1" | |
composer remove phpstan/phpstan --dev --no-update | |
echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" | |
composer require "phpunit/phpunit:^7.0" --dev --no-update | |
- name: Composer alterations for PHP 7.0 | |
if: matrix.php == '7.0' | |
run: | | |
echo "Remove phpstan, as it does not work on PHP 7.0" | |
composer remove phpstan/phpstan --dev --no-update | |
echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" | |
composer require "phpunit/phpunit:^6.0" --dev --no-update | |
- name: Composer alterations for PHP 5.6 | |
if: matrix.php == '5.6' | |
run: | | |
echo "Remove phpstan, as it does not work on PHP 5.6" | |
composer remove phpstan/phpstan --dev --no-update | |
echo "Downgrading phpunit to ^5.0, which is the highest version that supports PHP 5.6" | |
composer require "phpunit/phpunit:^5.0" --dev --no-update | |
- name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) | |
run: composer update --no-install | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} | |
${{ runner.os }}-php-${{ matrix.php }} | |
${{ runner.os }}-php- | |
- name: Composer install | |
run: composer install --prefer-dist --no-progress | |
- name: Run phpunit (test cases) | |
run: composer run-script test | |
- name: Run phpstan on PHP>=7.2 (to check php syntax) | |
if: (matrix.php != '5.6') && (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') | |
run: composer run-script phpstan | |
- name: run phpcs (to check coding style) | |
run: composer run-script phpcs-all |