Skip to content

Commit

Permalink
unittest and workflow actions (#45)
Browse files Browse the repository at this point in the history
update workflow
update README
  • Loading branch information
cocowh authored Feb 24, 2022
1 parent e8ad234 commit 322aca6
Show file tree
Hide file tree
Showing 75 changed files with 592 additions and 4,294 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: PHPUnit for motan-php
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
jobs:
testing:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: [7.2, 7.3, 7.4]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install php
uses: shivammathur/setup-php@v2
env:
runner: self-hosted
with:
php-version: ${{ matrix.php-versions }}

- name: Install dependencies
run: composer install --ignore-platform-reqs

- name: Run tests
run: composer test

codecov:
runs-on: ubuntu-latest
steps:
- name: Set php
uses: shivammathur/setup-php@v2
env:
runner: self-hosted
with:
php-version: 7.4
coverage: pcov

- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: composer install --ignore-platform-reqs

- name: Generate coverage report
run: composer test-coverage

- name: Uplaod coverage report
uses: codecov/[email protected]
with:
token: "fe6d871b-9785-470b-9c3d-eb1669fcb2ef"
file: ./tests/coverage/clover.xml
flags: unittests
name: codecov-umbrella
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ core.*
pretty/zj
tests/coverage/
zjtest_*
.phpunit.result.cache

# weibo-mesh
./agent_runtime
Expand All @@ -34,4 +35,5 @@ weibo-mesh-runpath/*
agent.pid

# debugger
.gdb*
.gdb*
/tests/MockServer/log.txt
48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Motan-PHP
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/weibocom/motan/blob/master/LICENSE)
[![https://travis-ci.org/weibocom/motan-php.svg?branch=master](https://travis-ci.org/weibocom/motan-php.svg?branch=master)](https://travis-ci.org/weibocom/motan-php)
[![codecov](https://codecov.io/gh/weibocom/motan-php/branch/master/graph/badge.svg)](https://codecov.io/gh/weibocom/motan-php)
[![PHPUnit for motan-php](https://github.com/weibocom/motan-php/workflows/PHPUnit%20for%20motan-php/badge.svg)](https://github.com/weibocom/motan-php/actions)

# Overview
[Motan][motan] is a cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services.
Expand Down Expand Up @@ -83,18 +84,45 @@ try{
}
```

# Unit Test

If you use the local php environment to run unit tests, please make sure that your php version is between 7.2 and 7.4, supports functions such as pcntl_fork, posix_kill, pcntl_signal, etc., and downloaded the composer component.
You can run unit tests by following the instructions below。
```shell
git clone https://github.com/weibocom/motan-php.git
cd motan-php
git checkout $(test branch)
composer install
composer test # just run phpunit
composer test-coverage # run phpunit and generate report
```

If you do not want to install a php-related environment, it is recommended that you use docker to avoid problems with inconsistent environments.
You can follow the instructions below.
```shell
git clone https://github.com/weibocom/motan-php.git
cd motan-php
git checkout $(test branch)
docker run --rm -it -v $PWD:/mnt --entrypoint="" snail007/php:7.4 bash
cd /mnt
composer install
composer test # just run phpunit
composer test-coverage # run phpunit and generate report
```

# Contributors

* 周晶([@idevz](https://github.com/idevz))
* 罗明刚([@lion2luo](https://github.com/lion2luo))
* 郭万韬
* 丁振凯
* 李枨煊([@flyhope](https://github.com/flyhope))
* 吴桦([@cocowh](https://github.com/cocowh))

# License

Motan is released under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).

[motan]:https://github.com/weibocom/motan
[testhelper]:https://github.com/weibo-mesh/testhelpers
[phpts]:https://github.com/weibocom/motan-php/tree/master/phpts/Motan_MClient

Welcome to submit issue and contribute code!
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
"weibo-protoc-gen-php.php"
],
"require-dev": {
"phpunit/phpunit": "5.7"
"phpunit/phpunit": "^8.0"
},
"require": {
"wei-breeze/breeze": "v0.1.0"
},
"scripts": {
"test": "phpunit --testdox tests",
"test-coverage": "phpunit --testdox tests --coverage-html tests/coverage --coverage-clover tests/coverage/clover.xml"
}
}
32 changes: 0 additions & 32 deletions phpts/Motan_Client/__call_basic.phpt

This file was deleted.

29 changes: 0 additions & 29 deletions phpts/Motan_Client/doCall_basic.phpt

This file was deleted.

33 changes: 0 additions & 33 deletions phpts/Motan_Client/doCall_cacheService_basic.phpt

This file was deleted.

28 changes: 0 additions & 28 deletions phpts/Motan_Client/doCall_multi_args_basic.phpt

This file was deleted.

31 changes: 0 additions & 31 deletions phpts/Motan_Client/getEndPoint_basic.phpt

This file was deleted.

30 changes: 0 additions & 30 deletions phpts/Motan_Client/getResponseException_basic.phpt

This file was deleted.

Loading

0 comments on commit 322aca6

Please sign in to comment.