|
| 1 | +# |
| 2 | +# Copyright (c) 2024 ZettaScale Technology |
| 3 | +# |
| 4 | +# This program and the accompanying materials are made available under the |
| 5 | +# terms of the Eclipse Public License 2.0 which is available at |
| 6 | +# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 |
| 7 | +# which is available at https://www.apache.org/licenses/LICENSE-2.0. |
| 8 | +# |
| 9 | +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 |
| 10 | +# |
| 11 | +# Contributors: |
| 12 | +# ZettaScale zenoh Team, <[email protected]> |
| 13 | +# |
| 14 | +name: cpp-check |
| 15 | + |
| 16 | +on: |
| 17 | + push: |
| 18 | + branches: |
| 19 | + - main |
| 20 | + pull_request: |
| 21 | + branches: |
| 22 | + - main |
| 23 | + workflow_dispatch: |
| 24 | + inputs: |
| 25 | + zenoh_cpp_branch: |
| 26 | + description: 'Branch of zenoh-cpp to use' |
| 27 | + required: false |
| 28 | + default: 'main' |
| 29 | + |
| 30 | +jobs: |
| 31 | + build-and-test: |
| 32 | + name: Build and test zenoh-cpp on ${{ matrix.os }} |
| 33 | + runs-on: ${{ matrix.os }} |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + os: [ubuntu-latest, macOS-latest, windows-latest] |
| 38 | + unstable: [0, 1] |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: checkout zenoh-pico |
| 42 | + uses: actions/checkout@v3 |
| 43 | + |
| 44 | + - name: build zenoh-pico |
| 45 | + run: | |
| 46 | + mkdir build && cd build |
| 47 | + cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local -DZ_FEATURE_UNSTABLE_API=${{ matrix.unstable }} -DZ_FEATURE_LIVELINESS=1 -DASAN=ON |
| 48 | + cmake --build . --target install --config Release |
| 49 | +
|
| 50 | + - name: clone zenoh-cpp |
| 51 | + run: | |
| 52 | + git clone https://github.com/eclipse-zenoh/zenoh-cpp.git |
| 53 | + cd zenoh-cpp |
| 54 | + git fetch --all |
| 55 | + git checkout ${{ github.event.inputs.zenoh_cpp_branch || 'main' }} |
| 56 | + git submodule update --init --recursive |
| 57 | +
|
| 58 | + - name: build zenoh-cpp |
| 59 | + run: | |
| 60 | + cd zenoh-cpp |
| 61 | + mkdir build && cd build |
| 62 | + cmake .. -DCMAKE_INSTALL_PREFIX=~/local -DCMAKE_BUILD_TYPE=Release -DZENOHCXX_ZENOHPICO=ON -DZENOHCXX_ZENOHC=OFF |
| 63 | + cmake --build . --config Release |
| 64 | +
|
| 65 | + - name: build examples |
| 66 | + run: | |
| 67 | + cd zenoh-cpp/build |
| 68 | + cmake --build . --target examples --config Release |
| 69 | +
|
| 70 | + - name: build tests |
| 71 | + run: | |
| 72 | + cd zenoh-cpp/build |
| 73 | + cmake --build . --target tests --config Release |
| 74 | +
|
| 75 | + - name: run tests |
| 76 | + run: | |
| 77 | + cd zenoh-cpp/build |
| 78 | + ctest -C Release --output-on-failure |
0 commit comments