diff --git a/.github/workflows/bundled-lint-and-test.yaml b/.github/workflows/bundled-lint-and-test.yaml index 7c62c513..0f2fa135 100644 --- a/.github/workflows/bundled-lint-and-test.yaml +++ b/.github/workflows/bundled-lint-and-test.yaml @@ -15,6 +15,7 @@ name: Lint and Test - Bundled env: VSOMEIP_INSTALL_PATH: vsomeip-install + OPENSSL_NO_VENDOR: "1" on: push: @@ -54,59 +55,125 @@ jobs: echo "arch_specific_cpp_stdlib_path=$ARCH_SPECIFIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT echo "generic_cpp_stdlib_path=$GENERIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT - lint: - name: Lint + lint_base: + name: Lint (base build+clippy) runs-on: ubuntu-22.04 needs: set-env env: - ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} - GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} + ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} + GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} steps: - uses: actions/checkout@v4 - name: Install C++ dependencies - run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev pkg-config libssl-dev - name: Set environment variables - run: | - echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV - env - - - name: Print environment variables for debugging - run: | - echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}" - echo "GENERIC_CPP_STDLIB_PATH: ${{ env.GENERIC_CPP_STDLIB_PATH }}" - echo "ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ env.ARCH_SPECIFIC_CPP_STDLIB_PATH }}" - env + run: echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV - name: Ensure vsomeip install path exists - run: | - mkdir -p ${{ env.VSOMEIP_INSTALL_PATH }} - ls -l + run: mkdir -p "${{ env.VSOMEIP_INSTALL_PATH }}" - name: Install stable toolchain run: | rustup show - rustup component add rustfmt clippy + rustup component add clippy + + - name: Cache Rust dependencies and build outputs + uses: swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-${{ github.ref }} + save-if: ${{ github.job == 'lint_feature' }} - name: Build the project without Zenoh & vsomeip transports - working-directory: ${{github.workspace}} + working-directory: ${{ github.workspace }} run: cargo build + - name: cargo clippy without Zenoh & vsomeip transports - working-directory: ${{github.workspace}} + working-directory: ${{ github.workspace }} run: cargo clippy --all-targets -- -W warnings -D warnings - - name: Build the project with Zenoh & vsomeip transports (and thus streamer references) - working-directory: ${{github.workspace}} - run: cargo build --features vsomeip-transport,bundled-vsomeip,zenoh-transport,mqtt-transport + + lint_feature: + name: Lint (feature build+clippy) + runs-on: ubuntu-22.04 + needs: set-env + + env: + ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} + GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} + + steps: + - uses: actions/checkout@v4 + + - name: Install C++ dependencies + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev pkg-config libssl-dev + + - name: Set environment variables + run: echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV + + - name: Ensure vsomeip install path exists + run: mkdir -p "${{ env.VSOMEIP_INSTALL_PATH }}" + + - name: Install stable toolchain + run: | + rustup show + rustup component add clippy + + - name: Cache Rust dependencies and build outputs + uses: swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-${{ github.ref }} + save-if: ${{ github.job == 'lint_feature' }} + + - name: Force rebuild bundled vsomeip artifacts + run: | + rm -rf "${VSOMEIP_INSTALL_PATH}" + rm -rf target/debug/build/vsomeip-sys-* target/debug/build/up-transport-vsomeip-* + cargo clean -p vsomeip-sys -p up-transport-vsomeip + - name: cargo clippy with Zenoh & vsomeip transports (and thus streamer references) - working-directory: ${{github.workspace}} - run: cargo clippy --features vsomeip-transport,bundled-vsomeip,zenoh-transport,mqtt-transport --all-targets -- -W warnings -D warnings + working-directory: ${{ github.workspace }} + run: env -u VSOMEIP_INSTALL_PATH cargo clippy --features vsomeip-transport,bundled-vsomeip,zenoh-transport,mqtt-transport --all-targets -- -W warnings -D warnings + + lint_fmt: + name: Lint (fmt) + runs-on: ubuntu-22.04 + needs: set-env + + steps: + - uses: actions/checkout@v4 + + - name: Install stable toolchain + run: | + rustup show + rustup component add rustfmt + - name: cargo fmt - working-directory: ${{github.workspace}} + working-directory: ${{ github.workspace }} run: cargo fmt -- --check + lint: + name: Lint + runs-on: ubuntu-22.04 + if: ${{ always() }} + needs: + - lint_base + - lint_feature + - lint_fmt + + steps: + - name: Report lint job results + run: | + echo "lint_base=${{ needs.lint_base.result }}" + echo "lint_feature=${{ needs.lint_feature.result }}" + echo "lint_fmt=${{ needs.lint_fmt.result }}" + + - name: Fail when any lint job failed + if: ${{ needs.lint_base.result != 'success' || needs.lint_feature.result != 'success' || needs.lint_fmt.result != 'success' }} + run: exit 1 + test: name: Test runs-on: ubuntu-22.04 @@ -120,8 +187,14 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable + - name: Cache Rust dependencies and build outputs + uses: swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-${{ github.ref }} + save-if: ${{ github.job == 'lint_feature' }} + - name: Install C++ dependencies - run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev pkg-config libssl-dev - name: Set environment variables run: | @@ -140,42 +213,15 @@ jobs: run: | echo "cache_key: ${{ env.CACHE_KEY }}" - - name: Install dependencies - run: | - cargo install cargo-tarpaulin - name: Show toolchain information working-directory: ${{github.workspace}} run: | rustup toolchain list cargo --version - - name: Run tests and report code coverage + - name: Run tests run: | - # enable nightly features so that we can also include Doctests - LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VSOMEIP_INSTALL_PATH}/lib RUSTC_BOOTSTRAP=1 cargo tarpaulin -o xml -o lcov -o html --doc --tests -- --test-threads 1 - - - name: Upload coverage report (xml) - uses: actions/upload-artifact@v4 - with: - name: Test Coverage Results (xml) - path: cobertura.xml - - - name: Upload coverage report (lcov) - uses: actions/upload-artifact@v4 - with: - name: Test Coverage Results (lcov) - path: lcov.info - - - name: Upload coverage report (html) - uses: actions/upload-artifact@v4 - with: - name: Test Coverage Results (html) - path: tarpaulin-report.html - - # - name: Upload coverage report - # uses: actions/upload-artifact@v4 - # with: - # name: Code coverage report - # path: cobertura.xml + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VSOMEIP_INSTALL_PATH}/lib cargo test --doc + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VSOMEIP_INSTALL_PATH}/lib cargo test --tests -- --test-threads 1 build-docs: name: Build documentation @@ -189,8 +235,14 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Cache Rust dependencies and build outputs + uses: swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-${{ github.ref }} + save-if: ${{ github.job == 'lint_feature' }} + - name: Install C++ dependencies - run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev pkg-config libssl-dev - name: Set environment variables run: | @@ -212,4 +264,3 @@ jobs: - name: Create Documentation for up-linux-streamer working-directory: ${{github.workspace}} run: RUSTDOCFLAGS=-Dwarnings cargo doc -p up-linux-streamer --no-deps - diff --git a/.github/workflows/cargo-timings-profile.yaml b/.github/workflows/cargo-timings-profile.yaml new file mode 100644 index 00000000..32f096bd --- /dev/null +++ b/.github/workflows/cargo-timings-profile.yaml @@ -0,0 +1,218 @@ +# ******************************************************************************** +# Copyright (c) 2026 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# *******************************************************************************/ + +name: Cargo Timings Profile + +env: + VSOMEIP_RELEASE_URL: https://github.com/COVESA/vsomeip/archive/refs/tags/ + VSOMEIP_RELEASE_TAG: 3.4.10.tar.gz + VSOMEIP_SOURCE_PATH: vsomeip-src + VSOMEIP_INSTALL_PATH: vsomeip-install + OPENSSL_NO_VENDOR: "1" + +on: + pull_request: + paths: + - ".github/workflows/cargo-timings-profile.yaml" + workflow_dispatch: + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + set-env: + name: Set environment variables + runs-on: ubuntu-22.04 + + outputs: + arch_specific_cpp_stdlib_path: ${{ steps.set_env.outputs.arch_specific_cpp_stdlib_path }} + generic_cpp_stdlib_path: ${{ steps.set_env.outputs.generic_cpp_stdlib_path }} + + steps: + - uses: actions/checkout@v4 + + - name: Add execute permissions for envsetup + run: chmod +x build/envsetup.sh + + - name: Set stdlib paths dynamically + id: set_env + run: | + source ./build/envsetup.sh highest + echo "arch_specific_cpp_stdlib_path=$ARCH_SPECIFIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT + echo "generic_cpp_stdlib_path=$GENERIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT + + obtain_and_build_vsomeip: + name: obtain_and_build_vsomeip + needs: set-env + runs-on: ubuntu-22.04 + + outputs: + cache_key: ${{ steps.generate_cache_key.outputs.CACHE_KEY }} + + env: + ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} + GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set environment variables + run: | + echo "VSOMEIP_SOURCE_TARBALL=${{ env.VSOMEIP_RELEASE_URL }}${{ env.VSOMEIP_RELEASE_TAG }}" >> $GITHUB_ENV + echo "VSOMEIP_SOURCE_PATH=${{ github.workspace }}/${{ env.VSOMEIP_SOURCE_PATH }}" >> $GITHUB_ENV + echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV + echo "VSOMEIP_SOURCE_PATH_WITH_WILDCARD=${{ github.workspace }}/${{ env.VSOMEIP_SOURCE_PATH }}/*" >> $GITHUB_ENV + + - name: Download tarball + run: wget -O vsomeip-source.tar.gz "$VSOMEIP_SOURCE_TARBALL" + + - name: Create destination directory + run: mkdir -p "$VSOMEIP_SOURCE_PATH" + + - name: Decompress tarball + run: tar --strip-components=1 -xzf vsomeip-source.tar.gz -C "$VSOMEIP_SOURCE_PATH" + + - name: Generate cache key + run: echo "CACHE_KEY=${{ runner.os }}-vsomeip-${{ hashFiles(env.VSOMEIP_SOURCE_PATH_WITH_WILDCARD) }}" >> $GITHUB_ENV + + - name: Set cache key output + id: generate_cache_key + run: echo "CACHE_KEY=${{ env.CACHE_KEY }}" >> $GITHUB_OUTPUT + + - name: Cache vsomeip build + id: cache-vsomeip + uses: actions/cache@v3 + with: + path: ${{ env.VSOMEIP_INSTALL_PATH }} + key: ${{ runner.os }}-vsomeip-${{ hashFiles(env.VSOMEIP_SOURCE_PATH_WITH_WILDCARD) }} + restore-keys: | + ${{ runner.os }}-vsomeip- + + - name: Install dependencies + if: steps.cache-vsomeip.outputs.cache-hit != 'true' + run: sudo apt-get update && sudo apt-get install -y build-essential cmake libboost-all-dev doxygen asciidoc + + - name: Build vsomeip + if: steps.cache-vsomeip.outputs.cache-hit != 'true' + run: | + cmake -B"$VSOMEIP_SOURCE_PATH/build" -DCMAKE_INSTALL_PREFIX="$VSOMEIP_INSTALL_PATH" -DENABLE_SIGNAL_HANDLING=1 "$VSOMEIP_SOURCE_PATH" + cmake --build "$VSOMEIP_SOURCE_PATH/build" --target install + + - name: Save vsomeip build to cache + if: steps.cache-vsomeip.outputs.cache-hit != 'true' + uses: actions/cache@v3 + with: + path: ${{ env.VSOMEIP_INSTALL_PATH }} + key: ${{ runner.os }}-vsomeip-${{ hashFiles(env.VSOMEIP_SOURCE_PATH_WITH_WILDCARD) }} + + bundled-timings: + name: Bundled cargo timings + runs-on: ubuntu-22.04 + needs: set-env + + env: + ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} + GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} + + steps: + - uses: actions/checkout@v4 + + - name: Install C++ dependencies + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev pkg-config libssl-dev + + - name: Set environment variables + run: echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV + + - name: Ensure vsomeip install path exists + run: mkdir -p "${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" + + - name: Install stable toolchain + run: rustup show + + - name: Build bundled base profile with cargo timings + working-directory: ${{ github.workspace }} + run: | + cargo build --timings + mkdir -p timings-artifacts/bundled-base + cp -r target/cargo-timings/. timings-artifacts/bundled-base/ + + - name: Build bundled feature profile with cargo timings + working-directory: ${{ github.workspace }} + run: | + cargo build --features vsomeip-transport,bundled-vsomeip,zenoh-transport,mqtt-transport --timings + mkdir -p timings-artifacts/bundled-feature + cp -r target/cargo-timings/. timings-artifacts/bundled-feature/ + + - name: Upload bundled base timings artifact + uses: actions/upload-artifact@v4 + with: + name: cargo-timings-bundled-base + path: timings-artifacts/bundled-base + if-no-files-found: error + + - name: Upload bundled feature timings artifact + uses: actions/upload-artifact@v4 + with: + name: cargo-timings-bundled-feature + path: timings-artifacts/bundled-feature + if-no-files-found: error + + unbundled-timings: + name: Unbundled cargo timings + runs-on: ubuntu-22.04 + needs: + - set-env + - obtain_and_build_vsomeip + + env: + ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} + GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} + CACHE_KEY: ${{ needs.obtain_and_build_vsomeip.outputs.cache_key }} + + steps: + - uses: actions/checkout@v4 + + - name: Install C++ dependencies + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev pkg-config libssl-dev + + - name: Set environment variables + run: | + echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}/lib" >> $GITHUB_ENV + + - name: Ensure vsomeip install path exists + run: mkdir -p "${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" + + - name: Restore vsomeip build cache + uses: actions/cache@v3 + with: + path: ${{ env.VSOMEIP_INSTALL_PATH }} + key: ${{ env.CACHE_KEY }} + restore-keys: | + ${{ runner.os }}-vsomeip- + + - name: Build unbundled feature profile with cargo timings + working-directory: ${{ github.workspace }} + run: | + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VSOMEIP_INSTALL_PATH}/lib cargo build --features vsomeip-transport,zenoh-transport,mqtt-transport --timings + mkdir -p timings-artifacts/unbundled-feature + cp -r target/cargo-timings/. timings-artifacts/unbundled-feature/ + + - name: Upload unbundled feature timings artifact + uses: actions/upload-artifact@v4 + with: + name: cargo-timings-unbundled-feature + path: timings-artifacts/unbundled-feature + if-no-files-found: error diff --git a/.github/workflows/nightly-coverage.yaml b/.github/workflows/nightly-coverage.yaml new file mode 100644 index 00000000..a7b81dcf --- /dev/null +++ b/.github/workflows/nightly-coverage.yaml @@ -0,0 +1,105 @@ +# ******************************************************************************** +# Copyright (c) 2026 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# *******************************************************************************/ + +name: Nightly Coverage + +env: + VSOMEIP_INSTALL_PATH: vsomeip-install + +on: + schedule: + - cron: "0 3 * * *" + workflow_dispatch: + push: + branches: [ main ] + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + set-env: + name: Set environment variables + runs-on: ubuntu-22.04 + + outputs: + arch_specific_cpp_stdlib_path: ${{ steps.set_env.outputs.arch_specific_cpp_stdlib_path }} + generic_cpp_stdlib_path: ${{ steps.set_env.outputs.generic_cpp_stdlib_path }} + + steps: + - uses: actions/checkout@v4 + + - name: Add execute permissions for envsetup + run: chmod +x build/envsetup.sh + + - name: Set stdlib paths dynamically + id: set_env + run: | + source ./build/envsetup.sh highest + echo "arch_specific_cpp_stdlib_path=$ARCH_SPECIFIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT + echo "generic_cpp_stdlib_path=$GENERIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT + + coverage: + name: Coverage + runs-on: ubuntu-22.04 + needs: set-env + + env: + ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} + GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + + - name: Install C++ dependencies + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev + + - name: Set environment variables + run: | + echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV + + - name: Ensure vsomeip install path exists + run: | + mkdir -p ${{ env.VSOMEIP_INSTALL_PATH }} + + - name: Install dependencies + run: cargo install cargo-tarpaulin + + - name: Show toolchain information + working-directory: ${{github.workspace}} + run: | + rustup toolchain list + cargo --version + + - name: Run tests and report code coverage + run: | + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VSOMEIP_INSTALL_PATH}/lib RUSTC_BOOTSTRAP=1 cargo tarpaulin -o xml -o lcov -o html --doc --tests -- --test-threads 1 + + - name: Upload coverage report (xml) + uses: actions/upload-artifact@v4 + with: + name: Test Coverage Results (xml) + path: cobertura.xml + + - name: Upload coverage report (lcov) + uses: actions/upload-artifact@v4 + with: + name: Test Coverage Results (lcov) + path: lcov.info + + - name: Upload coverage report (html) + uses: actions/upload-artifact@v4 + with: + name: Test Coverage Results (html) + path: tarpaulin-report.html diff --git a/.github/workflows/unbundled-lint-and-test.yaml b/.github/workflows/unbundled-lint-and-test.yaml index 6de4f944..397d32b9 100644 --- a/.github/workflows/unbundled-lint-and-test.yaml +++ b/.github/workflows/unbundled-lint-and-test.yaml @@ -18,6 +18,7 @@ env: VSOMEIP_RELEASE_TAG: 3.4.10.tar.gz VSOMEIP_SOURCE_PATH: vsomeip-src VSOMEIP_INSTALL_PATH: vsomeip-install + OPENSSL_NO_VENDOR: "1" on: push: @@ -160,7 +161,7 @@ jobs: - uses: actions/checkout@v4 - name: Install C++ dependencies - run: sudo apt-get install -y build-essential cmake libboost-all-dev + run: sudo apt-get install -y build-essential libboost-all-dev libssl-dev - name: Set environment variables run: | @@ -192,21 +193,18 @@ jobs: rustup show rustup component add rustfmt clippy - - name: Build the project without Zenoh & vsomeip transports - working-directory: ${{github.workspace}} - run: cargo build - - name: cargo clippy without Zenoh & vsomeip transports - working-directory: ${{github.workspace}} - run: cargo clippy --all-targets -- -W warnings -D warnings + - name: Cache Rust dependencies and build outputs + uses: swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-${{ github.ref }} + save-if: ${{ github.job == 'lint' }} + - name: Build the project with Zenoh & vsomeip transports (and thus streamer references) working-directory: ${{github.workspace}} run: cargo build --features vsomeip-transport,zenoh-transport,mqtt-transport - name: cargo clippy with Zenoh & vsomeip transports (and thus streamer references) working-directory: ${{github.workspace}} run: cargo clippy --features vsomeip-transport,zenoh-transport,mqtt-transport --all-targets -- -W warnings -D warnings - - name: cargo fmt - working-directory: ${{github.workspace}} - run: cargo fmt -- --check test: name: Test @@ -226,7 +224,7 @@ jobs: - name: Install C++ dependencies if: steps.cache-vsomeip.outputs.cache-hit != 'true' - run: sudo apt-get install -y build-essential cmake libboost-all-dev + run: sudo apt-get install -y build-essential cmake libboost-all-dev pkg-config libssl-dev - name: Set environment variables run: | @@ -255,42 +253,21 @@ jobs: restore-keys: | ${{ runner.os }}-vsomeip- - - name: Install dependencies - run: | - cargo install cargo-tarpaulin + - name: Cache Rust dependencies and build outputs + uses: swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-${{ github.ref }} + save-if: ${{ github.job == 'lint' }} + - name: Show toolchain information working-directory: ${{github.workspace}} run: | rustup toolchain list cargo --version - - name: Run tests and report code coverage + - name: Run tests run: | - # enable nightly features so that we can also include Doctests - LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VSOMEIP_INSTALL_PATH}/lib RUSTC_BOOTSTRAP=1 cargo tarpaulin --no-default-features -o xml -o lcov -o html --doc --tests -- --test-threads 1 - - - name: Upload coverage report (xml) - uses: actions/upload-artifact@v4 - with: - name: Test Coverage Results (xml) - path: cobertura.xml - - - name: Upload coverage report (lcov) - uses: actions/upload-artifact@v4 - with: - name: Test Coverage Results (lcov) - path: lcov.info - - - name: Upload coverage report (html) - uses: actions/upload-artifact@v4 - with: - name: Test Coverage Results (html) - path: tarpaulin-report.html - - # - name: Upload coverage report - # uses: actions/upload-artifact@v4 - # with: - # name: Code coverage report - # path: cobertura.xml + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VSOMEIP_INSTALL_PATH}/lib cargo test --no-default-features --doc + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VSOMEIP_INSTALL_PATH}/lib cargo test --no-default-features --tests -- --test-threads 1 build-docs: name: Build documentation @@ -307,7 +284,7 @@ jobs: - uses: actions/checkout@v4 - name: Install C++ dependencies - run: sudo apt-get install -y build-essential cmake libboost-all-dev + run: sudo apt-get install -y build-essential cmake libboost-all-dev pkg-config libssl-dev - name: Set environment variables run: | @@ -334,6 +311,12 @@ jobs: restore-keys: | ${{ runner.os }}-vsomeip- + - name: Cache Rust dependencies and build outputs + uses: swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-${{ github.ref }} + save-if: ${{ github.job == 'lint' }} + - name: Create Documentation for up-streamer working-directory: ${{github.workspace}} run: RUSTDOCFLAGS=-Dwarnings cargo doc -p up-streamer --no-deps --no-default-features