switch to Github actions

This commit is contained in:
madflow 2020-08-31 20:49:52 +02:00 committed by madflow
parent ab973cab34
commit f5f7705e06
3 changed files with 41 additions and 61 deletions

40
.github/workflows/php.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Unit Tests
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php: ["7.1", "7.2", "7.3", "7.4"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run test suite
run: ./vendor/bin/phpunit --no-coverage
- name: Run code style check
if: matrix.php == '7.1'
run: vendor/bin/php-cs-fixer fix --config=.php_cs.dist --verbose --diff --dry-run

View File

@ -44,6 +44,7 @@ $config = PhpCsFixer\Config::create()
'single_line_comment_style' => ['comment_types' => ['hash']], 'single_line_comment_style' => ['comment_types' => ['hash']],
'strict_comparison' => true, 'strict_comparison' => true,
'yoda_style' => ['equal' => false, 'identical' => false], 'yoda_style' => ['equal' => false, 'identical' => false],
'phpdoc_var_without_name' => false,
]); ]);
$config->setFinder( $config->setFinder(

View File

@ -1,61 +0,0 @@
dist: bionic
sudo: false
language: php
matrix:
include:
- php: 7.1
env: WITH_CS=true
- php: 7.1
env: WITH_PHPUNIT=true WITH_COVERAGE=true
- php: 7.2
env: WITH_PHPUNIT=true
- php: 7.3
env: WITH_PHPUNIT=true
- php: 7.4
env: WITH_PHPUNIT=true
cache:
directories:
- $HOME/.composer/cache
- $HOME/.php-cs-fixer
before_install:
- |
if [[ "$WITH_COVERAGE" != "true" ]]; then
phpenv config-rm xdebug.ini
fi
if [[ "$WITH_CS" != "true" ]]; then
composer remove friendsofphp/php-cs-fixer --dev --no-update
fi
- composer validate
install:
- composer install --no-interaction --prefer-source
before_script:
- mkdir -p "$HOME/.php-cs-fixer"
- mkdir -p build/logs
script:
- |
if [[ "$WITH_CS" == "true" ]]; then
vendor/bin/php-cs-fixer fix --config=.php_cs.dist --verbose --diff --dry-run
fi
- |
if [[ "$WITH_PHPUNIT" == "true" ]]; then
if [[ "$WITH_COVERAGE" == "true" ]]; then
vendor/bin/phpunit --coverage-clover=build/logs/coverage.clover
else
vendor/bin/phpunit --no-coverage
fi
fi
after_script:
- |
if [[ "$WITH_COVERAGE" == "true" ]]; then
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/logs/coverage.clover
fi