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@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 63 with: 64 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 65 66 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 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@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 94 with: 95 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 96 97 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 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@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 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@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 127 with: 128 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 129 130 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 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 toranj-macos: 163 name: toranj-macos 164 runs-on: macos-14 165 steps: 166 - name: Harden Runner 167 uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 168 with: 169 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 170 171 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 172 with: 173 submodules: true 174 - name: Bootstrap 175 env: 176 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 177 run: | 178 brew update 179 brew install ninja 180 - name: Build & Run 181 run: | 182 ./tests/toranj/build.sh posix-15.4 183 184 upload-coverage: 185 needs: 186 - toranj-cli 187 runs-on: ubuntu-20.04 188 steps: 189 - name: Harden Runner 190 uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 191 with: 192 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 193 194 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 195 with: 196 submodules: true 197 - name: Bootstrap 198 run: | 199 sudo apt-get --no-install-recommends install -y lcov 200 - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 201 with: 202 path: coverage/ 203 pattern: cov-* 204 merge-multiple: true 205 - name: Combine Coverage 206 run: | 207 script/test combine_coverage 208 - name: Upload Coverage 209 uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 210 env: 211 CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 212 with: 213 files: final.info 214 fail_ci_if_error: true 215