Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Sep 17, 2022
1 parent a04a6f4 commit 2927299
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage_clover: coverage.xml
json_path: coveralls-upload.json
85 changes: 55 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,58 @@
on:
pull_request:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

push:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

name: build
name: phpunit

on: [push, pull_request]

jobs:
phpunit:
uses: yiisoft/actions/.github/workflows/phpunit.yml@master
with:
# coverage: pcov / coverage: xdebug / coverage: xdebug2 / coverage: none
extensions: swoole-5.0.0
# ini-values: date.timezone='UTC'
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1']
#tools: composer:v
name: PHP ${{ matrix.php }}-${{ matrix.os }}

runs-on: ${{ matrix.os }}

strategy:
matrix:
os:
- ubuntu-latest
php:
- 8.0
- 8.1

steps:
- name: Checkout.
uses: actions/checkout@v3

- name: Install PHP.
uses: shivammathur/setup-php@v2
with:
extensions: swoole-5.0.0
php-version: ${{ matrix.php }}

- name: Determine composer cache directory on Linux.
if: matrix.os == 'ubuntu-latest'
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Determine composer cache directory on Windows.
if: matrix.os == 'windows-latest'
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Cache dependencies installed with composer.
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer.
run: composer self-update

- name: Install dependencies with composer.
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run tests with phpunit.
run: vendor/bin/phpunit --colors=always

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls -v
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ composer.lock

# PHPUnit
.phpunit.result.cache
coverage.xml
coveralls-upload.json
19 changes: 0 additions & 19 deletions .scrutinizer.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
[![Latest Stable Version](https://poser.pugx.org/razonyang/psr7-swoole/v/stable.png)](https://packagist.org/packages/razonyang/psr7-swoole)
[![Total Downloads](https://poser.pugx.org/razonyang/psr7-swoole/downloads.png)](https://packagist.org/packages/razonyang/psr7-swoole)
[![Build Status](https://github.com/razonyang/psr7-swoole/workflows/build/badge.svg)](https://github.com/razonyang/psr7-swoole/actions)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/razonyang/psr7-swoole/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/razonyang/psr7-swoole/?branch=main)
[![Code Coverage](https://scrutinizer-ci.com/g/razonyang/psr7-swoole/badges/coverage.png?b=main)](https://scrutinizer-ci.com/g/razonyang/psr7-swoole/?branch=main)
[![Coverage Status](https://coveralls.io/repos/github/razonyang/psr7-swoole/badge.svg?branch=main)](https://coveralls.io/github/razonyang/psr7-swoole?branch=main)

The PSR7 helpers for Swoole.

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"prefer-stable": true,
"require": {
"php": "^8.0",
"ext-swoole": "^4.0|^5.0",
"ext-swoole": "^4.8|^5.0",
"psr/http-message": "^1.0",
"nyholm/psr7": "^1.5"
},
Expand All @@ -34,6 +34,7 @@
},
"scripts": {
"lint": "php-cs-fixer fix --config .php-cs-fixer.php src tests",
"psalm": "psalm",
"test": "phpunit"
}
}
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
<include>
<directory>./src</directory>
</include>
<report>
<clover outputFile="coverage.xml"/>
</report>
</coverage>
</phpunit>

0 comments on commit 2927299

Please sign in to comment.