From 13e6d4c2af66188e5c0a268681b2c7aeca97a68c Mon Sep 17 00:00:00 2001 From: Bill Mills Date: Thu, 17 Oct 2024 13:19:51 -0400 Subject: [PATCH] CI: Do Zephyr build tests on known good and latest versions Allow Zephyr testing to either use locked known good values or the very latest versions. This brings open-amp to parity with libmetal. Open-amp did not have the SDK URL discovery code so that was added here as part of this. The known good versions are best for PR checking as if the build fails it is almost always the PR itself that broke it. The latest version is good for periodically checking compatibility with the very latest Zephyr changes. For now we run both on pushes and PRs. We also run main against the latest zephyr check weekly as a look ahead. Signed-off-by: Bill Mills --- .github/actions/build_ci/entrypoint.sh | 36 +++++++++++---- .github/workflows/continuous-integration.yml | 32 +++++++++++-- .github/workflows/heathcheck.yml | 48 ++++++++++++++++++++ 3 files changed, 102 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/heathcheck.yml diff --git a/.github/actions/build_ci/entrypoint.sh b/.github/actions/build_ci/entrypoint.sh index 3ffddb03..4c57b274 100755 --- a/.github/actions/build_ci/entrypoint.sh +++ b/.github/actions/build_ci/entrypoint.sh @@ -2,13 +2,15 @@ readonly TARGET="$1" +# Known good version for PR testing +ZEPHYR_SDK_VERSION=v0.16.8 +ZEPHYR_VERSION=v3.7.0 + ZEPHYR_TOOLCHAIN_VARIANT=zephyr ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk -ZEPHYR_SDK_VERSION=0.16.1 -ZEPHYR_SDK_DOWNLOAD_FOLDER=https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v$ZEPHYR_SDK_VERSION -ZEPHYR_SDK_SETUP_DIR=zephyr-sdk-$ZEPHYR_SDK_VERSION -ZEPHYR_SDK_SETUP_TAR=${ZEPHYR_SDK_SETUP_DIR}_linux-x86_64.tar.xz -ZEPHYR_SDK_DOWNLOAD_URL=$ZEPHYR_SDK_DOWNLOAD_FOLDER/$ZEPHYR_SDK_SETUP_TAR +ZEPHYR_SDK_API_FOLDER=https://api.github.com/repos/zephyrproject-rtos/sdk-ng/releases +ZEPHYR_SDK_VER_SELECT="tags/$ZEPHYR_SDK_VERSION" +ZEPHYR_SDK_SETUP_TAR=zephyr-sdk-.*linux-x86_64.tar.xz FREERTOS_ZIP_URL=https://cfhcable.dl.sourceforge.net/project/freertos/FreeRTOS/V10.0.1/FreeRTOSv10.0.1.zip @@ -21,10 +23,10 @@ pre_build(){ python3 -m venv ./.venv source ./.venv/bin/activate - # add make and cmake + # add make, curl, and cmake # cmake from packages will work for 22.04 and later but use pip3 to get the latest on any distro - apt update || exit 1 - apt-get install -y make || exit 1 + apt update -qq || exit 1 + apt-get install -qqy make curl || exit 1 pip3 install cmake || exit 1 } @@ -89,6 +91,17 @@ build_freertos(){ } build_zephyr(){ + # find the SDK download URL + ZEPHYR_SDK_DOWNLOAD_URL=`curl -s ${ZEPHYR_SDK_API_FOLDER}/${ZEPHYR_SDK_VER_SELECT} | \ + grep -e "browser_download_url.*${ZEPHYR_SDK_SETUP_TAR}"| cut -d : -f 2,3 | tr -d \"` + echo "SDK URL=$ZEPHYR_SDK_DOWNLOAD_URL" + if [ -z "$ZEPHYR_SDK_DOWNLOAD_URL" ]; then + echo "error: Blank SDK download URL" + exit 2; + fi + ZEPHYR_SDK_TAR=`basename $ZEPHYR_SDK_DOWNLOAD_URL` + ZEPHYR_SDK_SETUP_DIR=`echo $ZEPHYR_SDK_TAR | cut -d_ -f1` + echo " Build for Zephyr OS " sudo apt-get install -y git cmake ninja-build gperf pv || exit 1 sudo apt-get install -y ccache dfu-util device-tree-compiler wget || exit 1 @@ -103,7 +116,7 @@ build_zephyr(){ pv $ZEPHYR_SDK_TAR -i 3 -ptebr -f | tar xJ || exit 1 rm -rf $ZEPHYR_SDK_INSTALL_DIR || exit 1 yes | ./$ZEPHYR_SDK_SETUP_DIR/setup.sh || exit 1 - west init ./zephyrproject || exit 1 + west init --mr $ZEPHYR_VERSION ./zephyrproject || exit 1 cd ./zephyrproject || exit 1 west update || exit 1 west zephyr-export || exit 1 @@ -143,6 +156,11 @@ main(){ if [[ "$TARGET" == "zephyr" ]]; then build_zephyr fi + if [[ "$TARGET" == "zephyr-latest" ]]; then + ZEPHYR_SDK_VER_SELECT=latest + ZEPHYR_VERSION=main + build_zephyr + fi } main diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 96743e39..028f7bc9 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -41,13 +41,35 @@ jobs: uses: ./open-amp/.github/actions/build_ci with: target: linux - - name: build for Zephyr - id: build_Zephyr - uses: ./open-amp/.github/actions/build_ci - with: - target: zephyr - name: build for generic arm id: build_generic uses: ./open-amp/.github/actions/build_ci with: target: generic + + # Break the zephyr builds into their own job as the common runner was + # running out of space when runs were together + # Also, as the longest running jobs, this allows them to run in || + zephyr_build_known_good_version: + name: Zephyr build with a version that is known to work + runs-on: ubuntu-latest + steps: + - name: Checkout open-amp + uses: actions/checkout@v4 + with: + path: open-amp + - name: Checkout libmetal + uses: actions/checkout@v4 + with: + repository: OpenAMP/libmetal + path: libmetal + - name: Checkout openamp-system-reference + uses: actions/checkout@v4 + with: + repository: OpenAMP/openamp-system-reference + path: openamp-system-reference + - name: build for Zephyr (Known Good) + id: build_Zephyr + uses: ./open-amp/.github/actions/build_ci + with: + target: zephyr diff --git a/.github/workflows/heathcheck.yml b/.github/workflows/heathcheck.yml new file mode 100644 index 00000000..054fdad0 --- /dev/null +++ b/.github/workflows/heathcheck.yml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2024 Linaro Limited. + +# The focus of this flow is to check for external changes that will effect +# the project. Even if no code changes are happening, changes in external +# distros or projects can invalidate our work and this flow lets us know + +name: open-amp Heath Check + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + paths-ignore: + - docs/** + + # Allows you to run this workflow manually from the Actions tab or gh API + workflow_dispatch: + + # run weekly on Sunday at 5:10 AM UTC (9:10 PM US western) + schedule: + - cron: '10 5 * * 0' + +jobs: + zephyr_build_main: + name: 'Zephyr build from latest on main' + runs-on: ubuntu-latest + steps: + - name: Checkout open-amp + uses: actions/checkout@v4 + with: + path: open-amp + - name: Checkout libmetal + uses: actions/checkout@v4 + with: + repository: OpenAMP/libmetal + path: libmetal + - name: Checkout openamp-system-reference + uses: actions/checkout@v4 + with: + repository: OpenAMP/openamp-system-reference + path: openamp-system-reference + - name: Zephyr Latest + id: build_Zephyr_latest + uses: ./open-amp/.github/actions/build_ci + with: + target: zephyr-latest