|
| 1 | +# @copyright Copyright (c) contributors to Project Ocre, |
| 2 | +# which has been established as Project Ocre a Series of LF Projects, LLC |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: Apache-2.0 |
| 5 | + |
| 6 | +name: Zephyr |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_call: |
| 10 | + inputs: |
| 11 | + devcontainer-tag: |
| 12 | + description: The container tag to be used |
| 13 | + default: latest |
| 14 | + required: false |
| 15 | + type: string |
| 16 | + |
| 17 | +jobs: |
| 18 | + zephyr-systests: |
| 19 | + name: Build and Run System Tests |
| 20 | + runs-on: ["self-hosted", "build-server"] |
| 21 | + container: |
| 22 | + image: ghcr.io/${{ github.repository }}/devcontainer-zephyr:${{ inputs.devcontainer-tag }} |
| 23 | + options: --user 1000:1000 |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + test: |
| 27 | + - container |
| 28 | + - lib |
| 29 | + - ocre |
| 30 | + - context |
| 31 | + steps: |
| 32 | + - name: Clean other workspace |
| 33 | + run: rm -rf ../.west |
| 34 | + |
| 35 | + - name: Clean workspace |
| 36 | + run: find . -name . -o -prune -exec rm -rf -- {} + |
| 37 | + |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + path: ocre-runtime |
| 42 | + submodules: true |
| 43 | + |
| 44 | + - name: West init |
| 45 | + run: | |
| 46 | + . /opt/zephyr-venv/bin/activate |
| 47 | + west init -l ocre-runtime |
| 48 | +
|
| 49 | + - name: West update |
| 50 | + run: | |
| 51 | + . /opt/zephyr-venv/bin/activate |
| 52 | + west update |
| 53 | +
|
| 54 | + - name: West build |
| 55 | + run: | |
| 56 | + . /opt/zephyr-venv/bin/activate |
| 57 | + west build -p always -b native_sim/native/64 ocre-runtime/tests/system/zephyr/${{ matrix.test }} |
| 58 | + |
| 59 | + - name: Run Test ${{ matrix.test }} |
| 60 | + run: | |
| 61 | + . /opt/zephyr-venv/bin/activate |
| 62 | + EXPECTED_LOG="^OK$" |
| 63 | + echo "Running application..." |
| 64 | + stdbuf -oL -eL timeout 20s west build -t run | tee zephyr_run.log |
| 65 | + echo "===== Checking for expected log =====" |
| 66 | + if grep -q "$EXPECTED_LOG" zephyr_run.log; then |
| 67 | + echo "[OK] Found expected log: $EXPECTED_LOG" |
| 68 | + else |
| 69 | + echo "[ERROR] Expected log not found: $EXPECTED_LOG" |
| 70 | + exit 1 |
| 71 | + fi |
0 commit comments