Skip to content

Commit a7fafa9

Browse files
committed
chore: Pre-generate protobuf library
1 parent a615c10 commit a7fafa9

File tree

20 files changed

+997
-9
lines changed

20 files changed

+997
-9
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,11 @@ jobs:
5555

5656
- name: Setup PHP
5757
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2
58-
id: php
5958
with:
6059
extensions: sockets, curl, zip, ffi, grpc
6160
php-version: ${{ matrix.php }}
6261
coverage: none
63-
tools: protoc, grpc_php_plugin
6462
env:
65-
fail-fast: true
6663
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6764

6865
- name: Composer install
@@ -80,7 +77,6 @@ jobs:
8077
run: composer run-examples
8178
env:
8279
PACT_DO_NOT_TRACK: true
83-
GRPC_PHP_PLUGIN_PATH: ${{ steps.php.outputs.grpc_php_plugin_path }}
8480

8581
unit:
8682
runs-on: ubuntu-latest
@@ -143,4 +139,4 @@ jobs:
143139
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
144140
name: Checkout repository
145141
- name: run musl # If shared-mime-info not installed - Expected binary contents to have content type 'image/jpeg' but detected contents was 'application/octet-stream'
146-
run: docker run --env PACT_DO_NOT_TRACK=true --env GRPC_PHP_PLUGIN_PATH=/usr/bin/grpc_php_plugin --rm -v $PWD:/home alpine:3.19 /bin/sh -c 'apk add --no-cache shared-mime-info php82-dev php82-ffi php82-pecl-grpc php82-sockets php82-tokenizer php82-dom php82-xml php82-xmlwriter php82-simplexml composer protoc grpc && cd /home && composer install && composer test && composer run-examples'
142+
run: docker run --env PACT_DO_NOT_TRACK=true --rm -v $PWD:/home alpine:3.19 /bin/sh -c 'apk add --no-cache shared-mime-info php82-dev php82-ffi php82-pecl-grpc php82-sockets php82-tokenizer php82-dom php82-xml php82-xmlwriter php82-simplexml composer protobuf-dev && cd /home && composer install && composer test && composer run-examples'

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
"test-coverage": "phpunit",
6868
"check-compatibility": "behat",
6969
"refactor": "rector",
70+
"generate-protobuf": [
71+
"protoc --php_out=example/protobuf-async-message/library/src example/protobuf-async-message/library/proto/say_hello.proto",
72+
"protoc --php_out=example/protobuf-sync-message/library/src --grpc_out=generate_server:example/protobuf-sync-message/library/src --plugin=protoc-gen-grpc=$(which grpc_php_plugin) example/protobuf-sync-message/library/proto/area_calculator.proto"
73+
],
7074
"run-examples": [
7175
"composer run-example:binary",
7276
"composer run-example:csv",
@@ -119,13 +123,11 @@
119123
],
120124
"run-example:protobuf-async-message": [
121125
"rm -f example/protobuf-async-message/pacts/protobufAsyncMessageConsumer-protobufAsyncMessageProvider.json",
122-
"protoc --php_out=example/protobuf-async-message/library/src example/protobuf-async-message/library/proto/say_hello.proto",
123126
"cd example/protobuf-async-message/consumer && phpunit",
124127
"cd example/protobuf-async-message/provider && phpunit"
125128
],
126129
"run-example:protobuf-sync-message": [
127130
"rm -f example/protobuf-sync-message/pacts/protobufSyncMessageConsumer-protobufSyncMessageProvider.json",
128-
"protoc --php_out=example/protobuf-sync-message/library/src --grpc_out=generate_server:example/protobuf-sync-message/library/src --plugin=protoc-gen-grpc=$GRPC_PHP_PLUGIN_PATH example/protobuf-sync-message/library/proto/area_calculator.proto",
129131
"cd example/protobuf-sync-message/consumer && phpunit",
130132
"cd example/protobuf-sync-message/provider && phpunit"
131133
],

example/protobuf-async-message/library/src/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/protobuf-async-message/library/src/GPBMetadata/Example/ProtobufAsyncMessage/Library/Proto/SayHello.php

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/protobuf-async-message/library/src/Library/Name.php

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/protobuf-async-message/library/src/Library/Person.php

Lines changed: 95 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/protobuf-sync-message/library/src/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/protobuf-sync-message/library/src/GPBMetadata/Example/Library/Proto/AreaCalculator.php

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/protobuf-sync-message/library/src/GPBMetadata/Example/SyncMessage/Library/Proto/AreaCalculator.php

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/protobuf-sync-message/library/src/Plugins/AreaResponse.php

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)