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@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1 63 with: 64 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 65 66 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.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 - name: Build & Run 75 run: | 76 top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh 77 78 79 toranj-cli: 80 name: toranj-cli-${{ matrix.TORANJ_RADIO }} 81 runs-on: ubuntu-20.04 82 strategy: 83 matrix: 84 TORANJ_RADIO: ['15.4', 'trel', 'multi'] 85 env: 86 COVERAGE: 1 87 TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }} 88 TORANJ_CLI: 1 89 steps: 90 - name: Harden Runner 91 uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1 92 with: 93 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 94 95 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 96 with: 97 submodules: true 98 - name: Bootstrap 99 env: 100 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 101 run: | 102 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 103 sudo apt-get --no-install-recommends install -y ninja-build lcov 104 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 105 - name: Build & Run 106 run: | 107 top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh 108 - name: Generate Coverage 109 if: "matrix.TORANJ_RADIO != 'multi'" 110 run: | 111 ./script/test generate_coverage gcc 112 - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 113 if: "matrix.TORANJ_RADIO != 'multi'" 114 with: 115 name: cov-toranj-cli-${{ matrix.TORANJ_RADIO }} 116 path: tmp/coverage.info 117 118 toranj-unittest: 119 name: toranj-unittest 120 runs-on: ubuntu-20.04 121 steps: 122 - name: Harden Runner 123 uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1 124 with: 125 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 126 127 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 128 with: 129 submodules: true 130 - name: Bootstrap 131 env: 132 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 133 run: | 134 sudo dpkg --add-architecture i386 135 sudo apt-get update 136 sudo apt-get --no-install-recommends install -y clang-10 clang++-10 ninja-build python3-setuptools python3-wheel llvm lcov 137 sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386 138 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 139 - name: Build & Run 140 run: | 141 ./tests/toranj/build.sh cmake 142 ninja test 143 144 upload-coverage: 145 needs: 146 - toranj-cli 147 runs-on: ubuntu-20.04 148 steps: 149 - name: Harden Runner 150 uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1 151 with: 152 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 153 154 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 155 with: 156 submodules: true 157 - name: Bootstrap 158 run: | 159 sudo apt-get --no-install-recommends install -y lcov 160 - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 161 with: 162 path: coverage/ 163 - name: Combine Coverage 164 run: | 165 script/test combine_coverage 166 - name: Upload Coverage 167 uses: codecov/codecov-action@894ff025c7b54547a9a2a1e9f228beae737ad3c2 # v3.1.3 168 with: 169 files: final.info 170 fail_ci_if_error: true 171 172 delete-coverage-artifacts: 173 needs: upload-coverage 174 runs-on: ubuntu-20.04 175 steps: 176 - name: Harden Runner 177 uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1 178 with: 179 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs 180 181 - uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0 182 with: 183 name: cov-* 184 useGlob: true 185