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+
38on :
49 push :
510 pull_request :
@@ -13,14 +18,14 @@ jobs:
1318
1419 steps :
1520 - name : Checkout OSI
16- uses : actions/checkout@v2
21+ uses : actions/checkout@v4
1722 with :
1823 submodules : true
1924
2025 - name : Setup Python
21- uses : actions/setup-python@v2
26+ uses : actions/setup-python@v5
2227 with :
23- python-version : ' 3.7 '
28+ python-version : ' 3.8 '
2429
2530 - name : Install Python Dependencies
2631 run : python -m pip install --upgrade pip setuptools wheel pyyaml
@@ -32,20 +37,29 @@ jobs:
3237 id : cache-depends
3338 uses : actions/cache@v3
3439 with :
35- path : protobuf-3.20.1
40+ path : protobuf-${{ env.PROTOBUF_VERSION }}
3641 key : ${{ runner.os }}-v2-depends
3742
38- - name : Download ProtoBuf
43+ - name : Download ProtoBuf ${{ env.PROTOBUF_VERSION }}
3944 if : steps.cache-depends.outputs.cache-hit != 'true'
40- 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
45+ 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
4146
42- - name : Build ProtoBuf
43- if : steps.cache-depends.outputs.cache-hit != 'true'
44- working-directory : protobuf-3.20.1
47+ - name : Download Abseil ${{ env.ABSEIL_VERSION }}
48+ if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
49+ 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
50+
51+ - name : Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via autotools
52+ if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == '-all'
53+ working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
4554 run : ./configure DIST_LANG=cpp --prefix=/usr && make
4655
47- - name : Install ProtoBuf
48- working-directory : protobuf-3.20.1
56+ - name : Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via cmake
57+ if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
58+ working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
59+ run : cmake -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_TESTS=OFF . && cmake --build . --config Release -j 4
60+
61+ - name : Install ProtoBuf ${{ env.PROTOBUF_VERSION }}
62+ working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
4963 run : sudo make install && sudo ldconfig
5064
5165 - name : Install proto2cpp
@@ -57,17 +71,17 @@ jobs:
5771 # Versioning
5872 - name : Get versioning
5973 id : get_version
60- run : echo ::set-output name= VERSION:: $(git describe --always)
74+ run : echo " VERSION= $(git describe --always)" >> $GITHUB_OUTPUT
6175
6276 - name : Prepare Documentation Build
6377 run : |
6478 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
65- echo "EXCLUDE_PATTERNS = */osi3/* */protobuf-3.20.1 /* */proto2cpp/* */flatbuffers/*" >> doxygen_config.cmake.in
79+ echo "EXCLUDE_PATTERNS = */osi3/* */protobuf-* /* */proto2cpp/* */flatbuffers/*" >> doxygen_config.cmake.in
6680 echo "GENERATE_TREEVIEW = YES" >> doxygen_config.cmake.in
6781
6882 - name : Configure C++ Build
6983 working-directory : build
70- run : cmake -D FILTER_PROTO2CPP_PY_PATH=$GITHUB_WORKSPACE/proto2cpp ..
84+ run : cmake -D FILTER_PROTO2CPP_PY_PATH=$GITHUB_WORKSPACE/proto2cpp ${{ env.PROTOBUF_VARIANT =='' && '-DCMAKE_CXX_STANDARD=17' }} ..
7185
7286 - name : Build C++
7387 working-directory : build
8498
8599 - name : Archive Documentation
86100 if : ${{ github.event_name == 'pull_request' }}
87- uses : actions/upload-artifact@v2
101+ uses : actions/upload-artifact@v4
88102 with :
89103 name : linux64-doc
90104 path : doc/html
@@ -104,36 +118,45 @@ jobs:
104118
105119 steps :
106120 - name : Checkout OSI
107- uses : actions/checkout@v2
121+ uses : actions/checkout@v4
108122 with :
109123 submodules : true
110124
111125 - name : Setup Python
112- uses : actions/setup-python@v2
126+ uses : actions/setup-python@v5
113127 with :
114- python-version : ' 3.7 '
128+ python-version : ' 3.8 '
115129
116130 - name : Install Python Dependencies
117131 run : python -m pip install --upgrade pip setuptools wheel pyyaml
118132
119133 - name : Cache Dependencies
120134 id : cache-depends
121- uses : actions/cache@v2
135+ uses : actions/cache@v3
122136 with :
123- path : protobuf-3.20.1
137+ path : protobuf-${{ env.PROTOBUF_VERSION }}
124138 key : ${{ runner.os }}-v2-depends
125139
126- - name : Download ProtoBuf
140+ - name : Download ProtoBuf ${{ env.PROTOBUF_VERSION }}
127141 if : steps.cache-depends.outputs.cache-hit != 'true'
128- 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
142+ 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
129143
130- - name : Build ProtoBuf
131- if : steps.cache-depends.outputs.cache-hit != 'true'
132- working-directory : protobuf-3.20.1
144+ - name : Download Abseil ${{ env.ABSEIL_VERSION }}
145+ if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
146+ 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
147+
148+ - name : Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via autotools
149+ if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == '-all'
150+ working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
133151 run : ./configure DIST_LANG=cpp --prefix=/usr && make
134152
135- - name : Install ProtoBuf
136- working-directory : protobuf-3.20.1
153+ - name : Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via cmake
154+ if : steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
155+ working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
156+ run : cmake -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_TESTS=OFF . && cmake --build . --config Release -j 4
157+
158+ - name : Install ProtoBuf ${{ env.PROTOBUF_VERSION }}
159+ working-directory : protobuf-${{ env.PROTOBUF_VERSION }}
137160 run : sudo make install && sudo ldconfig
138161
139162 - name : Prepare C++ Build
@@ -146,7 +169,7 @@ jobs:
146169
147170 - name : Configure C++ Build
148171 working-directory : build
149- run : cmake ..
172+ run : cmake ${{ env.PROTOBUF_VARIANT =='' && '-DCMAKE_CXX_STANDARD=17' }} ..
150173
151174 - name : Build C++
152175 working-directory : build
0 commit comments