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@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 63 with: 64 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 65 66 - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 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@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 94 with: 95 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 96 97 - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 115 if: "matrix.TORANJ_RADIO != 'multi'" 116 with: 117 name: cov-toranj-cli-${{ matrix.TORANJ_RADIO }} 118 path: tmp/coverage.info 119 120 toranj-unittest: 121 name: toranj-unittest 122 runs-on: ubuntu-20.04 123 steps: 124 - name: Harden Runner 125 uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 126 with: 127 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 128 129 - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 130 with: 131 submodules: true 132 - name: Bootstrap 133 env: 134 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 135 run: | 136 sudo dpkg --add-architecture i386 137 sudo apt-get update 138 sudo apt-get --no-install-recommends install -y clang-10 clang++-10 ninja-build python3-setuptools python3-wheel llvm lcov 139 sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386 140 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 141 - name: Build & Run 142 run: | 143 ./tests/toranj/build.sh all 144 ninja test 145 # Validate posix builds with different radio configs 146 git clean -dfx 147 ./tests/toranj/build.sh posix-15.4 148 git clean -dfx 149 ./tests/toranj/build.sh posix-15.4+trel 150 git clean -dfx 151 ./tests/toranj/build.sh posix-trel 152 153 upload-coverage: 154 needs: 155 - toranj-cli 156 runs-on: ubuntu-20.04 157 steps: 158 - name: Harden Runner 159 uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 160 with: 161 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 162 163 - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 164 with: 165 submodules: true 166 - name: Bootstrap 167 run: | 168 sudo apt-get --no-install-recommends install -y lcov 169 - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 170 with: 171 path: coverage/ 172 - name: Combine Coverage 173 run: | 174 script/test combine_coverage 175 - name: Upload Coverage 176 uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 177 with: 178 files: final.info 179 fail_ci_if_error: true 180 181 delete-coverage-artifacts: 182 needs: upload-coverage 183 runs-on: ubuntu-20.04 184 steps: 185 - name: Harden Runner 186 uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 187 with: 188 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 189 190 - uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0 191 with: 192 name: cov-* 193 useGlob: true 194