Merge pull request #111 from OpenSimulationInterface/fix/add-ssp-cita… #219
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
- '**' | |
paths-ignore: [ .github/**, .gitmodules ] | |
tags-ignore: | |
- '**' | |
pull_request: | |
branches: [ master ] | |
repository_dispatch: | |
types: [examples-build] | |
# this is a test | |
jobs: | |
build-osmp-examples: | |
name: Build OSMP examples | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout OSI | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Cache Dependencies | |
id: cache-depends | |
uses: actions/cache@v4 | |
with: | |
path: protobuf-${{ env.PROTOBUF_VERSION }} | |
key: ${{ runner.os }}-v2-depends | |
- name: Download ProtoBuf ${{ env.PROTOBUF_VERSION }} | |
if: steps.cache-depends.outputs.cache-hit != 'true' | |
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: 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: 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 | |
- name: Prepare C++ Build | |
working-directory: examples | |
run: mkdir build | |
- name: Configure C++ Build | |
working-directory: examples/build | |
run: cmake ${{ env.PROTOBUF_VARIANT =='' && '-DCMAKE_CXX_STANDARD=17' }} .. | |
- name: Build C++ | |
working-directory: examples/build | |
run: cmake --build . --config Release -j 4 | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Examples | |
path: examples/build | |
update_interface_release: | |
name: Update OSI release | |
runs-on: ubuntu-22.04 | |
needs: [build-osmp-examples] | |
if: ${{ github.event.client_payload }} | |
steps: | |
- name: Collect previous artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: Examples | |
path: examples/build | |
- name: Zip artifacts | |
uses: TheDoctor0/[email protected] | |
with: | |
filename: Examples.zip | |
path: examples/build | |
- name: Upload artifacts to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.MACHINE_USER_PAT }} | |
file: Examples.zip | |
tag: ${{ github.event.client_payload.tag }} | |
repo_name: ${{ github.event.client_payload.source_repo }} |