|
| 1 | +name: ProtoBuf CI Builds |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + branches: [ master ] |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-proto2-linux64: |
| 10 | + name: Build Proto2 Linux 64 |
| 11 | + |
| 12 | + runs-on: ubuntu-18.04 |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout OSI |
| 16 | + uses: actions/checkout@v2 |
| 17 | + with: |
| 18 | + submodules: true |
| 19 | + |
| 20 | + - name: Setup Python |
| 21 | + uses: actions/setup-python@v2 |
| 22 | + with: |
| 23 | + python-version: '3.7' |
| 24 | + |
| 25 | + - name: Install Python Dependencies |
| 26 | + run: python -m pip install --upgrade pip setuptools wheel pyyaml |
| 27 | + |
| 28 | + - name: Install Doxygen |
| 29 | + run: sudo apt-get install doxygen graphviz |
| 30 | + |
| 31 | + - name: Cache Dependencies |
| 32 | + id: cache-depends |
| 33 | + uses: actions/cache@v2 |
| 34 | + with: |
| 35 | + path: protobuf-3.15.8 |
| 36 | + key: ${{ runner.os }}-v1-depends |
| 37 | + |
| 38 | + - name: Download ProtoBuf |
| 39 | + if: steps.cache-depends.outputs.cache-hit != 'true' |
| 40 | + run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protobuf-all-3.15.8.tar.gz && tar xzvf protobuf-all-3.15.8.tar.gz |
| 41 | + |
| 42 | + - name: Build ProtoBuf |
| 43 | + if: steps.cache-depends.outputs.cache-hit != 'true' |
| 44 | + working-directory: protobuf-3.15.8 |
| 45 | + run: ./configure DIST_LANG=cpp --prefix=/usr && make |
| 46 | + |
| 47 | + - name: Install ProtoBuf |
| 48 | + working-directory: protobuf-3.15.8 |
| 49 | + run: sudo make install && sudo ldconfig |
| 50 | + |
| 51 | + - name: Install proto2cpp |
| 52 | + run: git clone --depth 1 https://github.com/OpenSimulationInterface/proto2cpp.git |
| 53 | + |
| 54 | + - name: Prepare C++ Build |
| 55 | + run: mkdir build |
| 56 | + |
| 57 | + - name: Prepare Documentation Bukd |
| 58 | + run: | |
| 59 | + sed -i 's/@VERSION_PATCH@/@VERSION_PATCH@_GitHub_MasterBranch/g' doxygen_config.cmake.in |
| 60 | + echo "EXCLUDE_PATTERNS = */osi3/* */protobuf-3.15.8/* */proto2cpp/*" >> doxygen_config.cmake.in |
| 61 | + echo "GENERATE_TREEVIEW = YES" >> doxygen_config.cmake.in |
| 62 | +
|
| 63 | + - name: Configure C++ Build |
| 64 | + working-directory: build |
| 65 | + run: cmake -D FILTER_PROTO2CPP_PY_PATH=$GITHUB_WORKSPACE/proto2cpp .. |
| 66 | + |
| 67 | + - name: Build C++ |
| 68 | + working-directory: build |
| 69 | + run: cmake --build . --config Release -j 4 |
| 70 | + |
| 71 | + - name: Build Python |
| 72 | + run: python setup.py build && python setup.py sdist |
| 73 | + |
| 74 | + - name: Install Python |
| 75 | + run: python -m pip install . |
| 76 | + |
| 77 | + - name: Run Python Tests |
| 78 | + run: python -m unittest discover tests |
| 79 | + |
| 80 | + - name: Archive Documentation |
| 81 | + if: ${{ github.event_name == 'pull_request' }} |
| 82 | + uses: actions/upload-artifact@v2 |
| 83 | + with: |
| 84 | + name: linux64-doc |
| 85 | + path: doc/html |
| 86 | + if-no-files-found: error |
| 87 | + |
| 88 | + - name: deploy to gh-pages if push to master branch |
| 89 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 90 | + uses: peaceiris/actions-gh-pages@v3 |
| 91 | + with: |
| 92 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + publish_dir: ./doc/html |
| 94 | + |
| 95 | + build-proto3-linux64: |
| 96 | + name: Build Proto3 Linux 64 |
| 97 | + |
| 98 | + runs-on: ubuntu-18.04 |
| 99 | + |
| 100 | + steps: |
| 101 | + - name: Checkout OSI |
| 102 | + uses: actions/checkout@v2 |
| 103 | + with: |
| 104 | + submodules: true |
| 105 | + |
| 106 | + - name: Setup Python |
| 107 | + uses: actions/setup-python@v2 |
| 108 | + with: |
| 109 | + python-version: '3.7' |
| 110 | + |
| 111 | + - name: Install Python Dependencies |
| 112 | + run: python -m pip install --upgrade pip setuptools wheel pyyaml |
| 113 | + |
| 114 | + - name: Cache Dependencies |
| 115 | + id: cache-depends |
| 116 | + uses: actions/cache@v2 |
| 117 | + with: |
| 118 | + path: protobuf-3.15.8 |
| 119 | + key: ${{ runner.os }}-v1-depends |
| 120 | + |
| 121 | + - name: Download ProtoBuf |
| 122 | + if: steps.cache-depends.outputs.cache-hit != 'true' |
| 123 | + run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protobuf-all-3.15.8.tar.gz && tar xzvf protobuf-all-3.15.8.tar.gz |
| 124 | + |
| 125 | + - name: Build ProtoBuf |
| 126 | + if: steps.cache-depends.outputs.cache-hit != 'true' |
| 127 | + working-directory: protobuf-3.15.8 |
| 128 | + run: ./configure DIST_LANG=cpp --prefix=/usr && make |
| 129 | + |
| 130 | + - name: Install ProtoBuf |
| 131 | + working-directory: protobuf-3.15.8 |
| 132 | + run: sudo make install && sudo ldconfig |
| 133 | + |
| 134 | + - name: Prepare C++ Build |
| 135 | + run: mkdir build |
| 136 | + |
| 137 | + - name: Switch to Proto3 Syntax |
| 138 | + run: | |
| 139 | + bash convert-to-proto3.sh |
| 140 | + rm *.pb2 |
| 141 | +
|
| 142 | + - name: Configure C++ Build |
| 143 | + working-directory: build |
| 144 | + run: cmake .. |
| 145 | + |
| 146 | + - name: Build C++ |
| 147 | + working-directory: build |
| 148 | + run: cmake --build . --config Release -j 4 |
| 149 | + |
| 150 | + - name: Build Python |
| 151 | + run: python setup.py build && python setup.py sdist |
| 152 | + |
| 153 | + - name: Install Python |
| 154 | + run: python -m pip install . |
| 155 | + |
| 156 | + - name: Run Python Tests |
| 157 | + run: python -m unittest discover tests |
0 commit comments