Skip to content

Add check that all proto files are included in build #21

Add check that all proto files are included in build

Add check that all proto files are included in build #21

Workflow file for this run

name: ProtoBuf CI Builds
on:
push:
pull_request:
branches: [ master ]
jobs:
build-proto2-linux64:
name: Build Proto2 Linux 64
runs-on: ubuntu-22.04
steps:
- name: Checkout OSI
uses: actions/checkout@v2
with:
submodules: true
- name: Check Build Setup
run: |
( result=0 ; for f in *.proto ; do grep -wq "$f" CMakeLists.txt || { echo "Missing $f in CMakeLists.txt" && let "result++"; } ; done ; exit $result )
( result=0 ; for f in *.proto ; do grep -q "'$f'" setup.py || { echo "Missing $f in setup.py" && let "result++"; } ; done ; exit $result )
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install Python Dependencies
run: python -m pip install --upgrade pip setuptools wheel pyyaml
- name: Install Doxygen
run: sudo apt-get install doxygen graphviz
- name: Cache Dependencies
id: cache-depends
uses: actions/cache@v3
with:
path: protobuf-3.20.1
key: ${{ runner.os }}-v2-depends
- name: Download ProtoBuf
if: steps.cache-depends.outputs.cache-hit != 'true'
run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.20.1/protobuf-all-3.20.1.tar.gz && tar xzvf protobuf-all-3.20.1.tar.gz
- name: Build ProtoBuf
if: steps.cache-depends.outputs.cache-hit != 'true'
working-directory: protobuf-3.20.1
run: ./configure DIST_LANG=cpp --prefix=/usr && make
- name: Install ProtoBuf
working-directory: protobuf-3.20.1
run: sudo make install && sudo ldconfig
- name: Install proto2cpp
run: git clone --depth 1 https://github.com/OpenSimulationInterface/proto2cpp.git
- name: Prepare C++ Build
run: mkdir build
# Versioning
- name: Get versioning
id: get_version
run: echo ::set-output name=VERSION::$(git describe --always)
- name: Prepare Documentation Build
run: |
sed -i 's/PROJECT_NUMBER\s*= @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@/PROJECT_NUMBER = master (${{ steps.get_version.outputs.VERSION }})/g' doxygen_config.cmake.in
echo "EXCLUDE_PATTERNS = */osi3/* */protobuf-3.20.1/* */proto2cpp/* */flatbuffers/*" >> doxygen_config.cmake.in
echo "GENERATE_TREEVIEW = YES" >> doxygen_config.cmake.in
- name: Configure C++ Build
working-directory: build
run: cmake -D FILTER_PROTO2CPP_PY_PATH=$GITHUB_WORKSPACE/proto2cpp ..
- name: Build C++
working-directory: build
run: cmake --build . --config Release -j 4
- name: Build Python
run: python setup.py build && python setup.py sdist
- name: Install Python
run: python -m pip install .
- name: Run Python Tests
run: python -m unittest discover tests
- name: Archive Documentation
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v2
with:
name: linux64-doc
path: doc/html
if-no-files-found: error
- name: deploy to gh-pages if push to master branch
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/html
build-proto3-linux64:
name: Build Proto3 Linux 64
runs-on: ubuntu-22.04
steps:
- name: Checkout OSI
uses: actions/checkout@v2
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install Python Dependencies
run: python -m pip install --upgrade pip setuptools wheel pyyaml
- name: Cache Dependencies
id: cache-depends
uses: actions/cache@v2
with:
path: protobuf-3.20.1
key: ${{ runner.os }}-v2-depends
- name: Download ProtoBuf
if: steps.cache-depends.outputs.cache-hit != 'true'
run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.20.1/protobuf-all-3.20.1.tar.gz && tar xzvf protobuf-all-3.20.1.tar.gz
- name: Build ProtoBuf
if: steps.cache-depends.outputs.cache-hit != 'true'
working-directory: protobuf-3.20.1
run: ./configure DIST_LANG=cpp --prefix=/usr && make
- name: Install ProtoBuf
working-directory: protobuf-3.20.1
run: sudo make install && sudo ldconfig
- name: Prepare C++ Build
run: mkdir build
- name: Switch to Proto3 Syntax
run: |
bash convert-to-proto3.sh
rm *.pb2
- name: Configure C++ Build
working-directory: build
run: cmake ..
- name: Build C++
working-directory: build
run: cmake --build . --config Release -j 4
- name: Build Python
run: python setup.py build && python setup.py sdist
- name: Install Python
run: python -m pip install .
- name: Run Python Tests
run: python -m unittest discover tests