• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: Simulation 1.1
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  packet-verification:
49    runs-on: ubuntu-24.04
50    env:
51      PACKET_VERIFICATION: 1
52      REFERENCE_DEVICE: 1
53      THREAD_VERSION: 1.1
54      VIRTUAL_TIME: 1
55      MULTIPLY: 3
56    steps:
57    - name: Harden Runner
58      uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
59      with:
60        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
61
62    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
63      with:
64        submodules: true
65    - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
66      with:
67        python-version: '3.12'
68        cache: pip
69    - name: Bootstrap
70      run: |
71        sudo apt-get update
72        sudo apt-get --no-install-recommends install -y ninja-build lcov
73        python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
74    - name: Build
75      run: |
76        ./script/test build
77    - name: Get Thread-Wireshark
78      run: |
79        ./script/test get_thread_wireshark
80    - name: Run
81      run: |
82        ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
83    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
84      if: ${{ failure() }}
85      with:
86        name: packet-verification-pcaps
87        path: |
88          *.pcap
89          *.json
90    - name: Generate Coverage
91      run: |
92        ./script/test generate_coverage gcc
93    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
94      with:
95        name: cov-packet-verification
96        path: tmp/coverage.info
97        retention-days: 1
98
99  cli-ftd:
100    runs-on: ubuntu-24.04
101    env:
102      CFLAGS: -m32
103      CXXFLAGS: -m32
104      LDFLAGS: -m32
105      COVERAGE: 1
106      REFERENCE_DEVICE: 1
107      THREAD_VERSION: 1.1
108      VIRTUAL_TIME: 1
109    steps:
110    - name: Harden Runner
111      uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
112      with:
113        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
114
115    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
116      with:
117        submodules: true
118    - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
119      with:
120        python-version: '3.12'
121        cache: pip
122    - name: Bootstrap
123      run: |
124        sudo apt-get update
125        sudo apt-get --no-install-recommends install -y lcov ninja-build g++-multilib
126        python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
127    - name: Build
128      run: |
129        ./script/test build
130    - name: Run
131      run: |
132        ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
133    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
134      if: ${{ failure() }}
135      with:
136        name: cli-ftd-thread-cert
137        path: ot_testing
138    - name: Generate Coverage
139      run: |
140        ./script/test generate_coverage gcc
141    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
142      with:
143        name: cov-cli-ftd
144        path: tmp/coverage.info
145        retention-days: 1
146
147  cli-mtd:
148    name: cli-mtd MESSAGE_USE_HEAP=${{ matrix.message_use_heap }}
149    runs-on: ubuntu-24.04
150    strategy:
151      fail-fast: false
152      matrix:
153        message_use_heap: [0, 1]
154    env:
155      CFLAGS: -m32
156      CXXFLAGS: -m32
157      LDFLAGS: -m32
158      COVERAGE: 1
159      REFERENCE_DEVICE: 1
160      THREAD_VERSION: 1.1
161      USE_MTD: 1
162      VIRTUAL_TIME: 1
163      MESSAGE_USE_HEAP: ${{ matrix.message_use_heap }}
164    steps:
165    - name: Harden Runner
166      uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
167      with:
168        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
169
170    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
171      with:
172        submodules: true
173    - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
174      with:
175        python-version: '3.12'
176        cache: pip
177    - name: Bootstrap
178      run: |
179        sudo apt-get update
180        sudo apt-get --no-install-recommends install -y lcov ninja-build g++-multilib
181        python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
182    - name: Build
183      run: |
184        ./script/test build
185    - name: Run
186      run: |
187        ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
188    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
189      if: ${{ failure() }}
190      with:
191        name: cli-mtd-thread-cert
192        path: ot_testing
193    - name: Generate Coverage
194      run: |
195        ./script/test generate_coverage gcc
196    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
197      with:
198        name: cov-cli-mtd-${{ matrix.message_use_heap }}
199        path: tmp/coverage.info
200        retention-days: 1
201
202  cli-time-sync:
203    runs-on: ubuntu-24.04
204    env:
205      CFLAGS: -m32
206      CXXFLAGS: -m32
207      LDFLAGS: -m32
208      COVERAGE: 1
209      REFERENCE_DEVICE: 1
210      THREAD_VERSION: 1.1
211      VIRTUAL_TIME: 1
212    steps:
213    - name: Harden Runner
214      uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
215      with:
216        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
217
218    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
219      with:
220        submodules: true
221    - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
222      with:
223        python-version: '3.12'
224        cache: pip
225    - name: Bootstrap
226      run: |
227        sudo apt-get update
228        sudo apt-get --no-install-recommends install -y g++-multilib lcov ninja-build
229        python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
230    - name: Build
231      run: |
232        OT_OPTIONS="-DOT_TIME_SYNC=ON" ./script/test build
233    - name: Run
234      run: |
235        ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
236    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
237      if: ${{ failure() }}
238      with:
239        name: cli-time-sync-thread-cert
240        path: ot_testing
241    - name: Generate Coverage
242      run: |
243        ./script/test generate_coverage gcc
244    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
245      with:
246        name: cov-cli-time-sync
247        path: tmp/coverage.info
248        retention-days: 1
249
250  expects:
251    runs-on: ubuntu-24.04
252    env:
253      CFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
254      CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
255      THREAD_VERSION: 1.1
256    steps:
257    - name: Harden Runner
258      uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
259      with:
260        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
261
262    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
263    - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
264      with:
265        python-version: '3.12'
266        cache: pip
267    - name: Bootstrap
268      run: |
269        sudo apt-get --no-install-recommends install -y expect ninja-build lcov
270        sudo bash script/install_socat
271        pip install bleak 'cryptography==43.0.0'
272    - name: Run
273      run: |
274        ulimit -c unlimited
275        ./script/test prepare_coredump_upload
276        OT_OPTIONS='-DOT_TIME_SYNC=ON -DOT_FULL_LOGS=ON -DOT_LOG_OUTPUT=PLATFORM_DEFINED' VIRTUAL_TIME=0 ./script/test build expect
277    - name: Check Crash
278      if: ${{ failure() }}
279      run: |
280          CRASHED=$(./script/test check_crash | tail -1)
281          [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
282          echo "CRASHED_CLI=$CRASHED" >> $GITHUB_ENV
283    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
284      if: ${{ failure() && env.CRASHED_CLI == '1' }}
285      with:
286        name: core-expect-cli
287        path: |
288          ./ot-core-dump/*
289    - name: Generate Coverage
290      run: |
291        ./script/test generate_coverage gcc
292    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
293      with:
294        name: cov-expects
295        path: tmp/coverage.info
296        retention-days: 1
297
298  ot-commissioner:
299    runs-on: ubuntu-24.04
300    env:
301      THREAD_VERSION: 1.1
302    steps:
303    - name: Harden Runner
304      uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
305      with:
306        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
307
308    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
309      with:
310        submodules: true
311    - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
312      with:
313        python-version: '3.12'
314        cache: pip
315    - name: Bootstrap
316      env:
317        GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
318      run: |
319        sudo apt-get update
320        sudo apt-get install -y avahi-daemon avahi-utils lcov
321        script/git-tool clone https://github.com/openthread/ot-commissioner.git /tmp/ot-commissioner --depth 1 --branch main
322    - name: Build
323      run: |
324        cd /tmp/ot-commissioner
325        script/bootstrap.sh
326        cmake -GNinja                           \
327              -DCMAKE_CXX_STANDARD=11           \
328              -DCMAKE_CXX_STANDARD_REQUIRED=ON  \
329              -DCMAKE_BUILD_TYPE=Release        \
330              -DCMAKE_INSTALL_PREFIX=/usr/local \
331              -DOT_COMM_COVERAGE=ON             \
332              -DOT_COMM_CCM=OFF                 \
333              -S . -B build
334        cmake --build build
335        sudo cmake --install build
336    - name: Run
337      run: |
338        export OT_COMM_OPENTHREAD="$(pwd)"
339        cd /tmp/ot-commissioner/tests/integration
340        ./bootstrap.sh
341        ./run_tests.sh
342    - name: Generate Coverage
343      run: |
344        ./script/test generate_coverage gcc
345    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
346      with:
347        name: cov-ot-commissioner
348        path: tmp/coverage.info
349        retention-days: 1
350
351  multiple-instance:
352    runs-on: ubuntu-24.04
353    env:
354      COVERAGE: 1
355      THREAD_VERSION: 1.1
356      VIRTUAL_TIME: 1
357      CXXFLAGS: "-DOPENTHREAD_CONFIG_LOG_PREPEND_UPTIME=0"
358    steps:
359    - name: Harden Runner
360      uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
361      with:
362        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
363
364    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
365      with:
366        submodules: true
367    - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
368      with:
369        python-version: '3.12'
370        cache: pip
371    - name: Bootstrap
372      run: |
373        sudo apt-get --no-install-recommends install -y lcov ninja-build
374        python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
375    - name: Build
376      run: |
377        OT_OPTIONS="-DOT_MULTIPLE_INSTANCE=ON" ./script/test build
378    - name: Run
379      run: |
380        ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
381    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
382      if: ${{ failure() }}
383      with:
384        name: ot_testing
385        path: build/simulation/tests/scripts/thread-cert
386    - name: Generate Coverage
387      run: |
388        ./script/test generate_coverage gcc
389    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
390      with:
391        name: cov-multiple-instance
392        path: tmp/coverage.info
393        retention-days: 1
394
395  simulation-local-host:
396    runs-on: ubuntu-24.04
397    env:
398      COVERAGE: 1
399    steps:
400    - name: Harden Runner
401      uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
402      with:
403        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
404
405    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
406      with:
407        submodules: true
408    - name: Bootstrap
409      run: |
410        sudo apt-get --no-install-recommends install -y expect ninja-build lcov
411    - name: Run
412      run: |
413        ./script/check-simulation-local-host
414    - name: Generate Coverage
415      run: |
416        ./script/test generate_coverage gcc
417    - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
418      with:
419        name: cov-simulation-local-host
420        path: tmp/coverage.info
421        retention-days: 1
422
423  upload-coverage:
424    needs:
425    - packet-verification
426    - cli-ftd
427    - cli-mtd
428    - cli-time-sync
429    - expects
430    - ot-commissioner
431    - multiple-instance
432    runs-on: ubuntu-22.04
433    steps:
434    - name: Harden Runner
435      uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
436      with:
437        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
438
439    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
440      with:
441        submodules: true
442    - name: Bootstrap
443      run: |
444        sudo apt-get --no-install-recommends install -y lcov
445    - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
446      with:
447        path: coverage/
448        pattern: cov-*
449        merge-multiple: true
450    - name: Combine Coverage
451      run: |
452        script/test combine_coverage
453    - name: Upload Coverage
454      uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
455      env:
456        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
457      with:
458        files: final.info
459        fail_ci_if_error: true
460