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.4 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-4: 49 name: thread-1-4-${{ matrix.compiler.c }}-${{ matrix.arch }} 50 runs-on: ubuntu-22.04 51 env: 52 CFLAGS: -${{ matrix.arch }} 53 CXXFLAGS: -${{ matrix.arch }} 54 LDFLAGS: -${{ matrix.arch }} 55 COVERAGE: 1 56 THREAD_VERSION: 1.4 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", cxx: "clang++", gcov: "llvm"}] 66 arch: ["m32", "m64"] 67 steps: 68 - name: Harden Runner 69 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 70 with: 71 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 72 73 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 74 with: 75 submodules: true 76 - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 77 with: 78 python-version: '3.12' 79 cache: pip 80 - name: Bootstrap 81 run: | 82 sudo dpkg --add-architecture i386 83 sudo apt-get update 84 sudo apt-get --no-install-recommends install -y ninja-build llvm lcov 85 sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386 86 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 87 - name: Build 88 run: | 89 ./script/test build 90 - name: Run 91 run: | 92 ulimit -c unlimited 93 ./script/test prepare_coredump_upload 94 ./script/test unit 95 ./script/test cert_suite tests/scripts/thread-cert/v1_2_* 96 - name: Check Crash 97 if: ${{ failure() }} 98 run: | 99 CRASHED=$(./script/test check_crash | tail -1) 100 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 101 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 102 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 103 if: ${{ failure() }} 104 with: 105 name: thread-1-4-${{ matrix.compiler.c }}-${{ matrix.arch }}-pcaps 106 path: "*.pcap" 107 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 108 if: ${{ failure() && env.CRASHED == '1' }} 109 with: 110 name: core-packet-verification-thread-1-4 111 path: | 112 ./ot-core-dump/* 113 - name: Generate Coverage 114 run: | 115 ./script/test generate_coverage "${{ matrix.compiler.gcov }}" 116 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 117 with: 118 name: cov-thread-1-4-${{ matrix.compiler.c }}-${{ matrix.arch }} 119 path: tmp/coverage.info 120 retention-days: 1 121 122 packet-verification-low-power: 123 runs-on: ubuntu-24.04 124 env: 125 REFERENCE_DEVICE: 1 126 VIRTUAL_TIME: 1 127 COVERAGE: 1 128 PACKET_VERIFICATION: 1 129 THREAD_VERSION: 1.4 130 MAC_FILTER: 1 131 INTER_OP: 1 132 INTER_OP_BBR: 0 133 steps: 134 - name: Harden Runner 135 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 136 with: 137 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 138 139 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 140 with: 141 submodules: true 142 - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 143 with: 144 python-version: '3.12' 145 cache: pip 146 - name: Bootstrap 147 run: | 148 sudo apt-get update 149 sudo apt-get --no-install-recommends install -y ninja-build lcov 150 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 151 - name: Build 152 run: | 153 ./script/test build 154 - name: Build with OT_CSL_RECEIVER_LOCAL_TIME_SYNC 155 run: | 156 OT_BUILDDIR="${PWD}/build_csl_receiver_local_time_sync" OT_OPTIONS="-DOT_CSL_RECEIVER_LOCAL_TIME_SYNC=ON" ./script/test build 157 - name: Get Thread-Wireshark 158 run: | 159 ./script/test get_thread_wireshark 160 - name: Run 161 run: | 162 ulimit -c unlimited 163 ./script/test prepare_coredump_upload 164 for i in {1..10} 165 do 166 ./script/test cert_suite ./tests/scripts/thread-cert/v1_2_LowPower*.py 167 done 168 - name: Run with OT_CSL_RECEIVER_LOCAL_TIME_SYNC 169 run: | 170 OT_BUILDDIR="${PWD}/build_csl_receiver_local_time_sync" ./script/test cert_suite ./tests/scripts/thread-cert/v1_2_LowPower*.py 171 - name: Check Crash 172 if: ${{ failure() }} 173 run: | 174 CRASHED=$(./script/test check_crash | tail -1) 175 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 176 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 177 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 178 if: ${{ failure() }} 179 with: 180 name: packet-verification-low-power-pcaps 181 path: | 182 *.pcap 183 *.json 184 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 185 if: ${{ failure() && env.CRASHED == '1' }} 186 with: 187 name: core-packet-verification-low-power 188 path: | 189 ./ot-core-dump/* 190 - name: Generate Coverage 191 run: | 192 ./script/test generate_coverage gcc 193 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 194 with: 195 name: cov-packet-verification-low-power 196 path: tmp/coverage.info 197 retention-days: 1 198 199 packet-verification-1-1-on-1-4: 200 runs-on: ubuntu-24.04 201 env: 202 REFERENCE_DEVICE: 1 203 VIRTUAL_TIME: 1 204 PACKET_VERIFICATION: 1 205 THREAD_VERSION: 1.4 206 INTER_OP_BBR: 1 207 MULTIPLY: 3 208 steps: 209 - name: Harden Runner 210 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 211 with: 212 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 213 214 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 215 with: 216 submodules: true 217 - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 218 with: 219 python-version: '3.12' 220 cache: pip 221 - name: Bootstrap 222 run: | 223 sudo apt-get update 224 sudo apt-get --no-install-recommends install -y ninja-build lcov 225 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 226 - name: Build 227 run: | 228 ./script/test build 229 - name: Get Thread-Wireshark 230 run: | 231 ./script/test get_thread_wireshark 232 - name: Run 233 run: | 234 ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py 235 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 236 if: ${{ failure() }} 237 with: 238 name: packet-verification-1.1-on-1.4-pcaps 239 path: | 240 *.pcap 241 *.json 242 - name: Generate Coverage 243 run: | 244 ./script/test generate_coverage gcc 245 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 246 with: 247 name: cov-packet-verification-1-1-on-1-4 248 path: tmp/coverage.info 249 retention-days: 1 250 251 channel-manager-csl: 252 runs-on: ubuntu-24.04 253 env: 254 CFLAGS: -m32 255 CXXFLAGS: -m32 256 LDFLAGS: -m32 257 COVERAGE: 1 258 THREAD_VERSION: 1.4 259 VIRTUAL_TIME: 1 260 steps: 261 - name: Harden Runner 262 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 263 with: 264 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 265 266 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 267 with: 268 submodules: true 269 - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 270 with: 271 python-version: '3.12' 272 cache: pip 273 - name: Bootstrap 274 run: | 275 sudo apt-get update 276 sudo apt-get --no-install-recommends install -y g++-multilib lcov ninja-build 277 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 278 - name: Build 279 run: | 280 OT_OPTIONS="-DOT_CHANNEL_MANAGER_CSL=ON" ./script/test build 281 - name: Run 282 run: | 283 ulimit -c unlimited 284 ./script/test cert_suite ./tests/scripts/thread-cert/addon_test_channel_manager_autocsl*.py 285 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 286 if: ${{ failure() }} 287 with: 288 name: channel-manager-csl 289 path: ot_testing 290 - name: Generate Coverage 291 run: | 292 ./script/test generate_coverage gcc 293 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 294 with: 295 name: cov-channel-manager-csl 296 path: tmp/coverage.info 297 retention-days: 1 298 299 expects: 300 runs-on: ubuntu-24.04 301 env: 302 COVERAGE: 1 303 THREAD_VERSION: 1.4 304 VIRTUAL_TIME: 0 305 steps: 306 - name: Harden Runner 307 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 308 with: 309 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 310 311 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 312 with: 313 submodules: true 314 - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 315 with: 316 python-version: '3.12' 317 cache: pip 318 - name: Bootstrap 319 run: | 320 sudo apt-get --no-install-recommends install -y expect ninja-build lcov 321 sudo bash script/install_socat 322 pip install bleak 'cryptography==43.0.0' 323 - name: Run RCP Mode 324 run: | 325 ulimit -c unlimited 326 ./script/test prepare_coredump_upload 327 OT_OPTIONS=-DOT_READLINE=OFF OT_NODE_TYPE=rcp ./script/test build expect 328 - name: Check Crash 329 if: ${{ failure() }} 330 run: | 331 CRASHED=$(./script/test check_crash | tail -1) 332 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 333 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 334 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 335 if: ${{ failure() && env.CRASHED == '1' }} 336 with: 337 name: core-expect-1-4 338 path: | 339 ./ot-core-dump/* 340 - name: Generate Coverage 341 run: | 342 ./script/test generate_coverage gcc 343 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 344 with: 345 name: cov-expects 346 path: tmp/coverage.info 347 retention-days: 1 348 349 thread-1-4-posix: 350 runs-on: ubuntu-22.04 351 env: 352 COVERAGE: 1 353 PYTHONUNBUFFERED: 1 354 READLINE: readline 355 THREAD_VERSION: 1.4 356 OT_NODE_TYPE: rcp 357 USE_MTD: 1 358 VIRTUAL_TIME: 1 359 INTER_OP: 1 360 steps: 361 - name: Harden Runner 362 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 363 with: 364 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 365 366 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 367 with: 368 submodules: true 369 - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 370 with: 371 python-version: '3.12' 372 cache: pip 373 - name: Bootstrap 374 run: | 375 sudo apt-get update 376 sudo apt-get --no-install-recommends install -y libreadline6-dev ninja-build llvm lcov 377 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 378 - name: Build 379 run: | 380 ./script/test build 381 - name: Run 382 run: | 383 ulimit -c unlimited 384 ./script/test prepare_coredump_upload 385 ./script/test cert tests/scripts/thread-cert/v1_2_LowPower_5_3_01_SSEDAttachment.py 386 ./script/test cert tests/scripts/thread-cert/v1_2_LowPower_6_1_07_PreferringARouterOverAReed.py 387 ./script/test cert tests/scripts/thread-cert/v1_2_router_5_1_1.py 388 ./script/test cert tests/scripts/thread-cert/v1_2_test_csl_transmission.py 389 ./script/test cert tests/scripts/thread-cert/v1_2_test_enhanced_frame_pending.py 390 ./script/test cert tests/scripts/thread-cert/v1_2_test_parent_selection.py 391 - name: Check Crash 392 if: ${{ failure() }} 393 run: | 394 CRASHED=$(./script/test check_crash | tail -1) 395 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 396 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 397 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 398 if: ${{ failure() }} 399 with: 400 name: thread-1-4-posix-pcaps 401 path: "*.pcap" 402 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 403 if: ${{ failure() && env.CRASHED == '1' }} 404 with: 405 name: core-thread-1-4-posix 406 path: | 407 ./ot-core-dump/* 408 - name: Generate Coverage 409 run: | 410 ./script/test generate_coverage gcc 411 - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 412 with: 413 name: cov-thread-1-4-posix 414 path: tmp/coverage.info 415 retention-days: 1 416 417 upload-coverage: 418 needs: 419 - thread-1-4 420 - packet-verification-low-power 421 - packet-verification-1-1-on-1-4 422 - expects 423 - thread-1-4-posix 424 runs-on: ubuntu-22.04 425 steps: 426 - name: Harden Runner 427 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 428 with: 429 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 430 431 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 432 with: 433 submodules: true 434 - name: Bootstrap 435 run: | 436 sudo apt-get --no-install-recommends install -y lcov 437 - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 438 with: 439 path: coverage/ 440 pattern: cov-* 441 merge-multiple: true 442 - name: Combine Coverage 443 run: | 444 script/test combine_coverage 445 - name: Upload Coverage 446 uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0 447 env: 448 CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 449 with: 450 files: final.info 451 fail_ci_if_error: true 452