Skip to content

Commit 3541b57

Browse files
wmamillsarnopo
authored andcommitted
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 <bill.mills@linaro.org>
1 parent 6a5fdf1 commit 3541b57

3 files changed

Lines changed: 102 additions & 14 deletions

File tree

.github/actions/build_ci/entrypoint.sh

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
readonly TARGET="$1"
44

5+
# Known good version for PR testing
6+
ZEPHYR_SDK_VERSION=v0.16.8
7+
ZEPHYR_VERSION=v3.7.0
8+
59
ZEPHYR_TOOLCHAIN_VARIANT=zephyr
610
ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
7-
ZEPHYR_SDK_VERSION=0.16.1
8-
ZEPHYR_SDK_DOWNLOAD_FOLDER=https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v$ZEPHYR_SDK_VERSION
9-
ZEPHYR_SDK_SETUP_DIR=zephyr-sdk-$ZEPHYR_SDK_VERSION
10-
ZEPHYR_SDK_SETUP_TAR=${ZEPHYR_SDK_SETUP_DIR}_linux-x86_64.tar.xz
11-
ZEPHYR_SDK_DOWNLOAD_URL=$ZEPHYR_SDK_DOWNLOAD_FOLDER/$ZEPHYR_SDK_SETUP_TAR
11+
ZEPHYR_SDK_API_FOLDER=https://api.github.com/repos/zephyrproject-rtos/sdk-ng/releases
12+
ZEPHYR_SDK_VER_SELECT="tags/$ZEPHYR_SDK_VERSION"
13+
ZEPHYR_SDK_SETUP_TAR=zephyr-sdk-.*linux-x86_64.tar.xz
1214

1315
FREERTOS_ZIP_URL=https://cfhcable.dl.sourceforge.net/project/freertos/FreeRTOS/V10.0.1/FreeRTOSv10.0.1.zip
1416

@@ -21,10 +23,10 @@ pre_build(){
2123
python3 -m venv ./.venv
2224
source ./.venv/bin/activate
2325

24-
# add make and cmake
26+
# add make, curl, and cmake
2527
# cmake from packages will work for 22.04 and later but use pip3 to get the latest on any distro
26-
apt update || exit 1
27-
apt-get install -y make || exit 1
28+
apt update -qq || exit 1
29+
apt-get install -qqy make curl || exit 1
2830
pip3 install cmake || exit 1
2931
}
3032

@@ -89,6 +91,17 @@ build_freertos(){
8991
}
9092

9193
build_zephyr(){
94+
# find the SDK download URL
95+
ZEPHYR_SDK_DOWNLOAD_URL=`curl -s ${ZEPHYR_SDK_API_FOLDER}/${ZEPHYR_SDK_VER_SELECT} | \
96+
grep -e "browser_download_url.*${ZEPHYR_SDK_SETUP_TAR}"| cut -d : -f 2,3 | tr -d \"`
97+
echo "SDK URL=$ZEPHYR_SDK_DOWNLOAD_URL"
98+
if [ -z "$ZEPHYR_SDK_DOWNLOAD_URL" ]; then
99+
echo "error: Blank SDK download URL"
100+
exit 2;
101+
fi
102+
ZEPHYR_SDK_TAR=`basename $ZEPHYR_SDK_DOWNLOAD_URL`
103+
ZEPHYR_SDK_SETUP_DIR=`echo $ZEPHYR_SDK_TAR | cut -d_ -f1`
104+
92105
echo " Build for Zephyr OS "
93106
sudo apt-get install -y git cmake ninja-build gperf pv || exit 1
94107
sudo apt-get install -y ccache dfu-util device-tree-compiler wget || exit 1
@@ -103,7 +116,7 @@ build_zephyr(){
103116
pv $ZEPHYR_SDK_TAR -i 3 -ptebr -f | tar xJ || exit 1
104117
rm -rf $ZEPHYR_SDK_INSTALL_DIR || exit 1
105118
yes | ./$ZEPHYR_SDK_SETUP_DIR/setup.sh || exit 1
106-
west init ./zephyrproject || exit 1
119+
west init --mr $ZEPHYR_VERSION ./zephyrproject || exit 1
107120
cd ./zephyrproject || exit 1
108121
west update || exit 1
109122
west zephyr-export || exit 1
@@ -143,6 +156,11 @@ main(){
143156
if [[ "$TARGET" == "zephyr" ]]; then
144157
build_zephyr
145158
fi
159+
if [[ "$TARGET" == "zephyr-latest" ]]; then
160+
ZEPHYR_SDK_VER_SELECT=latest
161+
ZEPHYR_VERSION=main
162+
build_zephyr
163+
fi
146164
}
147165

148166
main

.github/workflows/continuous-integration.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,35 @@ jobs:
4141
uses: ./open-amp/.github/actions/build_ci
4242
with:
4343
target: linux
44-
- name: build for Zephyr
45-
id: build_Zephyr
46-
uses: ./open-amp/.github/actions/build_ci
47-
with:
48-
target: zephyr
4944
- name: build for generic arm
5045
id: build_generic
5146
uses: ./open-amp/.github/actions/build_ci
5247
with:
5348
target: generic
49+
50+
# Break the zephyr builds into their own job as the common runner was
51+
# running out of space when runs were together
52+
# Also, as the longest running jobs, this allows them to run in ||
53+
zephyr_build_known_good_version:
54+
name: Zephyr build with a version that is known to work
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout open-amp
58+
uses: actions/checkout@v4
59+
with:
60+
path: open-amp
61+
- name: Checkout libmetal
62+
uses: actions/checkout@v4
63+
with:
64+
repository: OpenAMP/libmetal
65+
path: libmetal
66+
- name: Checkout openamp-system-reference
67+
uses: actions/checkout@v4
68+
with:
69+
repository: OpenAMP/openamp-system-reference
70+
path: openamp-system-reference
71+
- name: build for Zephyr (Known Good)
72+
id: build_Zephyr
73+
uses: ./open-amp/.github/actions/build_ci
74+
with:
75+
target: zephyr

.github/workflows/heathcheck.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright (c) 2024 Linaro Limited.
3+
4+
# The focus of this flow is to check for external changes that will effect
5+
# the project. Even if no code changes are happening, changes in external
6+
# distros or projects can invalidate our work and this flow lets us know
7+
8+
name: open-amp Heath Check
9+
10+
on:
11+
push:
12+
branches: [ main ]
13+
pull_request:
14+
branches: [ main ]
15+
paths-ignore:
16+
- docs/**
17+
18+
# Allows you to run this workflow manually from the Actions tab or gh API
19+
workflow_dispatch:
20+
21+
# run weekly on Sunday at 5:10 AM UTC (9:10 PM US western)
22+
schedule:
23+
- cron: '10 5 * * 0'
24+
25+
jobs:
26+
zephyr_build_main:
27+
name: 'Zephyr build from latest on main'
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout open-amp
31+
uses: actions/checkout@v4
32+
with:
33+
path: open-amp
34+
- name: Checkout libmetal
35+
uses: actions/checkout@v4
36+
with:
37+
repository: OpenAMP/libmetal
38+
path: libmetal
39+
- name: Checkout openamp-system-reference
40+
uses: actions/checkout@v4
41+
with:
42+
repository: OpenAMP/openamp-system-reference
43+
path: openamp-system-reference
44+
- name: Zephyr Latest
45+
id: build_Zephyr_latest
46+
uses: ./open-amp/.github/actions/build_ci
47+
with:
48+
target: zephyr-latest

0 commit comments

Comments
 (0)