Skip to content

Commit

Permalink
Merge pull request #133 from pollen-robotics/132-automatically-genera…
Browse files Browse the repository at this point in the history
…te-c-code

132 automatically generate c code
  • Loading branch information
FabienDanieau authored Aug 12, 2024
2 parents 9cc9ff1 + 7bb0f4d commit 3ced89d
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

name: Generate Protobuf Python Code
name: Generate Code

on: [push]

jobs:
build:
generate-python:
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand All @@ -32,3 +32,30 @@ jobs:
git add .
git commit -m "Generated Protobuf Python Code" || echo "No changes to commit"
git push
generate-csharp:
runs-on: windows-2022
needs: generate-python

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
with:
vs-version: '[17.10,17.11)'

- name: Restore NuGet packages
run: nuget restore 'csharp/reachy_sdk/reachy_sdk.sln'

- name: Build solution
run: msbuild 'csharp\reachy_sdk\reachy_sdk.sln' /p:Configuration=Release

- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Generated Protobuf C# Code" || echo "No changes to commit"
git push
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

## Generate gRPC code

### For Python:
Code for Python and C# is generated automatically by the CI. You just need to `git pull` to get the generated code after any pushed changes to the .proto. If you still need to generate these files locally, you can do the following commands

Python code is generated automatically for each commit. Just just need to `git pull` after you push changes to the .proto.
### For Python:

If you need to generate those files locally, just install `pip install mypy-protobuf` to generate the mypy stubs, and run:
Just install `pip install mypy-protobuf` to generate the mypy stubs, and run:

```python
python -m grpc_tools.protoc -I./protos --python_out=./python/reachy2_sdk_api --grpc_python_out=./python/reachy2_sdk_api --mypy_out=./python/reachy2_sdk_api --mypy_grpc_out=./python/reachy2_sdk_api ./protos/*.proto
```

### For C#

On a Windows computer, open `reachy_sdk.sln`` in Visual Studio.
`Click Build > Build Solution`
Open `reachy_sdk.sln` in Visual Studio, and `Click Build > Build Solution`
87 changes: 43 additions & 44 deletions csharp/Reachy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,51 +27,50 @@ static ReachyReflection() {
"CgxyZWFjaHkucHJvdG8SBnJlYWNoeRobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5",
"LnByb3RvGh9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvGglhcm0u",
"cHJvdG8aCmhlYWQucHJvdG8aCmhhbmQucHJvdG8aGW1vYmlsZV9iYXNlX3V0",
"aWxpdHkucHJvdG8aC3NvdW5kLnByb3RvGgt2aWRlby5wcm90byKaAwoGUmVh",
"Y2h5EhwKAmlkGAEgASgLMhAucmVhY2h5LlJlYWNoeUlkEiMKBWxfYXJtGAIg",
"ASgLMhQucmVhY2h5LnBhcnQuYXJtLkFybRIjCgVyX2FybRgDIAEoCzIULnJl",
"YWNoeS5wYXJ0LmFybS5Bcm0SJAoEaGVhZBgEIAEoCzIWLnJlYWNoeS5wYXJ0",
"LmhlYWQuSGVhZBImCgZsX2hhbmQYBSABKAsyFi5yZWFjaHkucGFydC5oYW5k",
"LkhhbmQSJgoGcl9oYW5kGAYgASgLMhYucmVhY2h5LnBhcnQuaGFuZC5IYW5k",
"EjQKC21vYmlsZV9iYXNlGAcgASgLMh8ubW9iaWxlLmJhc2UudXRpbGl0eS5N",
"b2JpbGVCYXNlEi8KCm1pY3JvcGhvbmUYCCABKAsyGy5jb21wb25lbnQuc291",
"bmQuTWljcm9waG9uZRIpCgdzcGVha2VyGAkgASgLMhguY29tcG9uZW50LnNv",
"dW5kLlNwZWFrZXISIAoEaW5mbxgUIAEoCzISLnJlYWNoeS5SZWFjaHlJbmZv",
"IiQKCFJlYWNoeU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1ZW5jeRgCIAEoAjLFAgoNUmVhY2h5U2VydmljZRIzCglHZXRS",
"ZWFjaHkSFi5nb29nbGUucHJvdG9idWYuRW1wdHkaDi5yZWFjaHkuUmVhY2h5",
"EjcKDkdldFJlYWNoeVN0YXRlEhAucmVhY2h5LlJlYWNoeUlkGhMucmVhY2h5",
"LlJlYWNoeVN0YXRlEkwKEVN0cmVhbVJlYWNoeVN0YXRlEiAucmVhY2h5LlJl",
"YWNoeVN0cmVhbVN0YXRlUmVxdWVzdBoTLnJlYWNoeS5SZWFjaHlTdGF0ZTAB",
"Ei8KBUF1ZGl0EhAucmVhY2h5LlJlYWNoeUlkGhQucmVhY2h5LlJlYWNoeVN0",
"YXR1cxJHCgtTdHJlYW1BdWRpdBIgLnJlYWNoeS5SZWFjaHlTdHJlYW1BdWRp",
"dFJlcXVlc3QaFC5yZWFjaHkuUmVhY2h5U3RhdHVzMAFiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Reachy.Part.Arm.ArmReflection.Descriptor, global::Reachy.Part.Head.HeadReflection.Descriptor, global::Reachy.Part.Hand.HandReflection.Descriptor, global::Mobile.Base.Utility.MobileBaseUtilityReflection.Descriptor, global::Component.Sound.SoundReflection.Descriptor, global::Component.Video.VideoReflection.Descriptor, },
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Reachy.Part.Arm.ArmReflection.Descriptor, global::Reachy.Part.Head.HeadReflection.Descriptor, global::Reachy.Part.Hand.HandReflection.Descriptor, global::Mobile.Base.Utility.MobileBaseUtilityReflection.Descriptor, global::Component.Sound.SoundReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Reachy.Reachy), global::Reachy.Reachy.Parser, new[]{ "Id", "LArm", "RArm", "Head", "LHand", "RHand", "MobileBase", "Microphone", "Speaker", "Info" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Reachy.ReachyId), global::Reachy.ReachyId.Parser, new[]{ "Id", "Name" }, null, null, null, null),
Expand Down

0 comments on commit 3ced89d

Please sign in to comment.