|
| 1 | +# ******************************************************************************** |
| 2 | +# Copyright (c) 2024 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# *******************************************************************************/ |
| 13 | + |
| 14 | +name: Lint and Test - Bundled |
| 15 | + |
| 16 | +env: |
| 17 | + VSOMEIP_INSTALL_PATH: vsomeip-install |
| 18 | + |
| 19 | +on: |
| 20 | + push: |
| 21 | + branches: [ main ] |
| 22 | + pull_request: |
| 23 | + paths: |
| 24 | + - ".github/**" |
| 25 | + - "**/src/**" |
| 26 | + - "**/Cargo.*" |
| 27 | + workflow_call: |
| 28 | + workflow_dispatch: |
| 29 | + |
| 30 | +concurrency: |
| 31 | + group: ${{ github.ref }}-${{ github.workflow }} |
| 32 | + cancel-in-progress: true |
| 33 | + |
| 34 | +jobs: |
| 35 | + |
| 36 | + set-env: |
| 37 | + name: Set environment variables |
| 38 | + runs-on: ubuntu-22.04 |
| 39 | + |
| 40 | + outputs: |
| 41 | + arch_specific_cpp_stdlib_path: ${{ steps.set_env.outputs.arch_specific_cpp_stdlib_path }} |
| 42 | + generic_cpp_stdlib_path: ${{ steps.set_env.outputs.generic_cpp_stdlib_path }} |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Add execute permissions for envsetup |
| 48 | + run: chmod +x build/envsetup.sh |
| 49 | + |
| 50 | + - name: Set stdlib paths dynamically |
| 51 | + id: set_env |
| 52 | + run: | |
| 53 | + source ./build/envsetup.sh highest |
| 54 | + echo "arch_specific_cpp_stdlib_path=$ARCH_SPECIFIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT |
| 55 | + echo "generic_cpp_stdlib_path=$GENERIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT |
| 56 | +
|
| 57 | + lint: |
| 58 | + name: Lint |
| 59 | + runs-on: ubuntu-22.04 |
| 60 | + needs: set-env |
| 61 | + |
| 62 | + env: |
| 63 | + ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} |
| 64 | + GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} |
| 65 | + |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + |
| 69 | + - name: Install C++ dependencies |
| 70 | + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev |
| 71 | + |
| 72 | + - name: Set environment variables |
| 73 | + run: | |
| 74 | + echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV |
| 75 | + env |
| 76 | +
|
| 77 | + - name: Print environment variables for debugging |
| 78 | + run: | |
| 79 | + echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}" |
| 80 | + echo "GENERIC_CPP_STDLIB_PATH: ${{ env.GENERIC_CPP_STDLIB_PATH }}" |
| 81 | + echo "ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ env.ARCH_SPECIFIC_CPP_STDLIB_PATH }}" |
| 82 | + env |
| 83 | +
|
| 84 | + - name: Ensure vsomeip install path exists |
| 85 | + run: | |
| 86 | + mkdir -p ${{ env.VSOMEIP_INSTALL_PATH }} |
| 87 | + ls -l |
| 88 | +
|
| 89 | + - name: Install stable toolchain |
| 90 | + run: | |
| 91 | + rustup show |
| 92 | + rustup component add rustfmt clippy |
| 93 | +
|
| 94 | + - name: Build the project without Zenoh & vsomeip transports |
| 95 | + working-directory: ${{github.workspace}} |
| 96 | + run: cargo build |
| 97 | + - name: cargo clippy without Zenoh & vsomeip transports |
| 98 | + working-directory: ${{github.workspace}} |
| 99 | + run: cargo clippy --all-targets -- -W warnings -D warnings |
| 100 | + - name: Build the project with Zenoh & vsomeip transports (and thus streamer references) |
| 101 | + working-directory: ${{github.workspace}} |
| 102 | + run: cargo build --features vsomeip-transport,bundled-vsomeip,zenoh-transport,mqtt-transport |
| 103 | + - name: cargo clippy with Zenoh & vsomeip transports (and thus streamer references) |
| 104 | + working-directory: ${{github.workspace}} |
| 105 | + run: cargo clippy --features vsomeip-transport,bundled-vsomeip,zenoh-transport,mqtt-transport --all-targets -- -W warnings -D warnings |
| 106 | + - name: cargo fmt |
| 107 | + working-directory: ${{github.workspace}} |
| 108 | + run: cargo fmt -- --check |
| 109 | + |
| 110 | + test: |
| 111 | + name: Test |
| 112 | + runs-on: ubuntu-22.04 |
| 113 | + needs: set-env |
| 114 | + |
| 115 | + env: |
| 116 | + ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} |
| 117 | + GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} |
| 118 | + |
| 119 | + steps: |
| 120 | + - uses: actions/checkout@v4 |
| 121 | + - uses: dtolnay/rust-toolchain@stable |
| 122 | + |
| 123 | + - name: Install C++ dependencies |
| 124 | + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev |
| 125 | + |
| 126 | + - name: Set environment variables |
| 127 | + run: | |
| 128 | + echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV |
| 129 | +
|
| 130 | + - name: Print environment variables for debugging |
| 131 | + run: | |
| 132 | + echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}" |
| 133 | +
|
| 134 | + - name: Ensure vsomeip install path exists |
| 135 | + run: | |
| 136 | + mkdir -p ${{ env.VSOMEIP_INSTALL_PATH }} |
| 137 | + ls -l |
| 138 | +
|
| 139 | + - name: Print cache_key |
| 140 | + run: | |
| 141 | + echo "cache_key: ${{ env.CACHE_KEY }}" |
| 142 | +
|
| 143 | + - name: Install dependencies |
| 144 | + run: | |
| 145 | + cargo install cargo-tarpaulin |
| 146 | + - name: Show toolchain information |
| 147 | + working-directory: ${{github.workspace}} |
| 148 | + run: | |
| 149 | + rustup toolchain list |
| 150 | + cargo --version |
| 151 | + - name: Run tests and report code coverage |
| 152 | + run: | |
| 153 | + # enable nightly features so that we can also include Doctests |
| 154 | + 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 |
| 155 | +
|
| 156 | + - name: Upload coverage report (xml) |
| 157 | + uses: actions/upload-artifact@v4 |
| 158 | + with: |
| 159 | + name: Test Coverage Results (xml) |
| 160 | + path: cobertura.xml |
| 161 | + |
| 162 | + - name: Upload coverage report (lcov) |
| 163 | + uses: actions/upload-artifact@v4 |
| 164 | + with: |
| 165 | + name: Test Coverage Results (lcov) |
| 166 | + path: lcov.info |
| 167 | + |
| 168 | + - name: Upload coverage report (html) |
| 169 | + uses: actions/upload-artifact@v4 |
| 170 | + with: |
| 171 | + name: Test Coverage Results (html) |
| 172 | + path: tarpaulin-report.html |
| 173 | + |
| 174 | + # - name: Upload coverage report |
| 175 | + # uses: actions/upload-artifact@v4 |
| 176 | + # with: |
| 177 | + # name: Code coverage report |
| 178 | + # path: cobertura.xml |
| 179 | + |
| 180 | + build-docs: |
| 181 | + name: Build documentation |
| 182 | + runs-on: ubuntu-22.04 |
| 183 | + needs: set-env |
| 184 | + |
| 185 | + env: |
| 186 | + ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }} |
| 187 | + GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }} |
| 188 | + |
| 189 | + steps: |
| 190 | + - uses: actions/checkout@v4 |
| 191 | + |
| 192 | + - name: Install C++ dependencies |
| 193 | + run: sudo apt-get install -y build-essential cmake libboost-all-dev libclang-dev |
| 194 | + |
| 195 | + - name: Set environment variables |
| 196 | + run: | |
| 197 | + echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV |
| 198 | +
|
| 199 | + - name: Print environment variables for debugging |
| 200 | + run: | |
| 201 | + echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}" |
| 202 | +
|
| 203 | + - name: Ensure vsomeip install path exists |
| 204 | + run: | |
| 205 | + mkdir -p ${{ env.VSOMEIP_INSTALL_PATH }} |
| 206 | + ls -l |
| 207 | +
|
| 208 | + - name: Create Documentation for up-streamer |
| 209 | + working-directory: ${{github.workspace}} |
| 210 | + run: RUSTDOCFLAGS=-Dwarnings cargo doc -p up-streamer --no-deps |
| 211 | + |
| 212 | + - name: Create Documentation for up-linux-streamer |
| 213 | + working-directory: ${{github.workspace}} |
| 214 | + run: RUSTDOCFLAGS=-Dwarnings cargo doc -p up-linux-streamer --no-deps |
| 215 | + |
0 commit comments