Skip to content
Draft
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
120 changes: 70 additions & 50 deletions .github/workflows/zephyr-nightly.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Zephyr Nightly with ELD

on:
# pull_request: {} # Uncomment only to test this WF file update.
# FIXME: recomment
pull_request: {} # Uncomment only to test this WF file update.
schedule:
- cron: '0 9 * * *'
workflow_dispatch:
Expand All @@ -12,7 +13,7 @@ permissions:
jobs:
zephyr-build-and-test:
if: github.repository == 'qualcomm/eld' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
runs-on: self-hosted
env:
ZEPHYR_WORKSPACE: ${{ github.workspace }}/zephyrproject

Expand All @@ -22,30 +23,16 @@ jobs:
with:
path: llvm-project/llvm/tools/eld

- name: Record pre-build entry

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this not run on self-hosted runner?

if: github.event_name == 'schedule'
uses: ./llvm-project/llvm/tools/eld/.github/workflows/BuildStatusDataRecorder
with:
enabled: true
project: "llvm-project/llvm/tools/eld"
stage: "pre-"
workflow-name: "zephyr"
record-mode: "record"
status: "fail"
run-id: ${{github.run_id}}
arch-name: "riscv32"
branch-name: "main"

- name: Install dependencies
- name: Clean workspace
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libc++-dev libc++abi-dev libclang-rt-20-dev \
git cmake ninja-build gperf dfu-util device-tree-compiler wget \
python3-dev python3-pip python3-setuptools python3-tk python3-venv python3-wheel xz-utils \
file make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 qemu-system-riscv32
rm -rf ${{ env.ZEPHYR_WORKSPACE }}
rm -rf ${{ github.workspace }}/zephyr-sdk-*
rm -rf ${{ github.workspace }}/.cmake

- name: Set up Zephyr workspace
env:
HOME: ${{ github.workspace }}
run: |
python3 -m venv ${{ env.ZEPHYR_WORKSPACE }}/.venv
. ${{ env.ZEPHYR_WORKSPACE }}/.venv/bin/activate
python -m pip install -U pip
Expand All @@ -65,42 +52,69 @@ jobs:
run: |
echo "ZEPHYR_VENV=${{ env.ZEPHYR_WORKSPACE }}/.venv" >> $GITHUB_ENV

- name: Install Zephyr SDK
# FIXME: remove once wget issue is understood
- name: Debug wget
run: |
echo "=== wget version ==="
wget --version 2>&1 | head -3
echo ""
echo "=== wget verbose download test ==="
wget -v -O /dev/null --max-redirect=5 \
"https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.0/toolchain_gnu_linux-x86_64_riscv64-zephyr-elf.tar.xz" \
2>&1 | head -30 || true
echo ""
echo "=== wget with -N (as setup.sh uses) ==="
cd /tmp
wget -q --show-progress -N \
"https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.0/toolchain_gnu_linux-x86_64_riscv64-zephyr-elf.tar.xz" \
2>&1 | head -10 || echo "EXIT CODE: $?"
rm -f /tmp/toolchain_gnu_linux-x86_64_riscv64-zephyr-elf.tar.xz

- name: Install Zephyr SDK and RISC-V toolchain
env:
HOME: ${{ github.workspace }}
run: |
cd ${{ env.ZEPHYR_WORKSPACE }}
. ${{ env.ZEPHYR_WORKSPACE }}/.venv/bin/activate
west sdk install -t riscv64-zephyr-elf

- name: Install RISC-V toolchain payload
run: |
# Install minimal SDK (this works fine)
cd ${{ env.ZEPHYR_WORKSPACE }}
west sdk install

SDK_DIR=$(ls -d "$HOME"/zephyr-sdk-* 2>/dev/null | head -n 1)
if [ -z "$SDK_DIR" ]; then
echo "Failed to locate Zephyr SDK under $HOME"
ls -la "$HOME" || true
exit 1
fi
cd "$SDK_DIR"
./setup.sh -t riscv64-zephyr-elf

PICOLIBC_SYSROOT=${SDK_DIR}/riscv64-zephyr-elf/picolibc
PICOLIBC_LIB_DIR=${PICOLIBC_SYSROOT}/riscv64-zephyr-elf/lib/rv32imac_zicsr_zifencei/ilp32
GCC_INSTALL_DIR=${PICOLIBC_SYSROOT}/lib/gcc/riscv64-zephyr-elf/12.2.0
# setup.sh -t fails on self-hosted runners; download toolchain manually
SDK_VERSION=$(basename "$SDK_DIR" | sed 's/zephyr-sdk-//')
TOOLCHAIN_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${SDK_VERSION}/toolchain_gnu_linux-x86_64_riscv64-zephyr-elf.tar.xz"
echo "Downloading $TOOLCHAIN_URL"
curl -L "$TOOLCHAIN_URL" -o /tmp/riscv64-toolchain.tar.xz
tar xf /tmp/riscv64-toolchain.tar.xz -C "$SDK_DIR"
rm /tmp/riscv64-toolchain.tar.xz

if [ ! -d "$PICOLIBC_SYSROOT" ]; then
echo "Failed to locate picolibc sysroot: $PICOLIBC_SYSROOT"
find "${SDK_DIR}/riscv64-zephyr-elf" -maxdepth 2 -type d || true
exit 1
fi

if [ ! -d "$PICOLIBC_LIB_DIR" ]; then
echo "Failed to locate picolibc multilib dir: $PICOLIBC_LIB_DIR"
find "${PICOLIBC_SYSROOT}/riscv64-zephyr-elf/lib" -maxdepth 4 -type d || true
exit 1
fi

if [ ! -d "$GCC_INSTALL_DIR" ]; then
echo "Failed to locate gcc install dir: $GCC_INSTALL_DIR"
find "${PICOLIBC_SYSROOT}/lib/gcc/riscv64-zephyr-elf" -maxdepth 3 -type d || true
# Register SDK
cd "$SDK_DIR"
./setup.sh -h

TOOLCHAIN_DIR=$SDK_DIR/gnu/riscv64-zephyr-elf
PICOLIBC_SYSROOT=${TOOLCHAIN_DIR}/riscv64-zephyr-elf
PICOLIBC_LIB_DIR=${PICOLIBC_SYSROOT}/lib/rv32imac_zicsr_zifencei/ilp32
GCC_INSTALL_DIR=$(ls -d "${TOOLCHAIN_DIR}/lib/gcc/riscv64-zephyr-elf"/* 2>/dev/null | head -n 1)

for DIR in "$TOOLCHAIN_DIR" "$PICOLIBC_SYSROOT" "$PICOLIBC_LIB_DIR"; do
if [ ! -d "$DIR" ]; then
echo "ERROR: directory not found: $DIR"
find "$SDK_DIR" -maxdepth 5 -type d || true
exit 1
fi
done

if [ -z "$GCC_INSTALL_DIR" ] || [ ! -d "$GCC_INSTALL_DIR" ]; then
echo "ERROR: gcc install dir not found under: ${TOOLCHAIN_DIR}/lib/gcc/"
find "$TOOLCHAIN_DIR/lib/gcc" -maxdepth 3 -type d || true
exit 1
fi

Expand Down Expand Up @@ -156,7 +170,6 @@ jobs:
./scripts/twister -W -p qemu_riscv32 \
--inline-logs \
--timestamps \
-j 2 \
-v \
-x ZEPHYR_SDK_INSTALL_DIR=${{ env.ELD_SDK_DIR }} \
-x ZEPHYR_TOOLCHAIN_VARIANT=llvm \
Expand Down Expand Up @@ -202,3 +215,10 @@ jobs:
run-id: ${{github.run_id}}
arch-name: "riscv32"
branch-name: "main"

- name: Clean workspace
if: always()
run: |
rm -rf ${{ env.ZEPHYR_WORKSPACE }}
rm -rf ${{ github.workspace }}/zephyr-sdk-*
rm -rf ${{ github.workspace }}/.cmake
Loading