1
1
name : ProtoBuf CI Builds
2
2
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
-
8
3
on :
9
4
push :
10
5
pull_request :
21
16
with :
22
17
config_path : .github/.pyspelling.yml
23
18
24
- build-proto2-linux64 :
25
- name : Build Proto2 Linux 64
19
+ run-tests :
20
+ name : Run tests and build docs
26
21
27
22
runs-on : ubuntu-22.04
28
23
32
27
with :
33
28
submodules : true
34
29
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
-
40
30
- name : Setup Python
41
31
uses : actions/setup-python@v5
42
32
with :
@@ -45,49 +35,15 @@ jobs:
45
35
- name : Install Python Dependencies
46
36
run : |
47
37
python -m pip install --upgrade pip
48
- python -m pip install build
49
38
python -m pip install -r requirements_tests.txt
50
39
51
- - name : Check black format
52
- run : |
53
- black --check --diff .
54
-
55
40
- name : Install Doxygen
56
41
run : sudo apt-get install doxygen graphviz
57
42
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
-
87
43
- name : Install proto2cpp
88
44
run : git clone --depth 1 https://github.com/OpenSimulationInterface/proto2cpp.git
89
45
90
- - name : Prepare C++ Build
46
+ - name : Prepare Build
91
47
run : mkdir build
92
48
93
49
- name : Add Development Version Suffix
@@ -105,136 +61,19 @@ jobs:
105
61
echo "EXCLUDE_PATTERNS = */osi3/* */protobuf-*/* */proto2cpp/* */flatbuffers/*" >> doxygen_config.cmake.in
106
62
echo "GENERATE_TREEVIEW = YES" >> doxygen_config.cmake.in
107
63
108
- - name : Configure C++ Build
64
+ - name : Configure Build
109
65
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 ..
111
67
112
- - name : Build C++
68
+ - name : Build
113
69
working-directory : build
114
70
run : cmake --build . --config Release -j 4
115
71
116
- - name : Build Python
117
- run : python -m build
118
-
119
- - name : Install Python
120
- run : python -m pip install .
121
-
122
72
- name : Run Python Tests
123
73
run : python -m unittest discover tests
124
74
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
127
76
uses : actions/upload-artifact@v4
128
77
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