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.1 30 31on: [push, pull_request] 32 33jobs: 34 35 cancel-previous-runs: 36 runs-on: ubuntu-20.04 37 steps: 38 - uses: rokroskar/workflow-run-cleanup-action@master 39 env: 40 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 41 if: "github.ref != 'refs/heads/main'" 42 43 distcheck: 44 runs-on: ubuntu-20.04 45 env: 46 CC: clang 47 CXX: clang++ 48 REFERENCE_DEVICE: 1 49 THREAD_VERSION: 1.1 50 VIRTUAL_TIME: 1 51 steps: 52 - uses: actions/checkout@v2 53 with: 54 submodules: true 55 - name: Bootstrap 56 run: | 57 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 58 sudo apt-get --no-install-recommends install -y llvm-runtime python3-setuptools python3-wheel 59 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 60 - name: Run 61 run: | 62 export ASAN_SYMBOLIZER_PATH=`which llvm-symbolizer` 63 export ASAN_OPTIONS=symbolize=1 64 export DISTCHECK_CONFIGURE_FLAGS= CPPFLAGS=-DOPENTHREAD_SIMULATION_VIRTUAL_TIME=1 65 export DISTCHECK_BUILD=1 66 ./bootstrap 67 VERBOSE=1 make -f examples/Makefile-simulation distcheck 68 69 packet-verification: 70 runs-on: ubuntu-20.04 71 env: 72 PACKET_VERIFICATION: 1 73 REFERENCE_DEVICE: 1 74 THREAD_VERSION: 1.1 75 VIRTUAL_TIME: 1 76 MULTIPLY: 3 77 steps: 78 - uses: actions/checkout@v2 79 with: 80 submodules: true 81 - name: Bootstrap 82 run: | 83 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 84 sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel ninja-build lcov 85 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 86 - name: Build 87 run: | 88 ./script/test build 89 - name: Get Thread-Wireshark 90 run: | 91 ./script/test get_thread_wireshark 92 - name: Run 93 run: | 94 ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py 95 - uses: actions/upload-artifact@v2 96 if: ${{ failure() }} 97 with: 98 name: packet-verification-pcaps 99 path: | 100 *.pcap 101 *.json 102 - name: Generate Coverage 103 run: | 104 ./script/test generate_coverage gcc 105 - uses: actions/upload-artifact@v2 106 with: 107 name: cov-packet-verification 108 path: tmp/coverage.info 109 110 cli-ftd: 111 runs-on: ubuntu-20.04 112 env: 113 CFLAGS: -m32 114 CXXFLAGS: -m32 115 LDFLAGS: -m32 116 COVERAGE: 1 117 REFERENCE_DEVICE: 1 118 THREAD_VERSION: 1.1 119 VIRTUAL_TIME: 1 120 steps: 121 - uses: actions/checkout@v2 122 with: 123 submodules: true 124 - name: Bootstrap 125 run: | 126 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 127 sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel lcov 128 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 129 - name: Build 130 run: | 131 ./bootstrap 132 make -f examples/Makefile-simulation 133 - name: Run 134 run: | 135 VERBOSE=1 make -f examples/Makefile-simulation check 136 - uses: actions/upload-artifact@v2 137 if: ${{ failure() }} 138 with: 139 name: cli-ftd-thread-cert 140 path: build/simulation/tests/scripts/thread-cert 141 - name: Generate Coverage 142 run: | 143 ./script/test generate_coverage gcc 144 - uses: actions/upload-artifact@v2 145 with: 146 name: cov-cli-ftd 147 path: tmp/coverage.info 148 149 cli-mtd: 150 name: cli-mtd MESSAGE_USE_HEAP=${{ matrix.message_use_heap }} 151 runs-on: ubuntu-20.04 152 strategy: 153 fail-fast: false 154 matrix: 155 message_use_heap: [0, 1] 156 env: 157 CFLAGS: -m32 158 CXXFLAGS: -m32 159 LDFLAGS: -m32 160 COVERAGE: 1 161 REFERENCE_DEVICE: 1 162 THREAD_VERSION: 1.1 163 USE_MTD: 1 164 VIRTUAL_TIME: 1 165 MESSAGE_USE_HEAP: ${{ matrix.message_use_heap }} 166 steps: 167 - uses: actions/checkout@v2 168 with: 169 submodules: true 170 - name: Bootstrap 171 run: | 172 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 173 sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel lcov 174 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 175 - name: Build 176 run: | 177 ./bootstrap 178 make -f examples/Makefile-simulation 179 - name: Run 180 run: | 181 VERBOSE=1 make -f examples/Makefile-simulation check 182 - uses: actions/upload-artifact@v2 183 if: ${{ failure() }} 184 with: 185 name: cli-mtd-thread-cert 186 path: build/simulation/tests/scripts/thread-cert 187 - name: Generate Coverage 188 run: | 189 ./script/test generate_coverage gcc 190 - uses: actions/upload-artifact@v2 191 with: 192 name: cov-cli-mtd-${{ matrix.message_use_heap }} 193 path: tmp/coverage.info 194 195 cli-time-sync: 196 runs-on: ubuntu-20.04 197 env: 198 CFLAGS: -m32 199 CXXFLAGS: -m32 200 LDFLAGS: -m32 201 COVERAGE: 1 202 REFERENCE_DEVICE: 1 203 THREAD_VERSION: 1.1 204 TIME_SYNC: 1 205 VIRTUAL_TIME: 1 206 steps: 207 - uses: actions/checkout@v2 208 with: 209 submodules: true 210 - name: Bootstrap 211 run: | 212 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 213 sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel lcov 214 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 215 - name: Build 216 run: | 217 ./bootstrap 218 make -f examples/Makefile-simulation 219 - name: Run 220 run: | 221 VERBOSE=1 make -f examples/Makefile-simulation check 222 - uses: actions/upload-artifact@v2 223 if: ${{ failure() }} 224 with: 225 name: cli-time-sync-thread-cert 226 path: build/simulation/tests/scripts/thread-cert 227 - name: Generate Coverage 228 run: | 229 ./script/test generate_coverage gcc 230 - uses: actions/upload-artifact@v2 231 with: 232 name: cov-cli-time-sync 233 path: tmp/coverage.info 234 235 expects: 236 runs-on: ubuntu-18.04 237 env: 238 CFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15 239 CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15 240 THREAD_VERSION: 1.1 241 steps: 242 - uses: actions/checkout@v2 243 - name: Bootstrap 244 run: | 245 sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat 246 - name: Run 247 run: | 248 ulimit -c unlimited 249 ./script/test prepare_coredump_upload 250 OT_OPTIONS='-DOT_TIME_SYNC=ON -DOT_FULL_LOGS=ON -DOT_LOG_OUTPUT=PLATFORM_DEFINED' VIRTUAL_TIME=0 ./script/test build expect 251 - name: Check Crash 252 if: ${{ failure() }} 253 run: | 254 CRASHED=$(./script/test check_crash | tail -1) 255 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 256 echo "CRASHED_CLI=$CRASHED" >> $GITHUB_ENV 257 - uses: actions/upload-artifact@v2 258 if: ${{ failure() && env.CRASHED_CLI == '1' }} 259 with: 260 name: core-expect-cli 261 path: | 262 ./ot-core-dump/* 263 - name: Generate Coverage 264 run: | 265 ./script/test generate_coverage gcc 266 - uses: actions/upload-artifact@v2 267 with: 268 name: cov-expects 269 path: tmp/coverage.info 270 271 ot-commissioner: 272 runs-on: ubuntu-20.04 273 env: 274 THREAD_VERSION: 1.1 275 steps: 276 - uses: actions/checkout@v2 277 with: 278 submodules: true 279 - name: Bootstrap 280 env: 281 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 282 run: | 283 sudo rm /etc/apt/sources.list.d/* 284 sudo apt-get install -y avahi-daemon avahi-utils lcov 285 script/git-tool clone https://github.com/openthread/ot-commissioner.git /tmp/ot-commissioner --depth 1 --branch main 286 - name: Build 287 run: | 288 cd /tmp/ot-commissioner 289 script/bootstrap.sh 290 cmake -GNinja \ 291 -DCMAKE_CXX_STANDARD=11 \ 292 -DCMAKE_CXX_STANDARD_REQUIRED=ON \ 293 -DCMAKE_BUILD_TYPE=Release \ 294 -DCMAKE_INSTALL_PREFIX=/usr/local \ 295 -DOT_COMM_COVERAGE=ON \ 296 -DOT_COMM_CCM=OFF \ 297 -S . -B build 298 cmake --build build 299 sudo cmake --install build 300 - name: Run 301 run: | 302 export OT_COMM_OPENTHREAD="$(pwd)" 303 cd /tmp/ot-commissioner/tests/integration 304 ./bootstrap.sh 305 ./run_tests.sh 306 - name: Generate Coverage 307 run: | 308 ./script/test generate_coverage gcc 309 - uses: actions/upload-artifact@v2 310 with: 311 name: cov-ot-commissioner 312 path: tmp/coverage.info 313 314 multiple-instance: 315 runs-on: ubuntu-20.04 316 env: 317 COVERAGE: 1 318 MULTIPLE_INSTANCE: 1 319 REFERENCE_DEVICE: 1 320 THREAD_VERSION: 1.1 321 VIRTUAL_TIME: 1 322 CXXFLAGS: "-DOPENTHREAD_CONFIG_LOG_PREPEND_UPTIME=0" 323 steps: 324 - uses: actions/checkout@v2 325 with: 326 submodules: true 327 - name: Bootstrap 328 run: | 329 sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel lcov 330 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 331 - name: Build 332 run: | 333 ./bootstrap 334 make -f examples/Makefile-simulation 335 - name: Run 336 run: | 337 VERBOSE=1 make -f examples/Makefile-simulation check 338 - uses: actions/upload-artifact@v2 339 if: ${{ failure() }} 340 with: 341 name: multiple-instance-thread-cert 342 path: build/simulation/tests/scripts/thread-cert 343 - name: Generate Coverage 344 run: | 345 ./script/test generate_coverage gcc 346 - uses: actions/upload-artifact@v2 347 with: 348 name: cov-multiple-instance 349 path: tmp/coverage.info 350 351 upload-coverage: 352 needs: 353 - packet-verification 354 - cli-ftd 355 - cli-mtd 356 - cli-time-sync 357 - expects 358 - ot-commissioner 359 - multiple-instance 360 runs-on: ubuntu-20.04 361 steps: 362 - uses: actions/checkout@v2 363 with: 364 submodules: true 365 - name: Bootstrap 366 run: | 367 sudo apt-get --no-install-recommends install -y lcov 368 - uses: actions/download-artifact@v2 369 with: 370 path: coverage/ 371 - name: Combine Coverage 372 run: | 373 script/test combine_coverage 374 - name: Upload Coverage 375 uses: codecov/codecov-action@v2 376 with: 377 files: final.info 378 fail_ci_if_error: true 379 380 delete-coverage-artifacts: 381 needs: upload-coverage 382 runs-on: ubuntu-20.04 383 steps: 384 - uses: geekyeggo/delete-artifact@1-glob-support 385 with: 386 name: cov-* 387 useGlob: true 388