Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize actions and use OSI protobuf build setup #106

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/antora-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- name: Trigger generator
if: ${{ env.MUP_KEY != '' }}
uses: peter-evans/repository-dispatch@v2
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.MACHINE_USER_PAT }}
event-type: antora-build-trigger
Expand Down
55 changes: 33 additions & 22 deletions .github/workflows/protobuf.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: ProtoBuf CI Builds

env:
PROTOBUF_VERSION: 3.20.1
PROTOBUF_VARIANT: '-all' # Use '-all' prior to 22.0, '' after
ABSEIL_VERSION: 20230802.1

on:
push:
branches:
Expand All @@ -22,52 +27,58 @@ jobs:

steps:
- name: Checkout OSI
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.7'
python-version: '3.8'

# cache dependencies
- name: Cache Dependencies
id: cache-depends
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: protobuf-3.15.8
path: protobuf-${{ env.PROTOBUF_VERSION }}
key: ${{ runner.os }}-v2-depends

# Download and build protobuf
- name: Download ProtoBuf
- name: Download ProtoBuf ${{ env.PROTOBUF_VERSION }}
if: steps.cache-depends.outputs.cache-hit != 'true'
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
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

- name: Build ProtoBuf
if: steps.cache-depends.outputs.cache-hit != 'true'
working-directory: protobuf-3.15.8
- name: Download Abseil ${{ env.ABSEIL_VERSION }}
if: steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
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

- name: Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via autotools
if: steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == '-all'
working-directory: protobuf-${{ env.PROTOBUF_VERSION }}
run: ./configure DIST_LANG=cpp --prefix=/usr && make

- name: Install ProtoBuf
working-directory: protobuf-3.15.8
- name: Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via cmake
if: steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
working-directory: protobuf-${{ env.PROTOBUF_VERSION }}
run: cmake -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_TESTS=OFF . && cmake --build . --config Release -j 4

- name: Install ProtoBuf ${{ env.PROTOBUF_VERSION }}
working-directory: protobuf-${{ env.PROTOBUF_VERSION }}
run: sudo make install && sudo ldconfig

# prepare build
- name: Prepare C++ Build
working-directory: examples
run: mkdir build

- name: cmake prepare
- name: Configure C++ Build
working-directory: examples/build
run: cmake -D CMAKE_PREFIX_PATH:PATH=${DEPS_DIR}/protobuf/install ..
run: cmake ${{ env.PROTOBUF_VARIANT =='' && '-DCMAKE_CXX_STANDARD=17' }} ..

- name: Build C++
working-directory: examples/build
run: cmake --build .
run: cmake --build . --config Release -j 4

- name: Upload build artifacts
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4
with:
name: Examples
path: examples/build
Expand All @@ -79,12 +90,12 @@ jobs:
if: ${{ github.event.client_payload }}
steps:
- name: Collect previous artifacts
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4
with:
name: Examples
path: examples/build
- name: Zip artifacts
uses: TheDoctor0/zip-release@0.6.2
uses: TheDoctor0/zip-release@0.7.6
with:
filename: Examples.zip
path: examples/build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/remote_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: Ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

Expand All @@ -40,7 +40,7 @@ jobs:
git tag ${REPO_TAG}

- name: GitHub Push
uses: CasperWA/push-protected@v2.14.0
uses: CasperWA/push-protected@v2.15.0
with:
# Token for the repo. Can be passed in using $\{{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.MACHINE_USER_PAT }}
Expand Down