Skip to content

Commit

Permalink
add php action (#78)
Browse files Browse the repository at this point in the history
* add php action

* add php action

* add php action

* add php action

* add php action

* add php action

* add php action

* add php action

* add php action

* add php action

* add php action

* add php action
  • Loading branch information
zhangchunsheng committed Aug 5, 2020
1 parent 29fb85c commit 4824c94
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# For more information see: https://docs.github.com/en/actions/getting-started-with-github-actions
# For more setup-php see: https://github.com/shivammathur/setup-php
# For more setup-php protoc see: https://github.com/shivammathur/setup-php/issues/262

name: PHP

on: [push, pull_request]

jobs:
run:
name: Run
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-20.04]
php-versions: ['7.4']
env:
extensions: xml, opcache, xdebug, pcov, grpc-1.30.0, protobuf-3.12.2
key: cache-v3

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP with extensions and custom config
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Shanghai
tools: protoc, grpc_php_plugin
- name: Testing PHP version
run: |
php -v
php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}"
- name: Test grpc_php_plugin and protoc
run: |
protoc --version
cd php
make generate
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# GRPC [![NPM](https://github.com/Chatie/grpc/workflows/NPM/badge.svg)](https://github.com/Chatie/grpc/actions?query=workflow%3ANPM) [![PyPI](https://github.com/Chatie/grpc/workflows/PyPI/badge.svg)](https://github.com/Chatie/grpc/actions?query=workflow%3APyPI) [![Go](https://github.com/chatie/grpc/workflows/Go/badge.svg)](https://github.com/chatie/grpc/actions?query=workflow%3AGo) [![Maven](https://github.com/Chatie/grpc/workflows/Maven/badge.svg)](https://github.com/Chatie/grpc/actions?query=workflow%3A%22Maven%22) [![Node.js](https://github.com/Chatie/grpc/workflows/Node.js/badge.svg)](https://github.com/Chatie/grpc/actions?query=workflow%3ANode.js)
# GRPC [![NPM](https://github.com/Chatie/grpc/workflows/NPM/badge.svg)](https://github.com/Chatie/grpc/actions?query=workflow%3ANPM) [![PyPI](https://github.com/Chatie/grpc/workflows/PyPI/badge.svg)](https://github.com/Chatie/grpc/actions?query=workflow%3APyPI) [![Go](https://github.com/chatie/grpc/workflows/Go/badge.svg)](https://github.com/chatie/grpc/actions?query=workflow%3AGo) [![Maven](https://github.com/Chatie/grpc/workflows/Maven/badge.svg)](https://github.com/Chatie/grpc/actions?query=workflow%3A%22Maven%22) [![Node.js](https://github.com/Chatie/grpc/workflows/Node.js/badge.svg)](https://github.com/Chatie/grpc/actions?query=workflow%3ANode.js) [![PHP](https://github.com/Chatie/grpc/workflows/PHP/badge.svg)](https://github.com/Chatie/grpc/actions?query=workflow%3APHP)

![chatie grpc](https://chatie.io/grpc/images/grpc.png)

Expand All @@ -8,6 +8,7 @@
[![Python 3.7](https://img.shields.io/badge/python-3.7+-blue.svg?label=Python)](https://www.python.org/downloads/release/python-370/)
![Go Version](https://img.shields.io/github/go-mod/go-version/wechaty/go-wechaty)
[![Java Version](https://img.shields.io/maven-central/v/io.github.wechaty/grpc?label=Java)](https://mvnrepository.com/artifact/io.github.wechaty/grpc)
[![PHP Version](https://img.shields.io/packagist/v/wechaty/php-grpc)](https://packagist.org/packages/wechaty/php-grpc)

gRPC for Chatie

Expand Down
6 changes: 4 additions & 2 deletions php/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ PROTO_BASE_DIR=../proto
PROTO_PUPPET_DIR=$PROTO_BASE_DIR/wechaty/puppet
PROTO_WECHATY_DIR=$PROTO_BASE_DIR/wechaty

# /usr/local/include

OUT_WECHATY_DIR=./generated/wechaty
OUT_PUPPET_DIR=$OUT_WECHATY_DIR

Expand All @@ -19,13 +21,13 @@ protoc \
-I $PROTO_PUPPET_DIR \
--php_out=$OUT_PUPPET_DIR \
--grpc_out=$OUT_PUPPET_DIR \
--plugin=protoc-gen-grpc=../../grpc-demo/grpc/bins/opt/grpc_php_plugin \
--plugin=protoc-gen-grpc=/usr/local/bin/grpc_php_plugin \
$PROTO_PUPPET_DIR/*.proto

protoc \
-I $PROTO_WECHATY_DIR \
-I $PROTO_PUPPET_DIR \
--php_out=$OUT_WECHATY_DIR \
--grpc_out=$OUT_WECHATY_DIR \
--plugin=protoc-gen-grpc=../../grpc-demo/grpc/bins/opt/grpc_php_plugin \
--plugin=protoc-gen-grpc=/usr/local/bin/grpc_php_plugin \
$PROTO_WECHATY_DIR/*.proto

0 comments on commit 4824c94

Please sign in to comment.