Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add test for Ubuntu 22.04 #23869

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
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
36 changes: 36 additions & 0 deletions .github/workflows/compile_ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Ubuntu environment build

on:
push:
branches:
- 'main'
- 'stable'
- 'beta'
- 'release/**'
pull_request:
branches:
- '*'

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 }}"]
steps:

- uses: actions/checkout@v4

- name: Install Dependencies
run: |
./Tools/setup/ubuntu.sh

- name: Make Quick Check
run: |
make quick_check

# - name: Debug
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,14 @@ include(px4_add_gtest)
if(BUILD_TESTING)
include(gtest)

set(TESTFILTERARG "")
Copy link
Member

@MaEtUgR MaEtUgR Nov 13, 2024

Choose a reason for hiding this comment

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

@mrpollo May I ask why this was changed? I breaks the unit test filter because it ignores the argument and just always leaves it empty. Can we revert that part?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason something within gtest/ctest was failing when running make tests. The failure was something like "Unknown -R argument."

What we did here is to avoid calling the test without -R when there's no argument to filter through.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure what you mean but this change just breaks the filter. Now when working on any branch from latest main I have to wait for all the tests for every single development iteration 👀 Should I open a pr to revert?

Copy link
Member

@MaEtUgR MaEtUgR Nov 19, 2024

Choose a reason for hiding this comment

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

I think I found the problem: #23978 😅


if(TESTFILTER)
set(TESTFILTERARG "-R ${TESTFILTER}")
endif()

add_custom_target(test_results
COMMAND GTEST_COLOR=1 ${CMAKE_CTEST_COMMAND} --output-on-failure -T Test -R ${TESTFILTER} USES_TERMINAL
COMMAND GTEST_COLOR=1 ${CMAKE_CTEST_COMMAND} --output-on-failure -T Test ${TESTFILTERARG}
DEPENDS
px4
examples__dyn_hello
Expand Down
68 changes: 11 additions & 57 deletions Tools/setup/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

## Bash script to setup PX4 development environment on Ubuntu LTS (22.04, 20.04, 18.04).
## Bash script to setup PX4 development environment on Ubuntu LTS (24.04, 22.04).
## Can also be used in docker.
##
## Installs:
Expand Down Expand Up @@ -53,23 +53,7 @@ fi
# check ubuntu version
# otherwise warn and point to docker?
UBUNTU_RELEASE="`lsb_release -rs`"

if [[ "${UBUNTU_RELEASE}" == "14.04" ]]; then
echo "Ubuntu 14.04 is no longer supported"
exit 1
elif [[ "${UBUNTU_RELEASE}" == "16.04" ]]; then
echo "Ubuntu 16.04 is no longer supported"
exit 1
elif [[ "${UBUNTU_RELEASE}" == "18.04" ]]; then
echo "Ubuntu 18.04"
elif [[ "${UBUNTU_RELEASE}" == "20.04" ]]; then
echo "Ubuntu 20.04"
elif [[ "${UBUNTU_RELEASE}" == "22.04" ]]; then
echo "Ubuntu 22.04"
elif [[ "${UBUNTU_RELEASE}" == "21.3" ]]; then
echo "Linux Mint 21.3"
fi

echo "Ubuntu ${UBUNTU_RELEASE}"

echo
echo "Installing PX4 general dependencies"
Expand All @@ -86,7 +70,7 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends i
gdb \
git \
lcov \
libfuse2 \
libssl-dev \
libxml2-dev \
libxml2-utils \
make \
Expand Down Expand Up @@ -126,68 +110,38 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
build-essential \
flex \
g++-multilib \
gcc-arm-none-eabi \
gcc-multilib \
gdb-multiarch \
genromfs \
gettext \
gperf \
kconfig-frontends \
libelf-dev \
libexpat-dev \
libgmp-dev \
libisl-dev \
libmpc-dev \
libmpfr-dev \
libncurses5 \
libncurses5-dev \
libncursesw5-dev \
libncurses-dev \
libncurses6 \
libncursesw6 \
libnewlib-arm-none-eabi \
libstdc++-arm-none-eabi-newlib \
libtool \
libunwind-dev \
pkg-config \
screen \
texinfo \
u-boot-tools \
util-linux \
vim-common \
;
if [[ "${UBUNTU_RELEASE}" == "20.04" || "${UBUNTU_RELEASE}" == "22.04" || "${UBUNTU_RELEASE}" == "21.3" ]]; then
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
kconfig-frontends \
;
fi


if [ -n "$USER" ]; then
# add user to dialout group (serial port access)
sudo usermod -aG dialout $USER
fi

# arm-none-eabi-gcc
NUTTX_GCC_VERSION="9-2020-q2-update"
NUTTX_GCC_VERSION_SHORT="9-2020q2"

source $HOME/.profile # load changed path for the case the script is reran before relogin
if [ $(which arm-none-eabi-gcc) ]; then
GCC_VER_STR=$(arm-none-eabi-gcc --version)
GCC_FOUND_VER=$(echo $GCC_VER_STR | grep -c "${NUTTX_GCC_VERSION}" || true)
fi

if [[ "$GCC_FOUND_VER" == "1" ]]; then
echo "arm-none-eabi-gcc-${NUTTX_GCC_VERSION} found, skipping installation"

else
echo "Installing arm-none-eabi-gcc-${NUTTX_GCC_VERSION}";
wget -O /tmp/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2 https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/${NUTTX_GCC_VERSION_SHORT}/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-${INSTALL_ARCH}-linux.tar.bz2 && \
sudo tar -jxf /tmp/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2 -C /opt/;

# add arm-none-eabi-gcc to user's PATH
exportline="export PATH=/opt/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}/bin:\$PATH"

if grep -Fxq "$exportline" $HOME/.profile; then
echo "${NUTTX_GCC_VERSION} path already set.";
else
echo $exportline >> $HOME/.profile;
source $HOME/.profile; # Allows to directly build NuttX targets in the same terminal
fi
fi
fi

# Simulation tools
Expand Down
Loading