Skip to content

Commit

Permalink
Merge pull request #71 from adhocore/70-github-action
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore authored Oct 2, 2022
2 parents bed902d + 8198969 commit 9efc076
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 21 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build

on:
push:
pull_request:

defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:

tests:
name: Tests
env:
extensions: pcov

strategy:
matrix:
include:
- php: '8.0'
- php: '8.1'
- php: '8.2'
fail-fast: true

runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
ini-values: date.timezone=Asia/Bangkok,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,zend.assertions=1
php-version: "${{ matrix.php }}"
extensions: "${{ env.extensions }}"
tools: flex

- name: Before run
run: |
echo COLUMNS=120 >> $GITHUB_ENV
for P in src tests; do find $P -type f -name '*.php' -exec php -l {} \;; done
- name: Install dependencies
run: composer install --no-progress --ansi -o

- name: Run tests
run: composer test:cov

- name: Codecov
run: bash <(curl -s https://codecov.io/bash)
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions src/Helper/Shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class Shell
/** @var resource The actual process resource returned from proc_open */
protected $process = null;

/** @var int Process starting time in unix timestamp */
protected int $processStartTime = 0;
/** @var float Process starting time in unix timestamp */
protected float $processStartTime = 0;

/** @var array Status of the process as returned from proc_get_status */
protected ?array $processStatus = null;
Expand Down Expand Up @@ -104,7 +104,7 @@ protected function isWindows(): bool

protected function setInput(): void
{
\fwrite($this->pipes[self::STDIN_DESCRIPTOR_KEY], $this->input);
\fwrite($this->pipes[self::STDIN_DESCRIPTOR_KEY], $this->input ?? '');
}

protected function updateProcessStatus(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Output/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function colorizer(): Color
*/
public function __get(string $name): self
{
if (\strpos($this->method, $name) === false) {
if ($this->method === null || !\str_contains($this->method, $name)) {
$this->method .= $this->method ? \ucfirst($name) : $name;
}

Expand Down

0 comments on commit 9efc076

Please sign in to comment.