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

Unpinned 3rd party Action 'Twister integration run' step [Uses Step](1) 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

Unpinned 3rd party Action 'Twister integration run' step [Uses Step](1) 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
113 changes: 113 additions & 0 deletions .github/workflows/twister_nightly_linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Twister nightly linux

on:
workflow_dispatch:
pull_request:
branches:
- main

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: macos
# runner: '["macos-15"]'
# - os: windows
# runner: '["windows-2022"]'


runs-on: ${{ fromJson(matrix.runner) }}
steps:
- name: Checkout sources
uses: nrfconnect/action-checkout-west-update@main

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow

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

- name: west group filter
working-directory: ncs
run: |
west config manifest.group-filter +bsec
west update --narrow

- 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

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

- name: install additional requirements
run: |
sudo gem install ceedling
sudo apt-get update
sudo apt-get install -y qemu-system-arm g++-multilib gcc-multilib \
libmagic1 ruby libavahi-client-dev libglib2.0-dev libssl-dev \
libpixman-1-dev bzip2 ninja-build graphviz mscgen plantuml uncrustify --no-install-recommends

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

- 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: 1
path: |
ncs/results_samples/**/*
!ncs/twister_build/**/build.ninja*
ncs/tb/**/*.hex
ncs/tb/**/*.log

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
106 changes: 106 additions & 0 deletions .github/workflows/twister_nightly_mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Twister nightly mac

on:
workflow_dispatch:
pull_request:
branches:
- main

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: [macos]
subset: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
include:
- os: macos
runner: '["macos-15"]'


runs-on: ${{ fromJson(matrix.runner) }}
steps:

- uses: actions/setup-python@v5
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

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

- name: west group filter
working-directory: ncs
run: |
west config manifest.group-filter +bsec
west update --narrow

- 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

Unpinned 3rd party Action 'Twister nightly mac' step [Uses Step](1) 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

- 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: 1
path: |
ncs/results_samples/**/*
!ncs/twister_build/**/build.ninja*
ncs/tb/**/*.hex
ncs/tb/**/*.log

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
50 changes: 50 additions & 0 deletions scripts/ci/twister_runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/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"
export PYTHONUTF8=1
NRFUTIL="../nrfutil.exe sdk-manager toolchain launch --toolchain-bundle-id $TOOLCHAIN_BUNDLE_ID -- python zephyr\\scripts\\twister"
;;
Linux*)
EXTRA_FLAGS="--jobs 6 -T nrf/samples -T nrf/applications -T nrf/tests"
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 -T nrf/samples"
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 --enable-size-report --no-detailed-test-id --all \
--retry-failed 2 \
--quarantine-list nrf/scripts/quarantine.yaml \
--subset "$SUBSET" --outdir "$OUTDIR" --report-dir results_samples \
$EXTRA_FLAGS
Loading