-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from mikehaertl/github-actions
Migrate to GitHub Actions
- Loading branch information
Showing
9 changed files
with
73 additions
and
39 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Tests | ||
on: pull_request | ||
jobs: | ||
phpunit: | ||
name: PHP ${{ matrix.php }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: | ||
- "5.3" | ||
- "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 }} | ||
tools: composer:v2 | ||
|
||
- name: Update composer | ||
run: composer self-update | ||
|
||
- 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: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install composer packages | ||
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi | ||
|
||
- name: Run phpunit | ||
run: vendor/bin/phpunit --color=always |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
phpunit.xml | ||
composer.lock | ||
/vendor/ | ||
.phpunit.result.cache | ||
*.swp |
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
<?php | ||
// Some travis environments use phpunit > 6 | ||
$newClass = '\PHPUnit\Framework\TestCase'; | ||
$oldClass = '\PHPUnit_Framework_TestCase'; | ||
if (!class_exists($newClass) && class_exists($oldClass)) { | ||
class_alias($oldClass, $newClass); | ||
/** | ||
* Utility method to check the version of PHPUnit. | ||
* | ||
* Example: phpUnitVersion('<', '8.3'); // true e.g. for 8.2.1 | ||
* | ||
* @param string $operator an operator like '>', '<', etc. | ||
* @param string $version the version to check against | ||
* @return bool whether PHPUnit matches the version to check | ||
*/ | ||
function phpUnitVersion($operator, $version) | ||
{ | ||
$phpUnitVersion = class_exists('\PHPUnit\Runner\Version') ? | ||
call_user_func(array('\PHPUnit\Runner\Version', 'id')) : | ||
call_user_func(array('\PHPUnit_Runner_Version', 'id')); | ||
return version_compare($phpUnitVersion, $version, $operator); | ||
} | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
// Default in some installations | ||
setlocale(LC_CTYPE, 'C'); |