Repository navigation
Zephyr Twister Tests #100
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
| name: Zephyr Twister Tests | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| run-id: | |
| description: > | |
| Run ID of a cpullvm-toolchain workflow that built the Linux x86_64 toolchain. | |
| Leave blank to use the latest nightly. | |
| required: false | |
| default: '' | |
| package-name: | |
| description: > | |
| Package name of the toolchain to download. Defaults to 'cpullvm-packages-build.sh-Linux-x86'. | |
| Only Linux packages should be used. | |
| required: false | |
| default: cpullvm-packages-build.sh-Linux-x86 | |
| schedule: | |
| - cron: '0 5 * * 1' # Sunday 21:00 PST (Monday 05:00 UTC) | |
| pull_request: | |
| paths: | |
| - '.github/workflows/zephyr-twister-tests.yml' | |
| permissions: | |
| contents: read | |
| jobs: | |
| run-twister-tests: | |
| if: github.repository == 'qualcomm/cpullvm-toolchain' | |
| name: Twister tests for ${{ matrix.platform }} (${{ matrix.subset }}/2) | |
| # Zephyr's tests take a relatively long time to complete but can be split to | |
| # run in parallel on different machines fairly easily (by platform/arch, | |
| # using `--subset`, etc.). So let's use Github's runners to avoid tying up | |
| # our (limited in number) self-hosted runners for hours at a time. | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ghcr.io/zephyrproject-rtos/ci-base:main | |
| # Work around a mismatch between UIDs, see https://github.com/actions/checkout/issues/956 | |
| options: '--user 0' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [qemu_riscv32, qemu_riscv32_xip, qemu_riscv64, qemu_cortex_a53, qemu_cortex_m3, qemu_cortex_a9] | |
| subset: [1, 2] | |
| steps: | |
| - name: Clone Zephyr | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| repository: zephyrproject-rtos/zephyr | |
| # We must also add the repository as a safe.directory, otherwise we get | |
| # errors about "dubious ownership". See https://github.com/actions/checkout/issues/2031 | |
| - name: Set safe.directory | |
| run: | | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Checkout fetch-linux-toolchain action | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| sparse-checkout: .github/actions/fetch-linux-toolchain | |
| path: .cpullvm | |
| - name: Fetch toolchain | |
| uses: ./.cpullvm/.github/actions/fetch-linux-toolchain | |
| with: | |
| github-token: ${{ github.token }} | |
| run-id: ${{ inputs.run-id }} | |
| package-name: ${{ inputs.package-name || 'cpullvm-packages-build.sh-Linux-x86' }} | |
| - name: West setup | |
| run: | | |
| west init -l . | |
| west update | |
| # Source hosttools (including qemu) from the Zephyr SDK. | |
| - name: Install Zephyr SDK hosttools | |
| run: | | |
| west sdk install --no-gnu-toolchains --install-base /opt/toolchains | |
| - name: Run Twister tests | |
| shell: bash | |
| run: | | |
| source zephyr-env.sh | |
| export ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/ | |
| export ZEPHYR_TOOLCHAIN_VARIANT=host/llvm | |
| export LLVM_TOOLCHAIN_PATH=/opt/cpullvm/ | |
| west twister -W \ | |
| -p ${{ matrix.platform }} \ | |
| -j 3 \ | |
| --inline-logs \ | |
| --force-toolchain \ | |
| --subset ${{ matrix.subset }}/2 \ | |
| -x=CONFIG_LLVM_USE_ELD=y \ | |
| -x=CONFIG_COMPILER_RT_RTLIB=y | |
| - name: Upload Twister results | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| if: always() | |
| with: | |
| name: zephyr-twister-test-results-${{ matrix.platform }}-subset-${{ matrix.subset }} | |
| path: | | |
| twister-out/twister.log | |
| twister-out/twister.xml | |
| twister-out/twister.json | |
| merge-twister-results: | |
| if: always() && github.repository == 'qualcomm/cpullvm-toolchain' | |
| name: Merge Twister XML results | |
| needs: run-twister-tests | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Download split XML results | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| path: split_xml | |
| - name: Install junitparser | |
| run: | | |
| pip install junitparser | |
| - name: Merge split XML results | |
| run: | | |
| junitparser merge --glob "split_xml/**/twister.xml" merged_twister.xml | |
| - name: Upload merged XML results | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: zephyr-merged-twister-test-results | |
| path: merged_twister.xml |