1# 2# Copyright (c) 2021, 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: Border Router 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 backbone-router: 44 runs-on: ubuntu-20.04 45 env: 46 REFERENCE_DEVICE: 1 47 VIRTUAL_TIME: 0 48 PACKET_VERIFICATION: 1 49 THREAD_VERSION: 1.2 50 INTER_OP: 1 51 COVERAGE: 1 52 MULTIPLY: 1 53 PYTHONUNBUFFERED: 1 54 VERBOSE: 1 55 # The Border Routing and DUA feature can coexist, but current wireshark 56 # packet verification can't handle it because of the order of context ID 57 # of OMR prefix and Domain prefix is not deterministic. 58 BORDER_ROUTING: 0 59 steps: 60 - uses: actions/checkout@v2 61 with: 62 submodules: true 63 - name: Build OTBR Docker 64 env: 65 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 66 run: | 67 ./script/test build_otbr_docker 68 - name: Bootstrap 69 run: | 70 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 71 sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel ninja-build socat lcov 72 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 73 - name: Build 74 run: | 75 ./script/test build 76 - name: Get Thread-Wireshark 77 run: | 78 ./script/test get_thread_wireshark 79 - name: Run 80 run: | 81 export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS -e COVERAGE" 82 echo "CI_ENV=${CI_ENV}" 83 sudo -E ./script/test cert_suite ./tests/scripts/thread-cert/backbone/*.py || (sudo chmod a+r *.log *.json *.pcap && false) 84 - uses: actions/upload-artifact@v2 85 with: 86 name: cov-thread-1-2-backbone-docker 87 path: /tmp/coverage/ 88 - uses: actions/upload-artifact@v2 89 if: ${{ failure() }} 90 with: 91 name: thread-1-2-backbone-results 92 path: | 93 *.pcap 94 *.json 95 *.log 96 - name: Generate Coverage 97 run: | 98 ./script/test generate_coverage gcc 99 - uses: actions/upload-artifact@v2 100 with: 101 name: cov-thread-1-2-backbone 102 path: tmp/coverage.info 103 104 thread-border-router: 105 runs-on: ubuntu-20.04 106 strategy: 107 matrix: 108 otbr_mdns: ["mDNSResponder", "avahi"] 109 env: 110 REFERENCE_DEVICE: 1 111 VIRTUAL_TIME: 0 112 PACKET_VERIFICATION: 1 113 THREAD_VERSION: 1.2 114 INTER_OP: 1 115 COVERAGE: 1 116 MULTIPLY: 1 117 OTBR_MDNS: ${{ matrix.otbr_mdns }} 118 PYTHONUNBUFFERED: 1 119 VERBOSE: 1 120 BORDER_ROUTING: 1 121 steps: 122 - uses: actions/checkout@v2 123 - name: Build OTBR Docker 124 env: 125 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 126 run: | 127 ./script/test build_otbr_docker 128 - name: Bootstrap 129 run: | 130 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 131 sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel ninja-build socat lcov 132 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 133 - name: Build 134 run: | 135 ./script/test build 136 - name: Get Thread-Wireshark 137 run: | 138 ./script/test get_thread_wireshark 139 - name: Run 140 run: | 141 export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS -e COVERAGE" 142 echo "CI_ENV=${CI_ENV}" 143 sudo -E ./script/test cert_suite ./tests/scripts/thread-cert/border_router/*.py || (sudo chmod a+r *.log *.json *.pcap && false) 144 - uses: actions/upload-artifact@v2 145 with: 146 name: cov-thread-border-router-docker 147 path: /tmp/coverage/ 148 - uses: actions/upload-artifact@v2 149 if: ${{ failure() }} 150 with: 151 name: thread-border-router-results 152 path: | 153 *.pcap 154 *.json 155 *.log 156 - name: Generate Coverage 157 run: | 158 ./script/test generate_coverage gcc 159 - uses: actions/upload-artifact@v2 160 with: 161 name: cov-thread-border-router 162 path: tmp/coverage.info 163 164 upload-coverage: 165 needs: 166 - backbone-router 167 - thread-border-router 168 runs-on: ubuntu-20.04 169 steps: 170 - uses: actions/checkout@v2 171 with: 172 submodules: true 173 - name: Bootstrap 174 run: | 175 sudo apt-get --no-install-recommends install -y lcov 176 - uses: actions/download-artifact@v2 177 with: 178 path: coverage/ 179 - name: Combine Coverage 180 run: | 181 script/test combine_coverage 182 - name: Upload Coverage 183 uses: codecov/codecov-action@v1 184 with: 185 files: final.info 186 fail_ci_if_error: true 187 188 delete-coverage-artifacts: 189 needs: upload-coverage 190 if: always() 191 runs-on: ubuntu-20.04 192 steps: 193 - uses: geekyeggo/delete-artifact@1-glob-support 194 with: 195 name: cov-* 196 useGlob: true 197