11name : ProtoBuf CI Builds
22
3- env :
4- PROTOBUF_VERSION : 3.20.1
5- PROTOBUF_VARIANT : ' -all' # Use '-all' prior to 22.0, '' after
6- ABSEIL_VERSION : 20230802.1
7-
83on :
94 push :
105 pull_request :
2116 with :
2217 config_path : .github/.pyspelling.yml
2318
24- build-proto2-linux64 :
25- name : Build Proto2 Linux 64
19+ run-tests :
20+ name : Run tests and build docs
2621
2722 runs-on : ubuntu-22.04
2823
3227 with :
3328 submodules : true
3429
35- - name : Check Build Setup
36- run : |
37- ( result=0 ; for f in *.proto ; do grep -wq "$f" CMakeLists.txt || { echo "Missing $f in CMakeLists.txt" && let "result++"; } ; done ; exit $result )
38- ( result=0 ; for f in *.proto ; do grep -q '"'$f'"' setup.py || { echo "Missing $f in setup.py" && let "result++"; } ; done ; exit $result )
39-
4030 - name : Setup Python
4131 uses : actions/setup-python@v5
4232 with :
@@ -45,49 +35,15 @@ jobs:
4535 - name : Install Python Dependencies
4636 run : |
4737 python -m pip install --upgrade pip
48- python -m pip install build
4938 python -m pip install -r requirements_tests.txt
5039
51- - name : Check black format
52- run : |
53- black --check --diff .
54-
5540 - name : Install Doxygen
5641 run : sudo apt-get install doxygen graphviz
5742
58- - name : Cache Dependencies
59- id : cache-depends
60- uses : actions/cache@v4
61- with :
62- path : protobuf-${{ env.PROTOBUF_VERSION }}
63- key : ${{ runner.os }}-v2-depends
64-
65- - name : Download ProtoBuf ${{ env.PROTOBUF_VERSION }}
66- if : steps.cache-depends.outputs.cache-hit != 'true'
67- run : curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${{env.PROTOBUF_VERSION}}/protobuf${{env.PROTOBUF_VARIANT}}-${{env.PROTOBUF_VERSION}}.tar.gz && tar xzvf protobuf${{env.PROTOBUF_VARIANT}}-${{env.PROTOBUF_VERSION}}.tar.gz
68-
69- - name : Download Abseil ${{ env.ABSEIL_VERSION }}
70- if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
71- run : curl -OL https://github.com/abseil/abseil-cpp/archive/refs/tags/${{env.ABSEIL_VERSION}}.tar.gz && tar xzvf ${{env.ABSEIL_VERSION}}.tar.gz && rm -rf protobuf-${{env.PROTOBUF_VERSION}}/third_party/abseil-cpp && mv abseil-cpp-${{env.ABSEIL_VERSION}} protobuf-${{env.PROTOBUF_VERSION}}/third_party/abseil-cpp
72-
73- - name : Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via autotools
74- if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == '-all'
75- working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
76- run : ./configure DIST_LANG=cpp --prefix=/usr && make
77-
78- - name : Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via cmake
79- if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
80- working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
81- run : cmake -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_TESTS=OFF . && cmake --build . --config Release -j 4
82-
83- - name : Install ProtoBuf ${{ env.PROTOBUF_VERSION }}
84- working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
85- run : sudo make install && sudo ldconfig
86-
8743 - name : Install proto2cpp
8844 run : git clone --depth 1 https://github.com/OpenSimulationInterface/proto2cpp.git
8945
90- - name : Prepare C++ Build
46+ - name : Prepare Build
9147 run : mkdir build
9248
9349 - name : Add Development Version Suffix
@@ -105,136 +61,19 @@ jobs:
10561 echo "EXCLUDE_PATTERNS = */osi3/* */protobuf-*/* */proto2cpp/* */flatbuffers/*" >> doxygen_config.cmake.in
10662 echo "GENERATE_TREEVIEW = YES" >> doxygen_config.cmake.in
10763
108- - name : Configure C++ Build
64+ - name : Configure Build
10965 working-directory : build
110- run : cmake -D FILTER_PROTO2CPP_PY_PATH=$GITHUB_WORKSPACE/proto2cpp ${{ env.PROTOBUF_VARIANT =='' && '-DCMAKE_CXX_STANDARD=17' }} ..
66+ run : cmake -D FILTER_PROTO2CPP_PY_PATH=$GITHUB_WORKSPACE/proto2cpp ..
11167
112- - name : Build C++
68+ - name : Build
11369 working-directory : build
11470 run : cmake --build . --config Release -j 4
11571
116- - name : Build Python
117- run : python -m build
118-
119- - name : Install Python
120- run : python -m pip install .
121-
12272 - name : Run Python Tests
12373 run : python -m unittest discover tests
12474
125- - name : Upload Python Distribution
126- if : ${{ github.event_name == 'pull_request' || ( github.event_name == 'push' && ( github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') ) ) }}
75+ - name : Upload documentation
12776 uses : actions/upload-artifact@v4
12877 with :
129- name : python-dist
130- path : dist/
131-
132- build-proto3-linux64 :
133- name : Build Proto3 Linux 64
134-
135- runs-on : ubuntu-22.04
136-
137- steps :
138- - name : Checkout OSI
139- uses : actions/checkout@v4
140- with :
141- submodules : true
142-
143- - name : Setup Python
144- uses : actions/setup-python@v5
145- with :
146- python-version : ' 3.8'
147-
148- - name : Install Python Dependencies
149- run : |
150- python -m pip install --upgrade pip
151- python -m pip install build
152- python -m pip install -r requirements_tests.txt
153-
154- - name : Cache Dependencies
155- id : cache-depends
156- uses : actions/cache@v4
157- with :
158- path : protobuf-${{ env.PROTOBUF_VERSION }}
159- key : ${{ runner.os }}-v2-depends
160-
161- - name : Download ProtoBuf ${{ env.PROTOBUF_VERSION }}
162- if : steps.cache-depends.outputs.cache-hit != 'true'
163- run : curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${{env.PROTOBUF_VERSION}}/protobuf${{env.PROTOBUF_VARIANT}}-${{env.PROTOBUF_VERSION}}.tar.gz && tar xzvf protobuf${{env.PROTOBUF_VARIANT}}-${{env.PROTOBUF_VERSION}}.tar.gz
164-
165- - name : Download Abseil ${{ env.ABSEIL_VERSION }}
166- if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
167- run : curl -OL https://github.com/abseil/abseil-cpp/archive/refs/tags/${{env.ABSEIL_VERSION}}.tar.gz && tar xzvf ${{env.ABSEIL_VERSION}}.tar.gz && rm -rf protobuf-${{env.PROTOBUF_VERSION}}/third_party/abseil-cpp && mv abseil-cpp-${{env.ABSEIL_VERSION}} protobuf-${{env.PROTOBUF_VERSION}}/third_party/abseil-cpp
168-
169- - name : Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via autotools
170- if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == '-all'
171- working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
172- run : ./configure DIST_LANG=cpp --prefix=/usr && make
173-
174- - name : Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via cmake
175- if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
176- working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
177- run : cmake -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_TESTS=OFF . && cmake --build . --config Release -j 4
178-
179- - name : Install ProtoBuf ${{ env.PROTOBUF_VERSION }}
180- working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
181- run : sudo make install && sudo ldconfig
182-
183- - name : Prepare C++ Build
184- run : mkdir build
185-
186- - name : Switch to Proto3 Syntax
187- run : |
188- bash convert-to-proto3.sh
189- rm *.pb2
190-
191- - name : Add Development Version Suffix
192- if : ${{ !startsWith(github.ref, 'refs/tags') }}
193- run : |
194- echo "VERSION_SUFFIX = .dev`date -u '+%Y%m%d%H%M%S'`" >> VERSION
195-
196- - name : Configure C++ Build
197- working-directory : build
198- run : cmake ${{ env.PROTOBUF_VARIANT =='' && '-DCMAKE_CXX_STANDARD=17' }} ..
199-
200- - name : Build C++
201- working-directory : build
202- run : cmake --build . --config Release -j 4
203-
204- - name : Build Python
205- run : python -m build
206-
207- - name : Install Python
208- run : python -m pip install .
209-
210- - name : Run Python Tests
211- run : python -m unittest discover tests
212-
213- publish-python-dist :
214- name : Publish Python Distribution
215-
216- runs-on : ubuntu-22.04
217-
218- permissions :
219- id-token : write
220-
221- needs : [build-proto2-linux64, build-proto3-linux64]
222-
223- if : ${{ github.event_name == 'push' && ( github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') ) }}
224-
225- steps :
226- - name : Download Distribution
227- uses : actions/download-artifact@v4
228- with :
229- name : python-dist
230- path : dist/
231-
232- - name : Publish Snapshot Release on TestPyPI
233- uses : pypa/gh-action-pypi-publish@release/v1
234- continue-on-error : true
235- with :
236- repository-url : https://test.pypi.org/legacy/
237-
238- - name : Publish Full Release on PyPI
239- if : startsWith(github.ref, 'refs/tags/v') && ( ! contains(github.ref, '-') )
240- uses : pypa/gh-action-pypi-publish@release/v1
78+ name : doxygen-doc
79+ path : doc/
0 commit comments