Skip to content

add synchronization for callback drop for advanced subscribers #525

add synchronization for callback drop for advanced subscribers

add synchronization for callback drop for advanced subscribers #525

Workflow file for this run

#
# Copyright (c) 2022 ZettaScale Technology
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# ZettaScale Zenoh Team, <zenoh@zettascale.tech>
#
name: CI
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
schedule:
- cron: "0 6 * * 1-5"
jobs:
run_tests:
name: Run unit tests on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Setup mbedtls
uses: eclipse-zenoh/ci/setup-mbedtls@main
with:
mbedtls-version: mbedtls-3.6.5
- name: Checkout code
uses: actions/checkout@v4
- name: Build & run tests
run: |
sudo apt install -y ninja-build
Z_FEATURE_LINK_TLS=1 Z_FEATURE_LOCAL_QUERYABLE=1 Z_FEATURE_LOCAL_SUBSCRIBER=1 Z_FEATURE_UNSTABLE_API=1 Z_FEATURE_PERIODIC_TASKS=1 CMAKE_GENERATOR=Ninja ASAN=ON make BUILD_TYPE=Debug test
run_windows_test:
name: Run peer unicast test on windows-latest
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build & run tests
run: |
make all
.\build\tests\Debug\z_test_peer_unicast.exe
timeout-minutes: 15
shell: cmd
env:
ZENOH_LOG: INFO
Z_FEATURE_UNSTABLE_API: 1
memory_leak_unit_tests:
name: Memory leak unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup mbedtls
uses: eclipse-zenoh/ci/setup-mbedtls@main
with:
mbedtls-version: mbedtls-3.6.5
- name: Build tests
run: |
sudo apt install -y ninja-build
Z_FEATURE_LINK_TLS=1 Z_FEATURE_LOCAL_QUERYABLE=1 Z_FEATURE_LOCAL_SUBSCRIBER=1 Z_FEATURE_UNSTABLE_API=1 Z_FEATURE_PERIODIC_TASKS=1 CMAKE_GENERATOR=Ninja make BUILD_TYPE=Debug
- name: Install valgrind
run: |
sudo apt update
sudo apt install -y valgrind
- name: Memory leak unit tests
run: |
cd build/tests
for test in *_test; do
if [[ -x "$test" && ! -d "$test" ]]; then # Run only executables
echo "Running Valgrind on $test"
valgrind --leak-check=full --error-exitcode=1 --suppressions=valgrind.supp "./$test" > /dev/null || exit 1
fi
done
check_format:
name: Check codebase format with clang-format
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run clang-format dry-run
run: |
clang-format --version
find include/ src/ tests/ examples/ -iname "*.ino" -o -iname "*.h" -o -iname "*.c" | xargs clang-format -n -Werror
c99_build:
name: Check c99 compilation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build with C99
run: |
sudo apt install -y ninja-build
FORCE_C99=ON CMAKE_GENERATOR=Ninja make
raweth_build:
name: Build raweth transport on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build raweth
run: |
sudo apt install -y ninja-build
Z_FEATURE_RAWETH_TRANSPORT=1 CMAKE_GENERATOR=Ninja make
tls_build:
name: Build TLS transport on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Setup mbedtls
uses: eclipse-zenoh/ci/setup-mbedtls@main
with:
mbedtls-version: mbedtls-3.6.5
- name: Checkout code
uses: actions/checkout@v4
- name: Build with TLS
run: |
sudo apt update
sudo apt install -y ninja-build
Z_FEATURE_LINK_TLS=1 CMAKE_GENERATOR=Ninja make
zenoh_build:
name: Build Zenoh from source
runs-on: ubuntu-latest
outputs:
artifact-name: ${{ steps.main.outputs.artifact-name }}
steps:
- id: main
name: Build Zenoh
uses: eclipse-zenoh/ci/build-crates-standalone@main
with:
repo: eclipse-zenoh/zenoh
branch: main
artifact-patterns: |
^zenohd$
^libzenoh_plugin_rest.so$
^libzenoh_plugin_storage_manager.so$
modular_build:
needs: zenoh_build
name: Modular build on ubuntu-latest
runs-on: ubuntu-latest
strategy:
matrix:
feature_publication: [1, 0]
feature_subscription: [1, 0]
feature_queryable: [1, 0]
feature_query: [1, 0]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}
- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone
- id: run-zenoh
name: Run Zenoh router
run: |
RUST_LOG=debug ./zenoh-standalone/zenohd &
echo "zenohd-pid=$!" >> $GITHUB_OUTPUT
- name: Build project
run: |
sudo apt install -y ninja-build
CMAKE_GENERATOR=Ninja make
python3 ./build/tests/modularity.py --pub $Z_FEATURE_PUBLICATION --sub $Z_FEATURE_SUBSCRIPTION --queryable $Z_FEATURE_QUERYABLE --query $Z_FEATURE_QUERY
timeout-minutes: 15
env:
Z_FEATURE_PUBLICATION: ${{ matrix.feature_publication }}
Z_FEATURE_SUBSCRIPTION: ${{ matrix.feature_subscription }}
Z_FEATURE_QUERYABLE: ${{ matrix.feature_queryable }}
Z_FEATURE_QUERY: ${{ matrix.feature_query }}
- name: Kill Zenoh router
if: always()
run: kill ${{ steps.run-zenoh.outputs.zenohd-pid }}
unstable_build:
name: Check compilation with unstable API
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build with unstable
run: |
sudo apt install -y ninja-build
Z_FEATURE_UNSTABLE_API=1 CMAKE_GENERATOR=Ninja make
no_scouting_build:
name: Check compilation without scouting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build without scouting
run: |
sudo apt install -y ninja-build
Z_FEATURE_SCOUTING=0 CMAKE_GENERATOR=Ninja make
no_interest_build:
name: Check compilation without interests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build without interests
run: |
sudo apt install -y ninja-build
Z_FEATURE_INTEREST=0 CMAKE_GENERATOR=Ninja make
no_liveliness_build:
name: Check compilation without liveliness
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build without interests
run: |
sudo apt install -y ninja-build
Z_FEATURE_LIVELINESS=0 CMAKE_GENERATOR=Ninja make
advanced_publisher_build:
name: Check compilation with advanced publisher
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build with advanced publisher
run: |
sudo apt install -y ninja-build
Z_FEATURE_UNSTABLE_API=1 Z_FEATURE_ADVANCED_PUBLICATION=1 CMAKE_GENERATOR=Ninja make
advanced_subscriber_build:
name: Check compilation with advanced subscriber
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build with advanced subscriber
run: |
sudo apt install -y ninja-build
Z_FEATURE_UNSTABLE_API=1 Z_FEATURE_ADVANCED_SUBSCRIPTION=1 CMAKE_GENERATOR=Ninja make
rx_cache_build:
name: Check compilation with RX cache enabled
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build with RX cache
run: |
sudo apt install -y ninja-build
Z_FEATURE_RX_CACHE=1 CMAKE_GENERATOR=Ninja make
gcc10_build:
name: Check compilation with GCC 10
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build with GCC 10
run: |
sudo apt install -y ninja-build gcc-10
CC=gcc-10 Z_FEATURE_UNSTABLE_API=1 Z_FEATURE_ADVANCED_PUBLICATION=1 Z_FEATURE_ADVANCED_SUBSCRIPTION=1 CMAKE_GENERATOR=Ninja make
gcc9_build:
name: Check compilation with Ubuntu 20.04 (GCC 9)
runs-on: ubuntu-latest
container: ubuntu:20.04
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build with GCC 9
run: |
apt update && apt install -y build-essential cmake
mkdir build && cd build
CC=gcc-9 Z_FEATURE_UNSTABLE_API=1 Z_FEATURE_ADVANCED_PUBLICATION=1 Z_FEATURE_ADVANCED_SUBSCRIPTION=1 cmake ..
cmake --build .
st_build:
needs: zenoh_build
name: Build and test in single thread on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}
- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone
- id: run-zenoh
name: Run Zenoh router
run: |
RUST_LOG=debug ./zenoh-standalone/zenohd &
echo "zenohd-pid=$!" >> $GITHUB_OUTPUT
- name: Build project and run tests
run: |
sudo apt install -y ninja-build
CMAKE_GENERATOR=Ninja ASAN=ON make BUILD_TYPE=Debug
ninja -C build/ test
python3 ./build/tests/single_thread.py
timeout-minutes: 15
env:
Z_FEATURE_MULTI_THREAD: 0
- name: Kill Zenoh router
if: always()
run: kill ${{ steps.run-zenoh.outputs.zenohd-pid }}
fragment_test:
needs: zenoh_build
name: Test multicast and unicast fragmentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}
- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone
- id: run-zenoh
name: Run Zenoh router
run: |
RUST_LOG=debug ./zenoh-standalone/zenohd &
echo "zenohd-pid=$!" >> $GITHUB_OUTPUT
- name: Build project and run test
run: |
sudo apt install -y ninja-build
cmake -DBATCH_UNICAST_SIZE=4096 -B build/ -G Ninja
CMAKE_GENERATOR=Ninja make
python3 ./build/tests/fragment.py
timeout-minutes: 15
- name: Kill Zenoh router
if: always()
run: kill ${{ steps.run-zenoh.outputs.zenohd-pid }}
attachment_test:
needs: zenoh_build
name: Test attachments
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}
- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone
- id: run-zenoh
name: Run Zenoh router
run: |
RUST_LOG=debug ./zenoh-standalone/zenohd &
echo "zenohd-pid=$!" >> $GITHUB_OUTPUT
- name: Build project and run test
run: |
sudo apt install -y ninja-build
Z_FEATURE_UNSTABLE_API=1 CMAKE_GENERATOR=Ninja make
python3 ./build/tests/attachment.py
timeout-minutes: 15
- name: Kill Zenoh router
if: always()
run: kill ${{ steps.run-zenoh.outputs.zenohd-pid }}
memory_leak_test:
needs: zenoh_build
name: Test examples memory leak
runs-on: ubuntu-latest
steps:
- name: Setup mbedtls
uses: eclipse-zenoh/ci/setup-mbedtls@main
with:
mbedtls-version: mbedtls-3.6.5
- name: Checkout code
uses: actions/checkout@v4
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}
- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone
- id: run-zenoh
name: Run Zenoh router
run: |
RUST_LOG=debug ./zenoh-standalone/zenohd &
echo "zenohd-pid=$!" >> $GITHUB_OUTPUT
- name: Install valgrind
run: |
sudo apt-get update
sudo apt-get install -y valgrind
- name: Build project
run: |
sudo apt install -y ninja-build
Z_FEATURE_LINK_TLS=1 Z_FEATURE_LOCAL_QUERYABLE=1 Z_FEATURE_LOCAL_SUBSCRIBER=1 Z_FEATURE_UNSTABLE_API=1 Z_FEATURE_LIVELINESS=1 CMAKE_GENERATOR=Ninja make
- name: Run test
run: python3 -u ./build/tests/memory_leak.py
timeout-minutes: 15
- name: Kill Zenoh router
if: always()
run: kill ${{ steps.run-zenoh.outputs.zenohd-pid }}
no_router:
name: Test examples without router
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build & test pico
run: |
sudo apt install -y ninja-build
CMAKE_GENERATOR=Ninja ASAN=ON make
python3 ./build/tests/no_router.py
timeout-minutes: 15
connection_restore_test:
needs: zenoh_build
name: Connection restore test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}
- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone
- name: Build project and run test
run: |
sudo apt install -y ninja-build
CMAKE_GENERATOR=Ninja ASAN=ON CMAKE_BUILD_TYPE=Debug ZENOH_DEBUG=3 make
RUST_LOG=debug sudo python3 ./build/tests/connection_restore.py ./zenoh-standalone/zenohd
timeout-minutes: 20
routed_peer_client_test:
needs: zenoh_build
name: Test routed peer client communication
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}
- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone
- id: select-multicast-iface
name: Select multicast-capable interface
run: |
echo "Detecting multicast interface..."
# Pick first non-loopback, non-docker, non-veth interface
IFACE=$(ip -o link show | awk -F': ' '$2 != "lo" && $2 !~ /docker/ && $2 !~ /veth/ {print $2; exit}')
if [ -z "$IFACE" ]; then
echo "No suitable interface found, defaulting to eth0"
IFACE=eth0
fi
echo "Selected interface: $IFACE"
echo "iface=$IFACE" >> "$GITHUB_OUTPUT"
- id: run-zenoh
name: Run Zenoh router
run: |
IFACE=${{ steps.select-multicast-iface.outputs.iface }}
RUST_LOG=debug ./zenoh-standalone/zenohd -l tcp/127.0.0.1:7447 -l udp/224.0.0.123:7447#iface=$IFACE > zenohd.log 2>&1 &
echo "zenohd-pid=$!" >> $GITHUB_OUTPUT
- name: Build project and run test
run: |
sudo apt install -y ninja-build
Z_FEATURE_UNSTABLE_API=1 BATCH_MULTICAST_SIZE=8192 BATCH_UNICAST_SIZE=49152 CMAKE_GENERATOR=Ninja make
IFACE=${{ steps.select-multicast-iface.outputs.iface }}
python3 ./build/tests/routed_peer_client.py tcp/127.0.0.1:7447 udp/224.0.0.123:7447#iface=$IFACE
timeout-minutes: 15
- name: Kill Zenoh router
if: always()
run: kill ${{ steps.run-zenoh.outputs.zenohd-pid }}
- name: Print zenohd logs
if: always()
run: |
echo "===== ZENOH ROUTER LOGS ====="
cat zenohd.log || echo "zenohd.log not found"
unicast_peer_test:
name: P2p unicast test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build & test pico
run: |
sudo apt install -y ninja-build
CMAKE_GENERATOR=Ninja make
./build/tests/z_test_peer_unicast
env:
Z_FEATURE_UNSTABLE_API: 1
Z_FEATURE_UNICAST_PEER: 1
timeout-minutes: 15
multicast_peer_test:
name: P2p multicast test
runs-on: ubuntu-latest
strategy:
matrix:
feature_declarations: [1, 0]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build & test pico
run: |
sudo apt install -y ninja-build
CMAKE_GENERATOR=Ninja make
./build/tests/z_test_peer_multicast
env:
Z_FEATURE_UNSTABLE_API: 1
Z_FEATURE_MULTICAST_DECLARATIONS: ${{ matrix.feature_declarations }}
timeout-minutes: 15
markdown_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DavidAnson/markdownlint-cli2-action@v18
with:
config: ".markdownlint.yaml"
globs: "**/README.md"
build_shared:
name: Build shared libs
uses: ./.github/workflows/build-shared.yaml
build_static:
name: Build static libs
uses: ./.github/workflows/build-static.yaml
integration:
name: Run integration tests
uses: ./.github/workflows/integration.yaml
arduino_esp32:
name: Build Arduino ESP32
uses: ./.github/workflows/arduino_esp32.yaml
emscripten:
name: Build Emscripten
uses: ./.github/workflows/emscripten.yaml
espidf:
name: Build ESP-IDF
uses: ./.github/workflows/espidf.yaml
freertos:
name: Build FreeRTOS
uses: ./.github/workflows/freertos_plus_tcp.yaml
mbed:
name: Build Mbed
uses: ./.github/workflows/mbed.yaml
rpi_pico:
name: Build Raspberry Pi Pico
uses: ./.github/workflows/rpi_pico.yaml
zephyr:
name: Build Zephyr
uses: ./.github/workflows/zephyr.yaml
codacy-security-scan:
name: Codacy Security Scan
uses: ./.github/workflows/codacy-analysis.yml
cpp_check:
name: CppCheck
uses: ./.github/workflows/cpp-check.yaml
# 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:
[
run_tests,
check_format,
c99_build,
raweth_build,
tls_build,
zenoh_build,
modular_build,
unstable_build,
no_interest_build,
no_liveliness_build,
st_build,
fragment_test,
attachment_test,
memory_leak_test,
no_router,
connection_restore_test,
markdown_lint,
build_shared,
build_static,
integration,
memory_leak_unit_tests,
unicast_peer_test,
multicast_peer_test,
arduino_esp32,
emscripten,
espidf,
freertos,
mbed,
rpi_pico,
zephyr,
codacy-security-scan,
cpp_check,
]
if: always()
steps:
- name: Check whether all jobs pass
run: echo '${{ toJson(needs) }}' | jq -e 'all(.result == "success")'