1# 2# Copyright (c) 2020, The OpenThread Authors. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. 9# 2. Redistributions in binary form must reproduce the above copyright 10# notice, this list of conditions and the following disclaimer in the 11# documentation and/or other materials provided with the distribution. 12# 3. Neither the name of the copyright holder nor the 13# names of its contributors may be used to endorse or promote products 14# derived from this software without specific prior written permission. 15# 16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26# POSSIBILITY OF SUCH DAMAGE. 27# 28 29name: Simulation 1.3 30 31on: 32 push: 33 branches-ignore: 34 - 'dependabot/**' 35 pull_request: 36 branches: 37 - 'main' 38 39concurrency: 40 group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }} 41 cancel-in-progress: true 42 43permissions: # added using https://github.com/step-security/secure-workflows 44 contents: read 45 46jobs: 47 48 thread-1-3: 49 name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }} 50 runs-on: ubuntu-20.04 51 env: 52 CFLAGS: -${{ matrix.arch }} 53 CXXFLAGS: -${{ matrix.arch }} 54 LDFLAGS: -${{ matrix.arch }} 55 COVERAGE: 1 56 THREAD_VERSION: 1.3 57 VIRTUAL_TIME: 1 58 INTER_OP: 1 59 INTER_OP_BBR: 1 60 CC: ${{ matrix.compiler.c }} 61 CXX: ${{ matrix.compiler.cxx }} 62 strategy: 63 fail-fast: false 64 matrix: 65 compiler: [{c: "gcc", cxx: "g++", gcov: "gcc"}, { c: "clang-10", cxx: "clang++-10", gcov: "llvm"}] 66 arch: ["m32", "m64"] 67 steps: 68 - name: Harden Runner 69 uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 70 with: 71 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 72 73 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 74 with: 75 submodules: true 76 - name: Bootstrap 77 run: | 78 sudo dpkg --add-architecture i386 79 sudo apt-get update 80 sudo apt-get --no-install-recommends install -y clang-10 clang++-10 ninja-build python3-setuptools python3-wheel llvm lcov 81 sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386 82 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 83 - name: Build 84 run: | 85 ./script/test build 86 - name: Run 87 run: | 88 ulimit -c unlimited 89 ./script/test prepare_coredump_upload 90 ./script/test unit 91 ./script/test cert_suite tests/scripts/thread-cert/v1_2_* 92 - name: Check Crash 93 if: ${{ failure() }} 94 run: | 95 CRASHED=$(./script/test check_crash | tail -1) 96 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 97 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 98 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 99 if: ${{ failure() }} 100 with: 101 name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}-pcaps 102 path: "*.pcap" 103 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 104 if: ${{ failure() && env.CRASHED == '1' }} 105 with: 106 name: core-packet-verification-thread-1-3 107 path: | 108 ./ot-core-dump/* 109 - name: Generate Coverage 110 run: | 111 ./script/test generate_coverage "${{ matrix.compiler.gcov }}" 112 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 113 with: 114 name: cov-thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }} 115 path: tmp/coverage.info 116 retention-days: 1 117 118 packet-verification-low-power: 119 runs-on: ubuntu-20.04 120 env: 121 REFERENCE_DEVICE: 1 122 VIRTUAL_TIME: 1 123 COVERAGE: 1 124 PACKET_VERIFICATION: 1 125 THREAD_VERSION: 1.3 126 MAC_FILTER: 1 127 INTER_OP: 1 128 INTER_OP_BBR: 0 129 steps: 130 - name: Harden Runner 131 uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 132 with: 133 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 134 135 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 136 with: 137 submodules: true 138 - name: Bootstrap 139 run: | 140 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 141 sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel ninja-build lcov 142 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 143 - name: Build 144 run: | 145 ./script/test build 146 - name: Build with OT_CSL_RECEIVER_LOCAL_TIME_SYNC 147 run: | 148 OT_BUILDDIR="${PWD}/build_csl_receiver_local_time_sync" OT_OPTIONS="-DOT_CSL_RECEIVER_LOCAL_TIME_SYNC=ON" ./script/test build 149 - name: Get Thread-Wireshark 150 run: | 151 ./script/test get_thread_wireshark 152 - name: Run 153 run: | 154 ulimit -c unlimited 155 ./script/test prepare_coredump_upload 156 for i in {1..10} 157 do 158 ./script/test cert_suite ./tests/scripts/thread-cert/v1_2_LowPower*.py 159 done 160 - name: Run with OT_CSL_RECEIVER_LOCAL_TIME_SYNC 161 run: | 162 OT_BUILDDIR="${PWD}/build_csl_receiver_local_time_sync" ./script/test cert_suite ./tests/scripts/thread-cert/v1_2_LowPower*.py 163 - name: Check Crash 164 if: ${{ failure() }} 165 run: | 166 CRASHED=$(./script/test check_crash | tail -1) 167 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 168 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 169 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 170 if: ${{ failure() }} 171 with: 172 name: packet-verification-low-power-pcaps 173 path: | 174 *.pcap 175 *.json 176 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 177 if: ${{ failure() && env.CRASHED == '1' }} 178 with: 179 name: core-packet-verification-low-power 180 path: | 181 ./ot-core-dump/* 182 - name: Generate Coverage 183 run: | 184 ./script/test generate_coverage gcc 185 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 186 with: 187 name: cov-packet-verification-low-power 188 path: tmp/coverage.info 189 retention-days: 1 190 191 packet-verification-1-1-on-1-3: 192 runs-on: ubuntu-20.04 193 env: 194 REFERENCE_DEVICE: 1 195 VIRTUAL_TIME: 1 196 PACKET_VERIFICATION: 1 197 THREAD_VERSION: 1.3 198 INTER_OP_BBR: 1 199 MULTIPLY: 3 200 steps: 201 - name: Harden Runner 202 uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 203 with: 204 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 205 206 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 207 with: 208 submodules: true 209 - name: Bootstrap 210 run: | 211 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 212 sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel ninja-build lcov 213 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 214 - name: Build 215 run: | 216 ./script/test build 217 - name: Get Thread-Wireshark 218 run: | 219 ./script/test get_thread_wireshark 220 - name: Run 221 run: | 222 ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py 223 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 224 if: ${{ failure() }} 225 with: 226 name: packet-verification-1.1-on-1.3-pcaps 227 path: | 228 *.pcap 229 *.json 230 - name: Generate Coverage 231 run: | 232 ./script/test generate_coverage gcc 233 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 234 with: 235 name: cov-packet-verification-1-1-on-1-3 236 path: tmp/coverage.info 237 retention-days: 1 238 239 channel-manager-csl: 240 runs-on: ubuntu-20.04 241 env: 242 CFLAGS: -m32 243 CXXFLAGS: -m32 244 LDFLAGS: -m32 245 COVERAGE: 1 246 THREAD_VERSION: 1.3 247 VIRTUAL_TIME: 1 248 INTER_OP: 1 249 INTER_OP_BBR: 1 250 ADDON_FEAT_1_2: 1 251 steps: 252 - name: Harden Runner 253 uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 254 with: 255 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 256 257 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 258 with: 259 submodules: true 260 - name: Bootstrap 261 run: | 262 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 263 sudo apt-get --no-install-recommends install -y g++-multilib lcov ninja-build python3-setuptools python3-wheel 264 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 265 - name: Build 266 run: | 267 OT_OPTIONS="-DOT_CHANNEL_MANAGER_CSL=ON" ./script/test build 268 - name: Run 269 run: | 270 ulimit -c unlimited 271 ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py 272 ./script/test cert_suite ./tests/scripts/thread-cert/test_*.py 273 ./script/test cert_suite ./tests/scripts/thread-cert/v1_2_*.py 274 ./script/test cert_suite ./tests/scripts/thread-cert/addon_test_channel_manager_autocsl*.py 275 - uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0 276 if: ${{ failure() }} 277 with: 278 name: channel-manager-csl 279 path: ot_testing 280 - name: Generate Coverage 281 run: | 282 ./script/test generate_coverage gcc 283 - uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0 284 with: 285 name: cov-channel-manager-csl 286 path: tmp/coverage.info 287 retention-days: 1 288 289 expects: 290 runs-on: ubuntu-20.04 291 env: 292 COVERAGE: 1 293 THREAD_VERSION: 1.3 294 VIRTUAL_TIME: 0 295 steps: 296 - name: Harden Runner 297 uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 298 with: 299 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 300 301 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 302 with: 303 submodules: true 304 - name: Bootstrap 305 run: | 306 sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat 307 pip install bleak 308 - name: Run RCP Mode 309 run: | 310 ulimit -c unlimited 311 ./script/test prepare_coredump_upload 312 OT_OPTIONS=-DOT_READLINE=OFF OT_NODE_TYPE=rcp ./script/test build expect 313 - name: Check Crash 314 if: ${{ failure() }} 315 run: | 316 CRASHED=$(./script/test check_crash | tail -1) 317 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 318 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 319 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 320 if: ${{ failure() && env.CRASHED == '1' }} 321 with: 322 name: core-expect-1-3 323 path: | 324 ./ot-core-dump/* 325 - name: Generate Coverage 326 run: | 327 ./script/test generate_coverage gcc 328 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 329 with: 330 name: cov-expects 331 path: tmp/coverage.info 332 retention-days: 1 333 334 thread-1-3-posix: 335 runs-on: ubuntu-20.04 336 env: 337 COVERAGE: 1 338 PYTHONUNBUFFERED: 1 339 READLINE: readline 340 THREAD_VERSION: 1.3 341 OT_NODE_TYPE: rcp 342 USE_MTD: 1 343 VIRTUAL_TIME: 1 344 INTER_OP: 1 345 steps: 346 - name: Harden Runner 347 uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 348 with: 349 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 350 351 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 352 with: 353 submodules: true 354 - name: Bootstrap 355 run: | 356 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 357 sudo apt-get --no-install-recommends install -y libreadline6-dev g++-multilib ninja-build python3-setuptools python3-wheel llvm lcov 358 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 359 - name: Build 360 run: | 361 ./script/test build 362 - name: Run 363 run: | 364 ulimit -c unlimited 365 ./script/test prepare_coredump_upload 366 ./script/test cert tests/scripts/thread-cert/v1_2_LowPower_5_3_01_SSEDAttachment.py 367 ./script/test cert tests/scripts/thread-cert/v1_2_LowPower_6_1_07_PreferringARouterOverAReed.py 368 ./script/test cert tests/scripts/thread-cert/v1_2_router_5_1_1.py 369 ./script/test cert tests/scripts/thread-cert/v1_2_test_csl_transmission.py 370 ./script/test cert tests/scripts/thread-cert/v1_2_test_enhanced_frame_pending.py 371 ./script/test cert tests/scripts/thread-cert/v1_2_test_parent_selection.py 372 - name: Check Crash 373 if: ${{ failure() }} 374 run: | 375 CRASHED=$(./script/test check_crash | tail -1) 376 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 377 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 378 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 379 if: ${{ failure() }} 380 with: 381 name: thread-1-3-posix-pcaps 382 path: "*.pcap" 383 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 384 if: ${{ failure() && env.CRASHED == '1' }} 385 with: 386 name: core-thread-1-3-posix 387 path: | 388 ./ot-core-dump/* 389 - name: Generate Coverage 390 run: | 391 ./script/test generate_coverage gcc 392 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 393 with: 394 name: cov-thread-1-3-posix 395 path: tmp/coverage.info 396 retention-days: 1 397 398 upload-coverage: 399 needs: 400 - thread-1-3 401 - packet-verification-low-power 402 - packet-verification-1-1-on-1-3 403 - expects 404 - thread-1-3-posix 405 runs-on: ubuntu-20.04 406 steps: 407 - name: Harden Runner 408 uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 409 with: 410 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 411 412 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 413 with: 414 submodules: true 415 - name: Bootstrap 416 run: | 417 sudo apt-get --no-install-recommends install -y lcov 418 - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 419 with: 420 path: coverage/ 421 pattern: cov-* 422 merge-multiple: true 423 - name: Combine Coverage 424 run: | 425 script/test combine_coverage 426 - name: Upload Coverage 427 uses: codecov/codecov-action@0cfda1dd0a4ad9efc75517f399d859cd1ea4ced1 # v4.0.2 428 env: 429 CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 430 with: 431 files: final.info 432 fail_ci_if_error: true 433