Skip to content

Migrate to GitHub Actions #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/tests.yml
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
phpunit.xml
composer.lock
/vendor/
.phpunit.result.cache
*.swp
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
php-shellcommand
===========

[![Build Status](https://secure.travis-ci.org/mikehaertl/php-shellcommand.png)](http://travis-ci.org/mikehaertl/php-shellcommand)
[![Latest Stable Version](https://poser.pugx.org/mikehaertl/php-shellcommand/v/stable.svg)](https://packagist.org/packages/mikehaertl/php-shellcommand)
[![Total Downloads](https://poser.pugx.org/mikehaertl/php-shellcommand/downloads)](https://packagist.org/packages/mikehaertl/php-shellcommand)
[![Latest Unstable Version](https://poser.pugx.org/mikehaertl/php-shellcommand/v/unstable.svg)](https://packagist.org/packages/mikehaertl/php-shellcommand)
[![License](https://poser.pugx.org/mikehaertl/php-shellcommand/license.svg)](https://packagist.org/packages/mikehaertl/php-shellcommand)
[![GitHub Tests](https://github.com/mikehaertl/php-shellcommand/workflows/Tests/badge.svg)](https://github.com/mikehaertl/php-shellcommand/actions)
[![Packagist Version](https://img.shields.io/packagist/v/mikehaertl/php-shellcommand?label=version)](https://packagist.org/packages/mikehaertl/php-shellcommand)
[![Packagist Downloads](https://img.shields.io/packagist/dt/mikehaertl/php-shellcommand)](https://packagist.org/packages/mikehaertl/php-shellcommand)
[![GitHub license](https://img.shields.io/github/license/mikehaertl/php-shellcommand)](https://github.com/mikehaertl/php-shellcommand/blob/master/LICENSE)
[![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/mikehaertl/php-shellcommand)](https://packagist.org/packages/mikehaertl/php-shellcommand)

php-shellcommand provides a simple object oriented interface to execute shell commands.

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}
],
"require": {
"php": ">= 5.4.0"
"php": ">= 5.3.0"
},
"require-dev": {
"phpunit/phpunit": ">4.0 <8"
"phpunit/phpunit": ">4.0 <=9.4"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/bootstrap.php"
>
<testsuites>
Expand Down
6 changes: 0 additions & 6 deletions tests/BlockingCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

class BlockingCommandTest extends TestCase
{
public function setUp()
{
// Default in some installations
setlocale(LC_CTYPE, 'C');
}

// Create command from command string
public function testCanPassCommandStringToConstructor()
{
Expand Down
6 changes: 0 additions & 6 deletions tests/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

class CommandTest extends TestCase
{
public function setUp()
{
// Default in some installations
setlocale(LC_CTYPE, 'C');
}

// Create command from command string
public function testCanPassCommandStringToConstructor()
{
Expand Down
22 changes: 17 additions & 5 deletions tests/bootstrap.php
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');