protobuf #8
This file contains 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: protobuf | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
protobuf: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
# install protoc compiler | |
miniconda create -y -n protobuf | |
miniconda activate protobuf | |
miniconda install -y protobuf | |
# install bufbuild | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
brew install bufbuild/buf/buf | |
buf --help | |
- name: Lint | |
run: | | |
# lint .proto files | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
cd proto | |
buf lint | |
- name: Build | |
run: | | |
# generate .py and .pyi files from the .proto files | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
miniconda activate protobuf | |
cd proto | |
buf generate | |
- name: Configure git | |
uses: cylc/release-actions/configure-git@v1 | |
- name: Commit & Push | |
run: | | |
if [[ -z $(git diff --stat -- "$INIT_FILE") ]]; then | |
echo "::error:: No changes to ${INIT_FILE} occurred" | |
exit 0 | |
else | |
echo "::info:: pushing update commit" | |
git commit -am 'protobuf: updating generated files' | |
git push | |
exit 0 | |
fi | |