Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions .github/workflows/twister_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Twister integration run

on:
push:
branches:
- main
- v*-branch
pull_request:
branches:
- main
- v*-branch

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
twister-build:
strategy:
fail-fast: false
matrix:
# os: [ubuntu-24.04, macos-14, windows-2022]
# subset: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]
subset: [1,2]

runs-on:
- runs-on=${{ github.run_id }}
- runner=4cpu-linux-x64

steps:
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: 3.12

- name: Checkout sources
uses: nrfconnect/action-checkout-west-update@main

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Twister integration run' step
Uses Step
uses 'nrfconnect/action-checkout-west-update' with ref 'main', not a pinned commit hash
with:
git-fetch-depth: 0

- name: Setup ncs toolchain
uses: nrfconnect/action-ncs-toolchain-setup@main

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Twister integration run' step
Uses Step
uses 'nrfconnect/action-ncs-toolchain-setup' with ref 'main', not a pinned commit hash

- name: install additional requirements
run: |
sudo apt-get update
sudo apt-get install gcc-multilib

- name: Run twister
working-directory: ncs
shell: bash
run: |
TOOLCHAIN_BUNDLE_ID=$(./nrf/scripts/print_toolchain_checksum.sh)
ZEPHYR_BASE=${{ github.workspace }}/ncs/zephyr
NRFUTIL="../nrfutil sdk-manager toolchain launch --toolchain-bundle-id $TOOLCHAIN_BUNDLE_ID -- python zephyr/scripts/twister"
$NRFUTIL --ninja --inline-logs --verbose --overflow-as-errors --integration \
--retry-build-errors --quarantine-list nrf/scripts/quarantine.yaml \
--quarantine-list nrf/scripts/quarantine_integration.yaml \
--subset ${{ matrix.subset }}/40 --outdir twister_build --report-dir results_samples -T nrf/samples -T nrf/applications \

- name: Prepare Twister artifact (tar)
if: always()
shell: bash
run: |
mkdir -p upload
tar -czf upload/twister-results-${{ matrix.subset }}.tar.gz --exclude='*build.ninja*' \
ncs/twister_build

- name: Upload twister
if: always()
id: artifact-upload-step
uses: actions/upload-artifact@v4
with:
name: Twister results dir ${{matrix.subset}}
if-no-files-found: ignore
include-hidden-files: false
retention-days: 7
path: |
ncs/results_samples/**/*
upload/twister-results-${{ matrix.subset }}.tar.gz
!ncs/twister_build/**/build.ninja*

artifact-combination:
needs: twister-build
runs-on: ubuntu-latest
steps:
- name: Download all twister artifacts
uses: actions/download-artifact@v4
with:
pattern: Twister results dir *
path: artifacts
merge-multiple: true
- name: Combine all artifacts into one tarball
shell: bash
run: |
set -euo pipefail

mkdir -p combined/twister_build combined/results_samples

# Merge all results_samples directories into one
find artifacts -type d -path '*/ncs/results_samples' -print0 | while IFS= read -r -d '' dir; do
rsync -a "$dir"/ combined/results_samples/
done

# Extract all twister_build tarballs, merging into one twister_build dir
find artifacts -type f -path '*/upload/twister-results-*.tar.gz' -print0 | while IFS= read -r -d '' tarfile; do
# Tar contains ncs/twister_build; strip the leading 'ncs' so we get combined/twister_build/...
tar -xzf "$tarfile" -C combined --strip-components=1
done

# Create a single compressed archive containing combined results and builds
tar -czf twister-combined-artifacts.tar.gz -C combined .

- name: Upload combined twister artifact
uses: actions/upload-artifact@v4
with:
name: Twister combined results
retention-days: 7
path: twister-combined-artifacts.tar.gz
95 changes: 95 additions & 0 deletions .github/workflows/twister_nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Twister nightly multiplatform

on:
workflow_dispatch:
# push:
# branches:
# - main
# - v*-branch
pull_request:
branches:
- main
- v*-branch

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
twister-build:
strategy:
fail-fast: false
matrix:
os: [linux]
subset: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
include:
- os: linux
runner: '["runner=16cpu-linux-x64/runs-on=${{ github.run_id }}/volume=250gb"]'
# - os: windows
# runner: '["windows-2022"]'
# - os: macos
# runner: '["macos-15"]'


runs-on: ${{ fromJson(matrix.runner) }}
steps:
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: 3.12

- name: Checkout sources
uses: nrfconnect/action-checkout-west-update@main

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Twister nightly multiplatform' step
Uses Step
uses 'nrfconnect/action-checkout-west-update' with ref 'main', not a pinned commit hash
with:
git-fetch-depth: 0

- name: Setup ncs toolchain
uses: nrfconnect/action-ncs-toolchain-setup@main

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Twister nightly multiplatform' step
Uses Step
uses 'nrfconnect/action-ncs-toolchain-setup' with ref 'main', not a pinned commit hash

- name: Run twister
working-directory: ncs
shell: bash
run: |
nrf/scripts/ci/twister_runner.sh tb ${{ matrix.subset }}/20

# run: |
# TOOLCHAIN_BUNDLE_ID=$(./nrf/scripts/print_toolchain_checksum.sh)
# ZEPHYR_BASE=${{ github.workspace }}/ncs/zephyr
# if [ "${{ runner.os }}" = "macOS" ]; then
# EXTRA_TWISTER_FLAGS="--quarantine-list nrf/scripts/quarantine_windows_mac.yaml"
# NRFUTIL="sudo ../nrfutil sdk-manager toolchain launch --toolchain-bundle-id $TOOLCHAIN_BUNDLE_ID -- python zephyr/scripts/twister "
# elif [ "${{ runner.os }}" = "Windows" ]; then
# export PYTHONUTF8=1
# EXTRA_TWISTER_FLAGS="--short-build-path --quarantine-list nrf\scripts\quarantine_windows_mac.yaml --no-detailed-test-id"
# NRFUTIL="../nrfutil.exe sdk-manager toolchain launch --toolchain-bundle-id $TOOLCHAIN_BUNDLE_ID -- python zephyr/scripts/twister"
# else
# EXTRA_TWISTER_FLAGS=""
# NRFUTIL="../nrfutil sdk-manager toolchain launch --toolchain-bundle-id $TOOLCHAIN_BUNDLE_ID -- python zephyr/scripts/twister"
# sudo apt-get install gcc-multilib
# fi
# $NRFUTIL --ninja --inline-logs --verbose --overflow-as-errors --integration \
# --retry-build-errors --quarantine-list nrf/scripts/quarantine.yaml \
# --quarantine-list nrf/scripts/quarantine_integration.yaml \
# --subset ${{ matrix.subset }}/40 --outdir twister_build --report-dir results_samples -T nrf/samples -T nrf/applications \
# -v $EXTRA_TWISTER_FLAGS


- name: Upload twister
if: always()
id: artifact-upload-step
uses: actions/upload-artifact@v4
with:
name: Twister results dir ${{ runner.os }} ${{matrix.subset}}
if-no-files-found: ignore
include-hidden-files: false
retention-days: 7
path: |
ncs/results_samples/**/*
!ncs/twister_build/**/build.ninja*
ncs/tb/**/*.hex
ncs/tb/**/build.log


51 changes: 51 additions & 0 deletions scripts/ci/twister_runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail

# --- Usage check ---
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <outdir> <subset>"
echo "Example: $0 twister_build 5/40"
exit 1
fi

OUTDIR=$1
SUBSET=$2

EXTRA_FLAGS=""
NRFUTIL=""
OS="$(uname)"
TOOLCHAIN_BUNDLE_ID=$(./nrf/scripts/print_toolchain_checksum.sh)

echo "Detected OS: $OS"
echo "Toolchain bundle: $TOOLCHAIN_BUNDLE_ID"
echo "Using subset: $SUBSET"
echo "Output dir: $OUTDIR"

# Detect OS and set OS-specific commands
case "$(uname -s)" in
MINGW*)
EXTRA_FLAGS="--short-build-path --quarantine-list nrf\\scripts\\quarantine_windows_mac.yaml --no-detailed-test-id"
export PYTHONUTF8=1
NRFUTIL="../nrfutil.exe sdk-manager toolchain launch --toolchain-bundle-id $TOOLCHAIN_BUNDLE_ID -- python zephyr\\scripts\\twister"
;;
Linux*)
sudo apt-get update && sudo apt-get install gcc-multilib
EXTRA_FLAGS="--jobs 8"
NRFUTIL="../nrfutil sdk-manager toolchain launch --toolchain-bundle-id $TOOLCHAIN_BUNDLE_ID -- python zephyr/scripts/twister"
;;
Darwin*)
EXTRA_FLAGS="--quarantine-list nrf/scripts/quarantine_windows_mac.yaml"
NRFUTIL="sudo ../nrfutil sdk-manager toolchain launch --toolchain-bundle-id $TOOLCHAIN_BUNDLE_ID -- python zephyr/scripts/twister"
;;
*)
echo "Unsupported OS: $(uname -s)"
exit 1
;;
esac

set -x
$NRFUTIL --ninja --inline-logs --verbose --overflow-as-errors --integration \
--retry-build-errors \
--quarantine-list nrf/scripts/quarantine.yaml \
--subset "$SUBSET" --outdir "$OUTDIR" --report-dir results_samples \
-T nrf/samples -T nrf/applications $EXTRA_FLAGS
Loading