protobuf #14
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 Protobuf | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: protobuf | |
create-args: protobuf | |
init-shell: bash | |
- name: Install Bufbuild | |
run: | | |
# NOTE: bufbuild does exist on conda-forge but hasn't been updated for a while | |
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 | |
shell: bash | |
run: | | |
# generate .py and .pyi files from the .proto files | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
. ~/.bash_profile | |
micromamba 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 | |