Skip to content

Commit

Permalink
CI: Update for Ubuntu 24.04
Browse files Browse the repository at this point in the history
Update CI to work with 24.04.

* Lock to 24.04 so we control when to change
* Update locale and timezone to work for 24.04 or 22.04
  * 24.04 creates these files if not already there but 22.04 does not
  * Keep existing work around for 22.04 but make it work if already there
* Move support of ~/.local/bin to global level
  * Create dir in dockerfile (will cover interactive shells)
  * Modify path directly in pre_build (for non-interactive case)
  * Desktop testing of CI needs non-interactive case
  * (It is not clear to me how this was working in github actions)
* Use pip3 user mode everywhere
  * Before it used a mix of global and user.  Use --user everywhere
  * In 24.04 even --user mode needs --break-system-packages
  * There seems to be some debate if --user should need this but does ATM
* Add section to README about desktop testing
* Also fix usage formatting in README

Patch versions: V1 by Arnaud, V2 by Bill

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Bill Mills <bill.mills@linaro.org>
  • Loading branch information
arnopo committed May 6, 2024
1 parent 46c5b6f commit 74cb99c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .github/actions/build_ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM ubuntu:latest
FROM ubuntu:24.04

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

# If this dir exists, then global bashrc scripts will take care of adding it to the path
RUN mkdir -p /root/.local/bin

# Install prerequisites
RUN apt-get --quiet=2 update && apt-get install --quiet=2 --assume-yes sudo git python3 python3-pip wget

Expand Down
23 changes: 22 additions & 1 deletion .github/actions/build_ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ The supported targets are:

## Example usage

Inside a github action use:
```
uses: ./.github/actions/build_ci
with:
target: linux
target: linux
```

## Desktop testing

Right now the directory expectations of the CI script are very messy.
This should be cleaned up in a future PR.

Desktop testing is possible but is likewise messy right now.

One time setup, starting in open-amp directory:
```
$ git clone https://github.com/OpenAMP/libmetal.git
```

A sequence like below will work, change the "zephyr" at the end of the docker command line to "linux" or "generic" for the other working tests
```
$ docker build -t openamp-ci .github/actions/build_ci/ && docker run -it --rm -v$PWD:/prj -w /prj openamp-ci zephyr
$ sudo rm -rf build* zephyr*
```
20 changes: 12 additions & 8 deletions .github/actions/build_ci/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ ZEPHYR_SDK_DOWNLOAD_URL=$ZEPHYR_SDK_DOWNLOAD_FOLDER/$ZEPHYR_SDK_SETUP_TAR
FREERTOS_ZIP_URL=https://cfhcable.dl.sourceforge.net/project/freertos/FreeRTOS/V10.0.1/FreeRTOSv10.0.1.zip

pre_build(){
# fix issue related to tzdata install
# fix issue related to tzdata install, not needed for 24.04 but kept for 22.04 and earlier
echo 'Etc/UTC' > /etc/timezone || exit 1
ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime || exit 1
ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime || exit 1

# use ~/.local/bin even for non-interactive shells
# The user's default .profile will do this if the dir exists but only for interactive shells
PATH=~/.local/bin:$PATH

# add make and cmake
# cmake from packages will work for 22.04 and later but use pip to get the latest on any distro

Check warning on line 25 in .github/actions/build_ci/entrypoint.sh

View workflow job for this annotation

GitHub Actions / checkpatch review

LONG_LINE

.github/actions/build_ci/entrypoint.sh:25 line over 100 characters

Check warning on line 25 in .github/actions/build_ci/entrypoint.sh

View workflow job for this annotation

GitHub Actions / checkpatch review

LONG_LINE

.github/actions/build_ci/entrypoint.sh:25 line over 100 characters
apt update || exit 1
apt-get install -y make || exit 1
sudo pip3 install cmake || exit 1
pip3 install --user -U --break-system-packages cmake || exit 1
}

build_linux(){
Expand Down Expand Up @@ -80,10 +87,7 @@ build_zephyr(){
sudo apt-get install -y python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file || exit 1
sudo apt-get install -y make gcc gcc-multilib g++-multilib libsdl2-dev || exit 1
sudo apt-get install -y libc6-dev-i386 gperf g++ python3-ply python3-yaml device-tree-compiler ncurses-dev uglifyjs -qq || exit 1
sudo pip3 install pyelftools || exit 1
pip3 install --user -U west
echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc
source ~/.bashrc
pip3 install --user -U --break-system-packages pyelftools west || exit 1

wget $ZEPHYR_SDK_DOWNLOAD_URL || exit 1
tar xvf $ZEPHYR_SDK_SETUP_TAR || exit 1
Expand All @@ -93,7 +97,7 @@ build_zephyr(){
cd ./zephyrproject || exit 1
west update || exit 1
west zephyr-export || exit 1
pip3 install --user -r ./zephyr/scripts/requirements.txt || exit 1
pip3 install --user -U --break-system-packages -r ./zephyr/scripts/requirements.txt || exit 1

Check warning on line 100 in .github/actions/build_ci/entrypoint.sh

View workflow job for this annotation

GitHub Actions / checkpatch review

LONG_LINE

.github/actions/build_ci/entrypoint.sh:100 line over 100 characters

Check warning on line 100 in .github/actions/build_ci/entrypoint.sh

View workflow job for this annotation

GitHub Actions / checkpatch review

LONG_LINE

.github/actions/build_ci/entrypoint.sh:100 line over 100 characters
echo "Update zephyr OpenAMP repos"
#Update zephyr OpenAMP repos
cp -r ../lib modules/lib/open-amp/open-amp/ || exit 1
Expand Down

0 comments on commit 74cb99c

Please sign in to comment.