|
| 1 | +# Copyright (c) 2025, Nordic Semiconductor ASA |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: Twister Unity Tests |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + types: [push, opened, reopened, synchronize] |
| 9 | + |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + twister_job: |
| 14 | + name: Run Twister patch series (PR) |
| 15 | + runs-on: |
| 16 | + - runs-on=${{ github.run_id }} |
| 17 | + - runner=4cpu-linux-x64 |
| 18 | + # Keep aligned with target NCS version |
| 19 | + container: ghcr.io/nrfconnect/sdk-nrf-toolchain:v2.9.1 |
| 20 | + defaults: |
| 21 | + run: |
| 22 | + # Bash shell is needed to set toolchain related environment variables in docker container |
| 23 | + # It is a workaround for GitHub Actions limitation https://github.com/actions/runner/issues/1964 |
| 24 | + shell: bash |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout the code |
| 28 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 29 | + with: |
| 30 | + path: nrf-lite |
| 31 | + fetch-depth: 0 |
| 32 | + |
| 33 | + - name: restore-cache-sdk |
| 34 | + id: cache-sdk |
| 35 | + uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4 |
| 36 | + with: |
| 37 | + path: | |
| 38 | + nrf |
| 39 | + zephyr |
| 40 | + modules |
| 41 | + key: ${{ runner.os }}-nrf-sdk |
| 42 | + |
| 43 | + - name: Prepare west project |
| 44 | + run: | |
| 45 | + west init -l nrf-lite |
| 46 | + west update -o=--depth=1 -n |
| 47 | +
|
| 48 | + - name: Install requirements |
| 49 | + run: | |
| 50 | + apt-get update |
| 51 | + apt-get install -y build-essential ninja-build gcc-multilib g++-multilib ruby |
| 52 | +
|
| 53 | + - name: Run Twister |
| 54 | + working-directory: nrf-lite |
| 55 | + run: | |
| 56 | + west twister -vc -p native_sim -T tests --enable-asan --enable-lsan --enable-ubsan |
| 57 | +
|
| 58 | + - name: upload-logs |
| 59 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 60 | + if: ${{ !cancelled() }} |
| 61 | + with: |
| 62 | + name: twister-logs |
| 63 | + path: nrf-lite/twister-out/**/*.log |
| 64 | + retention-days: 5 |
| 65 | + |
| 66 | + - name: save-cache-sdk |
| 67 | + if: always() && steps.cache-sdk.outputs.cache-hit != 'true' |
| 68 | + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4 |
| 69 | + with: |
| 70 | + path: | |
| 71 | + nrf |
| 72 | + zephyr |
| 73 | + modules |
| 74 | + key: ${{ steps.cache-sdk.outputs.cache-primary-key }} |
0 commit comments