Skip to content

Commit

Permalink
使用github action 跑ci
Browse files Browse the repository at this point in the history
  • Loading branch information
hsldymq committed Apr 26, 2022
1 parent 339bf06 commit ec8ba59
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 13 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test

on:
push:
pull_request:

jobs:
UnitTest:
name: Unit Tests

strategy:
matrix:
os: [ubuntu-latest]
php-version: [7.1, 7.2, 7.3, 7.4, 8.0, 8.1]

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

steps:
- uses: actions/checkout@v3

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

- name: Show PHP Info
run: php -v && php -r "foreach (get_loaded_extensions() as \$each) echo \$each.':'.phpversion(\$each).PHP_EOL;"

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install

- name: Run Unit Tests
run: composer run-script test -- --coverage-clover coverage.xml

- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
files: ./coverage.xml
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Bugs Bunny: 弹性的多进程RabbitMQ Consumer
[![Build Status](https://app.travis-ci.com/hsldymq/bugs-bunny.svg?branch=master)](https://app.travis-ci.com/hsldymq/bugs-bunny)
![tests](https://github.com/hsldymq/bugs-bunny/actions/workflows/unit-tests.yml/badge.svg)

### 运行要求
* PHP: ^7.1 || ^8.0
Expand Down
5 changes: 5 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
</testsuite>
</testsuites>

<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
</phpunit>

0 comments on commit ec8ba59

Please sign in to comment.