Add downstream protobuf asset sync CI (V1: Arduino main + protomq) #184
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Generate new proto wrapper files and upload artifacts | |
| on: [ pull_request ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v1 | |
| with: | |
| version: '3.13.0' | |
| - name: Install Python dependencies | |
| run : | | |
| python -m pip install --upgrade pip | |
| pip3 install scons protobuf grpcio-tools | |
| - name: Self Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| path: protobuf-checkout | |
| submodules: true | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name adafruitio | |
| git config --global user.email adafruitio@adafruit.com | |
| - name: Generate Arduino files from .proto Files | |
| env: | |
| PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python | |
| run: | | |
| mkdir ./arduino_out | |
| mkdir ./doc | |
| echo "Installing protobuf-gen-doc" | |
| go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest | |
| cp ~/go/bin/protoc-gen-doc . | |
| echo "Generating docs..." | |
| protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*/*/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t --plugin=protoc-gen-doc=./protoc-gen-doc --doc_out=./doc --doc_opt=html,index.html | |
| # Local (non-CI) build command: | |
| # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*/*/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t --plugin=protoc-gen-doc=./protoc-gen-doc --doc_out=./doc --doc_opt=html,index.html | |
| cp ./doc/index.html ./arduino_out | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifact-arduino-wrapper | |
| path: ./arduino_out |