Repository navigation
Bd/feat/tron trc20 tests #56
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: Check_Protobuf | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the master branch | |
| push: | |
| branches: [master, develop] | |
| pull_request: | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| check_protobuf_files: | |
| name: Check that the protobuffiles for C and Python are up to date | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest | |
| steps: | |
| - name: Clone | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # We use this workaround because the nanopb_generator.py is not compatible with python 3.11 | |
| # We don't want to modify the content of nanopb_generator.py because it comes from an old snapshot of an archived | |
| # repository. Instead we hotpatch it on the fly. There is no impact on the generated C files. | |
| - name: Install python workaround | |
| run: | | |
| # Force usage of python3 | |
| sed -i 's,#!/usr/bin/env python,#!/usr/bin/env python3,g' ledger-nanopb/generator/nanopb_generator.py | |
| # Fix deprecated format | |
| sed -i 's,rU,r,g' ledger-nanopb/generator/nanopb_generator.py | |
| - name: Move tracked files | |
| run: | | |
| mv src/proto/protocol.pb.h src/proto/_protocol.pb.h | |
| mv src/proto/protocol.pb.c src/proto/_protocol.pb.c | |
| mv client/src/ledger_app_clients/exchange/pb/exchange_pb2.py client/src/ledger_app_clients/exchange/pb/_exchange_pb2.py | |
| - name: Build proto files | |
| run: | | |
| make proto | |
| - name: Check that there is no difference beside the date in the C files | |
| shell: bash | |
| run: | | |
| diff <(grep -v "^/\* Generated by nanopb" src/proto/protocol.pb.c) <(grep -v "^/\* Generated by nanopb" src/proto/_protocol.pb.c) | |
| diff <(grep -v "^/\* Generated by nanopb" src/proto/protocol.pb.h) <(grep -v "^/\* Generated by nanopb" src/proto/_protocol.pb.h) | |
| - name: Check that there is no difference in the Python files | |
| run: | | |
| diff client/src/ledger_app_clients/exchange/pb/exchange_pb2.py client/src/ledger_app_clients/exchange/pb/_exchange_pb2.py |