Skip to content

ci: workflows: self-hosted local pip cache #1985

ci: workflows: self-hosted local pip cache

ci: workflows: self-hosted local pip cache #1985

Workflow file for this run

name: Run tests with twister
on:
pull_request:
branches:
- main
paths-ignore:
- doc/**
- scripts/**
schedule:
# Run at 14:17 UTC every day
- cron: '17 14 * * *'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
twister-run:
runs-on: self-hosted
container:
image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.28.4.20250818
options: '--entrypoint /bin/bash'
volumes:
- /repo-cache/embeint:/github/cache/embeint
- /repo-cache/ccache:/github/ccache
- /repo-cache/pip-cache:/github/pip-cache
strategy:
fail-fast: false
matrix:
subset: [1, 2, 3, 4]
env:
PIP_CACHE_DIR: /github/pip-cache
CCACHE_DIR: /github/ccache
# `--specs` is ignored because ccache is unable to resolve the toolchain specs file path.
CCACHE_IGNOREOPTIONS: '-specs=* --specs=*'
# Ignore nrf54l09pdk until upgrading to Zephyr v4.2, v4.1 and HAL v3.12.0 are incompatible
TWISTER_COMMON: ' --force-color --inline-logs -v -N -M --retry-failed 3 -P nrf54l09pdk/nrf54l09/cpuapp -P nrf54l20pdk/nrf54l20/cpuapp'
DAILY_OPTIONS: ' -M --build-only --show-footprint'
VENDOR_FILTER: ' --vendor nordic --vendor zephyr --vendor embeint '
EXTRA_BOARDS: ' --platform qemu_cortex_m3 --platform qemu_cortex_m0 '
UNIT_TESTING: ' --platform unit_testing '
PR_OPTIONS: ' --clobber-output --integration'
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
BASE_REF: ${{ github.base_ref }}
ZEPHYR_TOOLCHAIN_VARIANT: zephyr
steps:
- name: Workspace cleanup
run: |
rm -rf ./{*,.*}
rm -rf infuse-sdk twister-out*
- name: Clone cached Embeint SDK repository
continue-on-error: true
run: |
git config --global --add safe.directory '*'
git clone --shared /github/cache/embeint/infuse-sdk infuse-sdk
cd infuse-sdk
git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
path: infuse-sdk
fetch-depth: 0
- name: Set up Python
if: github.event_name == 'pull_request'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: 3.12
- name: install-packages
working-directory: infuse-sdk
if: github.event_name == 'pull_request'
run: |
pip install --cache-dir $PIP_CACHE_DIR -r scripts/requirements-actions.txt --require-hashes
- name: Environment Setup
working-directory: infuse-sdk
run: |
if [ "${{github.event_name}}" = "pull_request" ]; then
git config --global user.email "[email protected]"
git config --global user.name "Embeint CI"
rm -fr ".git/rebase-apply"
git rebase origin/${BASE_REF}
git log --pretty=oneline | head -n 10
fi
west init -l . || true
west config --global update.narrow true
west update --path-cache /github/cache/embeint 2>&1 1> west.update.log || west update --path-cache /github/cache/embeint 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /github/cache/embeint)
west forall -c 'git reset --hard HEAD'
west blobs fetch hal_nordic nrf_wifi
echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV
- name: Install Zephyr Python packages
working-directory: zephyr
run: |
pip install -r scripts/requirements.txt
- name: Check Environment
run: |
cmake --version
gcc --version
ls -la /opt/toolchains
ls -la
echo "github.ref: ${{ github.ref }}"
echo "github.base_ref: ${{ github.base_ref }}"
echo "github.ref_name: ${{ github.ref_name }}"
- name: Set up ccache
run: |
mkdir -p ${CCACHE_DIR}
ccache -M 20G
ccache -p
ccache -z -s -vv
- if: github.event_name == 'pull_request'
name: Run Unit Tests with Twister (Pull Request)
run: |
export ZEPHYR_BASE=${PWD}/zephyr
$ZEPHYR_BASE/scripts/twister ${TWISTER_COMMON} ${UNIT_TESTING} -T infuse-sdk
- if: github.event_name == 'pull_request'
name: Run Tests with Twister (Pull Request)
run: |
export ZEPHYR_BASE=${PWD}/zephyr
$ZEPHYR_BASE/scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${VENDOR_FILTER} ${PR_OPTIONS} -T infuse-sdk
- if: github.event_name == 'schedule'
name: Run Unit Tests with Twister (Daily)
run: |
export ZEPHYR_BASE=${PWD}/zephyr
$ZEPHYR_BASE/scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${UNIT_TESTING} -T infuse-sdk
- if: github.event_name == 'schedule'
name: Run Board Tests with Twister (Daily)
run: |
export ZEPHYR_BASE=${PWD}/zephyr
$ZEPHYR_BASE/scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${EXTRA_BOARDS} ${DAILY_OPTIONS} -T infuse-sdk
- if: github.event_name == 'schedule'
name: Run Vendor Tests with Twister (Daily)
run: |
export ZEPHYR_BASE=${PWD}/zephyr
echo 'twister ${TWISTER_COMMON} ${VENDOR_FILTER} ${DAILY_OPTIONS} --all -T infuse-sdk/apps -T infuse-sdk/samples'
$ZEPHYR_BASE/scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${VENDOR_FILTER} ${DAILY_OPTIONS} --all -T infuse-sdk/apps -T infuse-sdk/samples
echo 'twister ${TWISTER_COMMON} ${VENDOR_FILTER} ${DAILY_OPTIONS} --integration -T infuse-sdk/tests'
$ZEPHYR_BASE/scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${VENDOR_FILTER} ${DAILY_OPTIONS} --integration -T infuse-sdk/tests
- name: Print ccache stats
if: always()
run: |
ccache -s -vv