Skip to content

Commit

Permalink
ci: test ubuntu 24
Browse files Browse the repository at this point in the history
* updates ubuntu.sh adding support for ubuntu 24.04
* ubuntu.sh now expects by default any of the last two LTS
* runs ci in docker containers
  • Loading branch information
mrpollo committed Nov 13, 2024
1 parent ea1a6a3 commit 2d72529
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 64 deletions.
38 changes: 24 additions & 14 deletions .github/workflows/compile_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,34 @@ on:

jobs:
build_and_test:
name: Build and Test Ubuntu
# strategy:
# fail-fast: false
# matrix:
# version: [ubuntu22, ubuntu24]
runs-on: [runs-on,runner=8cpu-linux-x64,"image=ubuntu22-full-x64","run-id=${{ github.run_id }}"]
name: Build and Test
strategy:
fail-fast: false
matrix:
version: ['ubuntu:22.04', 'ubuntu:24.04']
runs-on: [runs-on,runner=8cpu-linux-x64,"image=ubuntu24-full-x64","run-id=${{ github.run_id }}"]
container:
image: ${{ matrix.version }}
volumes:
- /github/workspace:/github/workspace
steps:

- name: Fix git in container
run: |
# we only need this because we are running the job in a container
# when checkout pulls git it does it in a shared volume
# and file ownership changes between steps
# first we install git since its missing from the base image
# then we mark the directory as safe for other instances
# of git to use.
apt update && apt install git -y
git config --global --add safe.directory $(realpath .)
- uses: actions/checkout@v4

- name: Install Dependencies
- name: Install Deps, Build, and Make Quick Check
run: |
# we need to install dependencies and build on the same step
# given the stateless nature of docker images
./Tools/setup/ubuntu.sh
- name: Make Quick Check
run: |
make quick_check
# - name: Debug
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
92 changes: 42 additions & 50 deletions Tools/setup/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ done
if [ -f /.dockerenv ]; then
echo "Running within docker, installing initial dependencies";
apt-get --quiet -y update && DEBIAN_FRONTEND=noninteractive apt-get --quiet -y install \
ca-certificates \
gnupg \
lsb-core \
lsb-release \
sudo \
wget \
;
fi

Expand All @@ -62,17 +59,21 @@ sudo apt-get update -y --quiet
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
astyle \
build-essential \
ca-certificates \
cmake \
cppcheck \
file \
g++ \
gcc \
gdb \
git \
gnupg \
gosu \
lcov \
libssl-dev \
libxml2-dev \
libxml2-utils \
lsb-release \
make \
ninja-build \
python3 \
Expand All @@ -82,19 +83,27 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends i
python3-wheel \
rsync \
shellcheck \
software-properties-common \
sudo \
unzip \
wget \
zip \
;

# Python3 dependencies
echo
echo "Installing PX4 Python3 dependencies"
if [ -n "$VIRTUAL_ENV" ]; then
# virtual environments don't allow --user option
python -m pip install -r ${DIR}/requirements.txt
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
REQUIRED_VERSION="3.11"
if [[ "$(printf '%s\n' "$REQUIRED_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" == "$REQUIRED_VERSION" ]]; then
python3 -m pip install --break-system-packages -r ${DIR}/requirements.txt
else
# older versions of Ubuntu require --user option
python3 -m pip install --user -r ${DIR}/requirements.txt
if [ -n "$VIRTUAL_ENV" ]; then
# virtual environments don't allow --user option
python -m pip install -r ${DIR}/requirements.txt
else
python3 -m pip install --user -r ${DIR}/requirements.txt
fi
fi

# NuttX toolchain (arm-none-eabi-gcc)
Expand Down Expand Up @@ -155,39 +164,22 @@ if [[ $INSTALL_SIM == "true" ]]; then
bc \
;

if [[ "${UBUNTU_RELEASE}" == "18.04" ]]; then
java_version=11
elif [[ "${UBUNTU_RELEASE}" == "20.04" ]]; then
java_version=13
elif [[ "${UBUNTU_RELEASE}" == "22.04" ]]; then
java_version=11
elif [[ "${UBUNTU_RELEASE}" == "21.3" ]]; then
java_version=11
else
java_version=14
fi
# Java (jmavsim)
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
ant \
openjdk-$java_version-jre \
openjdk-$java_version-jdk \
libvecmath-java \
;

# Set Java 11 as default
sudo update-alternatives --set java $(update-alternatives --list java | grep "java-$java_version")

# Gazebo / Gazebo classic installation
if [[ "${UBUNTU_RELEASE}" == "22.04" ]]; then
echo "Gazebo (Harmonic) will be installed"
echo "Earlier versions will be removed"
# Add Gazebo binary repository
sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
if [[ "${UBUNTU_RELEASE}" == "18.04" || "${UBUNTU_RELEASE}" == "20.04" ]]; then
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
# Update list, since new gazebo-stable.list has been added
sudo apt-get update -y --quiet

# Install Gazebo
gazebo_packages="gz-harmonic"
# Install Gazebo classic
if [[ "${UBUNTU_RELEASE}" == "18.04" ]]; then
gazebo_classic_version=9
gazebo_packages="gazebo$gazebo_classic_version libgazebo$gazebo_classic_version-dev"
else
# default and Ubuntu 20.04
gazebo_classic_version=11
gazebo_packages="gazebo$gazebo_classic_version libgazebo$gazebo_classic_version-dev"
fi
elif [[ "${UBUNTU_RELEASE}" == "21.3" ]]; then
echo "Gazebo (Garden) will be installed"
echo "Earlier versions will be removed"
Expand All @@ -200,19 +192,19 @@ if [[ $INSTALL_SIM == "true" ]]; then
# Install Gazebo
gazebo_packages="gz-garden"
else
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
# Update list, since new gazebo-stable.list has been added
# Expects Ubuntu 22.04 > by default
echo "Gazebo (Harmonic) will be installed"
echo "Earlier versions will be removed"
# Add Gazebo binary repository
sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
sudo apt-get update -y --quiet

# Install Gazebo classic
if [[ "${UBUNTU_RELEASE}" == "18.04" ]]; then
gazebo_classic_version=9
gazebo_packages="gazebo$gazebo_classic_version libgazebo$gazebo_classic_version-dev"
else
# default and Ubuntu 20.04
gazebo_classic_version=11
gazebo_packages="gazebo$gazebo_classic_version libgazebo$gazebo_classic_version-dev"
# Install Gazebo
gazebo_packages="gz-harmonic libunwind-dev"

if [[ "${UBUNTU_RELEASE}" == "24.04" ]]; then
gazebo_packages="$gazebo_packages cppzmq-dev"
fi
fi

Expand Down

0 comments on commit 2d72529

Please sign in to comment.