Skip to content

Commit

Permalink
Use GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Oct 30, 2020
1 parent 66c4191 commit 6e95ca1
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 49 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: build

on: [push, pull_request]

env:
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi"

jobs:
phpunit:
name: PHP ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update $DEFAULT_COMPOSER_FLAGS
- name: Run unit tests with coverage
run: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover --colors=always
if: matrix.php == '7.1'
- name: Run unit tests without coverage
run: vendor/bin/phpunit --verbose --colors=always
if: matrix.php != '7.1'
- name: Upload code coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
if: matrix.php == '7.1'
continue-on-error: true # if is fork
48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

12 changes: 11 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"bower-asset/bootstrap": "3.4.* | 3.3.* | 3.2.* | 3.1.*"
},
"require-dev": {
"phpunit/phpunit": "<7"
"cweagans/composer-patches": "^1.7",
"phpunit/phpunit": "4.8.34"
},
"repositories": [
{
Expand All @@ -52,6 +53,15 @@
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
},
"patches": {
"phpunit/phpunit-mock-objects": {
"Fix PHP 7 and 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch"
},
"phpunit/phpunit": {
"Fix PHP 7 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php7.patch",
"Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch"
}
}
}
}

0 comments on commit 6e95ca1

Please sign in to comment.