Skip to content

Commit

Permalink
Added two github actions workflows: for running only tests and for ru…
Browse files Browse the repository at this point in the history
…nning tests with coverage
  • Loading branch information
alexsoft committed Jan 5, 2021
1 parent 2cedb10 commit 52fb68a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
/.github export-ignore
32 changes: 32 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Unit test coverage

on:
- push
- pull_request

jobs:
tests:
runs-on: ubuntu-latest
name: Unit test coverage

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: composer:v2
coverage: pcov

- name: Install dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit --verbose --coverage-text --coverage-clover=coverage.clover

- name: Send coverage to Scrutinizer
run: |
wget -q https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PHPUnit tests

on:
- push
- pull_request

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [7.1, 7.2, 7.3, 7.4, 8.0]
stability: [prefer-lowest, prefer-stable]

name: Tests on PHP ${{ matrix.php }} - ${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-source --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit --verbose
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"require-dev": {
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.0 || ^8.0"
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
},
"autoload": {
"psr-4": {
Expand All @@ -40,8 +40,7 @@
}
},
"scripts": {
"test": "phpunit",
"test:coverage": "phpunit --coverage-text --coverage-clover=coverage.clover"
"test": "phpunit"
},
"config": {
"sort-packages": true
Expand Down

0 comments on commit 52fb68a

Please # to comment.