Skip to content

Fixing locking around queryMap_ (#42) #148

Fixing locking around queryMap_ (#42)

Fixing locking around queryMap_ (#42) #148

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: ["**"]
workflow_call:
workflow_dispatch:
jobs:
build-zenoh-c:
name: Build Zenoh-C
runs-on: ubuntu-latest
env:
Zenoh_C_Repo: https://github.com/eclipse-zenoh/zenoh-c.git
Zenoh_C_Cache_PFX: libzenohc
outputs:
Zenoh_C_Cache: ${{ env.Zenoh_C_Cache_PFX }}-${{ steps.zenoh-c-head.outputs.Zenoh_C_HEAD }}
steps:
- name: Check remote head hash
id: zenoh-c-head
shell: bash
run: '{ echo -n "Zenoh_C_HEAD="; git ls-remote "$Zenoh_C_Repo" HEAD | cut -f1; } | tee -a "$GITHUB_OUTPUT"'
- name: Cache compiled zenoh-c library
id: cache-libzenohc
uses: actions/cache@v4
with:
key: ${{ env.Zenoh_C_Cache_PFX }}-${{ steps.zenoh-c-head.outputs.Zenoh_C_HEAD }}
path: |
~/local
- name: Install Rust toolchain
if: ${{ steps.cache-libzenohc.outputs.cache-hit != 'true' }}
run: rustup component add rustfmt clippy
# NOTE: Checks out the head revision we found using ls-remote above
# to avoid race conditions resulting in mismatch between cache
# and contents of repo.
- name: Clone Zenoh-C
if: ${{ steps.cache-libzenohc.outputs.cache-hit != 'true' }}
env:
Zenoh_C_HEAD: ${{ steps.zenoh-c-head.outputs.Zenoh_C_HEAD }}
shell: bash
run: |
pwd
git clone "$Zenoh_C_Repo"
cd zenoh-c && git checkout "$Zenoh_C_HEAD"
- name: Build and install Zenoh-C
if: ${{ steps.cache-libzenohc.outputs.cache-hit != 'true' }}
shell: bash
run: |
mkdir -p zenoh-c/build && cd zenoh-c/build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local
cmake --build . --target install --config Release -- -j
build-up-cpp:
name: Build up-cpp
runs-on: ubuntu-latest
env:
UP_CPP_Repo: https://github.com/eclipse-uprotocol/up-cpp.git
UP_CPP_Cache_PFX: up-cpp-conan2
outputs:
UP_CPP_Cache: ${{ env.UP_CPP_Cache_PFX }}-${{ steps.up-cpp-head.outputs.UP_CPP_HEAD }}
steps:
- name: Check remote head hash
id: up-cpp-head
shell: bash
run: '{ echo -n "UP_CPP_HEAD="; git ls-remote "$UP_CPP_Repo" HEAD | cut -f1; } | tee -a "$GITHUB_OUTPUT"'
- name: Cache conan artifacts
id: cache-conan2
uses: actions/cache@v4
with:
key: ${{ env.UP_CPP_Cache_PFX }}-${{ steps.up-cpp-head.outputs.UP_CPP_HEAD }}
path: |
~/.conan2
- name: Install Conan
if: ${{ steps.cache-conan2.outputs.cache-hit != 'true' }}
id: conan
uses: turtlebrowser/get-conan@main
- name: Create default Conan profile
if: ${{ steps.cache-conan2.outputs.cache-hit != 'true' }}
run: conan profile detect
# NOTE: Checks out the head revision we found using ls-remote above
# to avoid race conditions resulting in mismatch between cache
# and contents of repo.
- name: Clone up-cpp repo
if: ${{ steps.cache-conan2.outputs.cache-hit != 'true' }}
shell: bash
env:
UP_CPP_HEAD: ${{ steps.up-cpp-head.outputs.UP_CPP_HEAD }}
run: |
git clone "$UP_CPP_Repo"
cd up-cpp && git checkout "$UP_CPP_HEAD"
git submodule update --init --recursive
- name: Create up-cpp Conan package
if: ${{ steps.cache-conan2.outputs.cache-hit != 'true' }}
shell: bash
run: |
cd up-cpp
conan create . --build=missing
- name: Clean up conan build files
if: ${{ steps.cache-conan2.outputs.cache-hit != 'true' }}
run: conan cache clean '*'
build-up-client-zenoh-cpp:
name: Build up-client-zenoh-cpp
needs: [ build-zenoh-c, build-up-cpp ]
runs-on: ubuntu-latest
env:
Zenoh_C_Cache: ${{ needs.build-zenoh-c.outputs.Zenoh_C_Cache }}
UP_CPP_Cache: ${{ needs.build-up-cpp.outputs.UP_CPP_Cache }}
steps:
# Note: will never update here since it will always match from previous job
- name: Get cached zenoh-c library
uses: actions/cache@v4
with:
key: ${{ env.Zenoh_C_Cache }}
path: |
~/local
# Note: will never update here since it will always match from previous job
- name: Get cached up-cpp conan artifacts
uses: actions/cache@v4
with:
key: ${{ env.UP_CPP_Cache }}
path: |
~/.conan2
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- uses: actions/checkout@v4
- name: Build and install up-client-zenoh-cpp
shell: bash
run: |
export CMAKE_PREFIX_PATH="$HOME/local"
export CMAKE_ZENOH_INCLUDE_PATH="$HOME/local/include"
mkdir build
cd build
conan install ../ -o build_unbundled=True -o zenoh_package=False
cmake ../ -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local
cmake --build . --target install --config Release -- -j
- name: Upload test binaries
uses: actions/upload-artifact@v4
with:
name: tests_up-client-zenoh-cpp
path: |
build/bin
retention-days: 1
# NOTE: In GitHub repository settings, the "Require status checks to pass
# before merging" branch protection rule ensures that commits are only merged
# from branches where specific status checks have passed. These checks are
# specified manually as a list of workflow job names. Thus we use this extra
# job to signal whether all CI checks have passed.
ci:
name: CI status checks
runs-on: ubuntu-latest
needs: [ build-zenoh-c, build-up-cpp, build-up-client-zenoh-cpp ]
if: always()
steps:
- name: Check whether all jobs pass
run: echo '${{ toJson(needs) }}' | jq -e 'all(.result == "success")'