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: Toranj 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: 44 contents: read 45 46jobs: 47 48 toranj-ncp: 49 name: toranj-ncp-${{ matrix.TORANJ_RADIO }} 50 runs-on: ubuntu-20.04 51 strategy: 52 fail-fast: false 53 matrix: 54 TORANJ_RADIO: ['15.4'] 55 env: 56 COVERAGE: 1 57 TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }} 58 TORANJ_NCP : 1 59 TORANJ_EVENT_NAME: ${{ github.event_name }} 60 steps: 61 - name: Harden Runner 62 uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 63 with: 64 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 65 66 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 67 with: 68 submodules: true 69 - name: Bootstrap 70 env: 71 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 72 run: | 73 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 74 sudo apt-get --no-install-recommends install -y ninja-build lcov 75 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 76 - name: Build & Run 77 run: | 78 top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh 79 80 81 toranj-cli: 82 name: toranj-cli-${{ matrix.TORANJ_RADIO }} 83 runs-on: ubuntu-20.04 84 strategy: 85 matrix: 86 TORANJ_RADIO: ['15.4', 'trel', 'multi'] 87 env: 88 COVERAGE: 1 89 TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }} 90 TORANJ_CLI: 1 91 steps: 92 - name: Harden Runner 93 uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 94 with: 95 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 96 97 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 98 with: 99 submodules: true 100 - name: Bootstrap 101 env: 102 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 103 run: | 104 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 105 sudo apt-get --no-install-recommends install -y ninja-build lcov 106 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 107 - name: Build & Run 108 run: | 109 top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh 110 - name: Generate Coverage 111 if: "matrix.TORANJ_RADIO != 'multi'" 112 run: | 113 ./script/test generate_coverage gcc 114 - uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0 115 if: "matrix.TORANJ_RADIO != 'multi'" 116 with: 117 name: cov-toranj-cli-${{ matrix.TORANJ_RADIO }} 118 path: tmp/coverage.info 119 retention-days: 1 120 121 toranj-unittest: 122 name: toranj-unittest 123 runs-on: ubuntu-20.04 124 steps: 125 - name: Harden Runner 126 uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 127 with: 128 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 129 130 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 131 with: 132 submodules: true 133 - name: Bootstrap 134 env: 135 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 136 run: | 137 sudo dpkg --add-architecture i386 138 sudo apt-get update 139 sudo apt-get --no-install-recommends install -y clang-10 clang++-10 ninja-build python3-setuptools python3-wheel llvm lcov 140 sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386 141 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 142 - name: Build & Run 143 run: | 144 ./tests/toranj/build.sh all 145 ninja test 146 # Validate posix builds with different radio configs 147 git clean -dfx 148 ./tests/toranj/build.sh ncp-15.4 149 git clean -dfx 150 ./tests/toranj/build.sh ncp-trel 151 git clean -dfx 152 ./tests/toranj/build.sh ncp-15.4+trel 153 git clean -dfx 154 ./tests/toranj/build.sh posix-15.4 155 git clean -dfx 156 ./tests/toranj/build.sh posix-15.4+trel 157 git clean -dfx 158 ./tests/toranj/build.sh posix-trel 159 git clean -dfx 160 ./tests/toranj/build.sh --enable-plat-key-ref all 161 162 upload-coverage: 163 needs: 164 - toranj-cli 165 runs-on: ubuntu-20.04 166 steps: 167 - name: Harden Runner 168 uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 169 with: 170 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 171 172 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 173 with: 174 submodules: true 175 - name: Bootstrap 176 run: | 177 sudo apt-get --no-install-recommends install -y lcov 178 - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 179 with: 180 path: coverage/ 181 pattern: cov-* 182 merge-multiple: true 183 - name: Combine Coverage 184 run: | 185 script/test combine_coverage 186 - name: Upload Coverage 187 uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 188 with: 189 files: final.info 190 fail_ci_if_error: true 191