Skip to content

Commit

Permalink
Merge branch 'main' into refactor/polish-result-in-for-loop
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin authored Dec 3, 2024
2 parents 97779e0 + 752d7b5 commit 8c9103e
Show file tree
Hide file tree
Showing 155 changed files with 16,328 additions and 9,410 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
rustflags = "-Ctarget-feature=-crt-static"

[target.aarch64-unknown-linux-musl]
rustflags = "-Ctarget-feature=-crt-static"
rustflags = "-Ctarget-feature=-crt-static"
12 changes: 11 additions & 1 deletion .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@

changelog:
categories:
- title: Breaking changes 💥
labels:
- breaking-change
- title: New features 🎉
labels:
- enhancement
- new feature
- title: Bug fixes 🐞
labels:
- bug
- title: Documentation 📝
labels:
- documentation
- title: Dependencies 👷
labels:
- dependencies
- title: Other changes
labels:
- "*"
- "*"
15 changes: 15 additions & 0 deletions .github/workflows/check-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Check required labels

on:
pull_request_target:
types: [opened, synchronize, reopened, labeled]
branches: ["**"]

jobs:
check-labels:
name: Check PR labels
uses: eclipse-zenoh/ci/.github/workflows/check-labels.yml@main
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
permissions:
pull-requests: write
158 changes: 143 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
schedule:
- cron: "0 6 * * 1-5"

env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_PROFILE_DEV_DEBUG: false

jobs:
check_format:
name: Check codebase format with clang-format
Expand All @@ -26,15 +30,17 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
shm: [false, true]
unstable: [false, true]

steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
run: rustup component add rustfmt clippy

- name: Run clippy
run: cargo clippy --all-targets --all-features -- --deny warnings
- name: Run clippy without default features
run: cargo clippy --all-targets --no-default-features --features unstable,shared-memory -- --deny warnings

- name: Run rustfmt
run: cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate"
Expand All @@ -46,22 +52,33 @@ jobs:
shell: bash
run: |
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local
cmake .. -DZENOHC_TREAT_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local -DZENOHC_BUILD_WITH_SHARED_MEMORY=${{ matrix.shm }} -DZENOHC_BUILD_WITH_UNSTABLE_API=${{ matrix.unstable }}
cmake --build . --target install --config Release
- name: Install valgrind
uses: taiki-e/install-action@valgrind
if: matrix.os == 'ubuntu-latest'

- name: Run cmake tests with zenoh-c as dynamic library
shell: bash
run: |
cd build
cmake .. -DZENOHC_LIB_STATIC=FALSE -DCMAKE_BUILD_TYPE=Release
cmake .. -DZENOHC_TREAT_WARNING_AS_ERROR=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DZENOHC_BUILD_WITH_SHARED_MEMORY=${{ matrix.shm }} -DZENOHC_BUILD_WITH_UNSTABLE_API=${{ matrix.unstable }}
cmake --build . --target tests --config Release
ctest -C Release --output-on-failure -E "(unit_z_api_alignment_test|build_z_build_static)"
- name: Build cmake tests with C++ compiler to make sure that C API is C++ compatible
shell: bash
run: |
cd build
cmake .. -DZENOHC_TREAT_WARNING_AS_ERROR=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DZENOHC_BUILD_TESTS_WITH_CXX=TRUE -DZENOHC_BUILD_WITH_SHARED_MEMORY=${{ matrix.shm }} -DZENOHC_BUILD_WITH_UNSTABLE_API=${{ matrix.unstable }}
cmake --build . --target tests --config Debug
- name: Run cmake tests with zenoh-c as static library
shell: bash
run: |
cd build
cmake .. -DZENOHC_LIB_STATIC=TRUE -DCMAKE_BUILD_TYPE=Release
cmake .. -DZENOHC_TREAT_WARNING_AS_ERROR=ON -DZENOHC_BUILD_TESTS_WITH_CXX=FALSE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DZENOHC_BUILD_WITH_SHARED_MEMORY=${{ matrix.shm }} -DZENOHC_BUILD_WITH_UNSTABLE_API=${{ matrix.unstable }}
cmake --build . --target tests --config Release
ctest -C Release --output-on-failure -E "(unit_z_api_alignment_test|build_z_build_shared)"
Expand All @@ -71,26 +88,19 @@ jobs:
cd build
cmake --build . --target examples
- name: Build examples with zenoh-c as subbroject and static library and in debug mode
shell: bash
run: |
mkdir -p build_examples && cd build_examples
cmake ../examples -DCMAKE_BUILD_TYPE=Debug -DZENOHC_LIB_STATIC=TRUE
cmake --build . --config Debug
cd .. && rm -rf build_examples
- name: Build examples with zenoh-c as installed package
shell: bash
run: |
mkdir -p build_examples && cd build_examples
cmake ../examples -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local -DZENOHC_SOURCE=PACKAGE
cmake ../examples -DZENOHC_TREAT_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local
cmake --build . --config Release
cd .. && rm -rf build_examples
- name: Run rust tests
run: cargo test --verbose --release --features=logger-autoinit
run: cargo test --verbose --release

- name: Upload artifact
if: ${{ matrix.unstable == 'false' && matrix.shm == 'false' }}
uses: actions/upload-artifact@v4
with:
# Artifact name
Expand All @@ -103,6 +113,124 @@ jobs:
!target/release/.*
!target/release/*.d
cross-compile-mac-os:
name: Cross compile on macOS-latest
runs-on: macOS-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
brew tap messense/macos-cross-toolchains
brew install armv7-unknown-linux-gnueabihf
brew install mingw-w64
brew install x86_64-unknown-linux-gnu
- name: Install rust toolchains
run: |
rustup target add armv7-unknown-linux-gnueabihf
rustup target add x86_64-pc-windows-gnu
rustup target add x86_64-unknown-linux-gnu
- name: Cross compile for armv7-unknown-linux-gnueabihf
run: |
rm -rf ./build
mkdir -p ./build && cd ./build
cmake -DCMAKE_TOOLCHAIN_FILE="../ci/toolchains/TC-armv7-unknown-linux-gnueabihf.cmake" -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON -DZENOHC_BUILD_WITH_UNSTABLE_API=ON ..
cmake --build . --target examples
- name: Cross compile for x86_64-unknown-linux-gnu
run: |
rm -rf ./build
mkdir -p ./build && cd ./build
cmake -DCMAKE_TOOLCHAIN_FILE="../ci/toolchains/TC-x86_64-unknown-linux-gnu.cmake" -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON -DZENOHC_BUILD_WITH_UNSTABLE_API=ON ..
cmake --build . --target examples
- name: Cross compile for x86_64-pc-windows-gnu
run: |
rm -rf ./build
mkdir -p ./build && cd ./build
cmake -DCMAKE_TOOLCHAIN_FILE="../ci/toolchains/TC-x86_64-pc-windows-gnu.cmake" -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON -DZENOHC_BUILD_WITH_UNSTABLE_API=ON ..
cmake --build . --target examples
cross-compile-ubuntu:
name: Cross compile on ubuntu-latest
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get install -y musl-tools
sudo apt-get install -y gcc-arm-linux-gnueabi
sudo apt-get install -y gcc-arm-linux-gnueabihf
sudo apt-get install -y g++-arm-linux-gnueabi
sudo apt-get install -y g++-arm-linux-gnueabihf
sudo apt-get install -y mingw-w64
sudo apt-get install -y gcc-aarch64-linux-gnu
sudo apt-get install -y g++-aarch64-linux-gnu
wget https://musl.cc/aarch64-linux-musl-cross.tgz
tar xvfz aarch64-linux-musl-cross.tgz
echo "$(readlink -f aarch64-linux-musl-cross)/bin" >> "$GITHUB_PATH"
wget https://musl.cc/x86_64-linux-musl-cross.tgz
tar xvfz x86_64-linux-musl-cross.tgz
echo "$(readlink -f x86_64-linux-musl-cross)/bin" >> "$GITHUB_PATH"
- name: Install rust toolchains
run: |
rustup target add arm-unknown-linux-gnueabi
rustup target add arm-unknown-linux-gnueabihf
rustup target add x86_64-pc-windows-gnu
rustup target add aarch64-unknown-linux-gnu
rustup target add aarch64-unknown-linux-musl
rustup target add x86_64-unknown-linux-musl
- name: Cross compile for arm-unknown-linux-gnueabi
run: |
rm -rf ./build
mkdir -p ./build && cd ./build
cmake -DCMAKE_TOOLCHAIN_FILE="../ci/toolchains/TC-arm-unknown-linux-gnueabi.cmake" -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON -DZENOHC_BUILD_WITH_UNSTABLE_API=ON ..
cmake --build . --target examples
- name: Cross compile for arm-unknown-linux-gnueabihf
run: |
rm -rf ./build
mkdir -p ./build && cd ./build
cmake -DCMAKE_TOOLCHAIN_FILE="../ci/toolchains/TC-arm-unknown-linux-gnueabihf.cmake" -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON -DZENOHC_BUILD_WITH_UNSTABLE_API=ON ..
cmake --build . --target examples
- name: Cross compile for aarch64-unknown-linux-gnu
run: |
rm -rf ./build
mkdir -p ./build && cd ./build
cmake -DCMAKE_TOOLCHAIN_FILE="../ci/toolchains/TC-aarch64-unknown-linux-gnu.cmake" -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON -DZENOHC_BUILD_WITH_UNSTABLE_API=ON ..
cmake --build . --target examples
- name: Cross compile for aarch64-unknown-linux-musl
run: |
rm -rf ./build
mkdir -p ./build && cd ./build
cmake -DCMAKE_TOOLCHAIN_FILE="../ci/toolchains/TC-aarch64-unknown-linux-musl.cmake" -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON -DZENOHC_BUILD_WITH_UNSTABLE_API=ON ..
cmake --build . --target examples
- name: Cross compile for x86_64-unknown-linux-musl
run: |
rm -rf ./build
mkdir -p ./build && cd ./build
cmake -DCMAKE_TOOLCHAIN_FILE="../ci/toolchains/TC-x86_64-unknown-linux-musl.cmake" -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON -DZENOHC_BUILD_WITH_UNSTABLE_API=ON ..
cmake --build . --target examples
- name: Cross compile for x86_64-pc-windows-gnu
run: |
rm -rf ./build
mkdir -p ./build && cd ./build
cmake -DCMAKE_TOOLCHAIN_FILE="../ci/toolchains/TC-x86_64-pc-windows-gnu.cmake" -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON -DZENOHC_BUILD_WITH_UNSTABLE_API=ON ..
cmake --build . --target examples
# 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
Expand Down
Loading

0 comments on commit 8c9103e

Please sign in to comment.