diff --git a/.github/workflows/test_setup_tools.yml b/.github/workflows/test_setup_tools.yml new file mode 100644 index 000000000000..89da1076940a --- /dev/null +++ b/.github/workflows/test_setup_tools.yml @@ -0,0 +1,41 @@ +# NOTE: this workflow is now running on Dronecode / PX4 AWS account. +# - If you want to keep the tests running in GitHub Actions you need to uncomment the "runs-on: ubuntu-latest" lines +# and comment the "runs-on: [runs-on,runner=..." lines. +# - If you would like to duplicate this setup try setting up "RunsOn" on your own AWS account try https://runs-on.com + +name: Setup Tools Test (Ubuntu) + +on: + push: + branches: + - 'main' + - 'stable' + - 'beta' + - 'release/*' + pull_request: + branches: + - '*' + +jobs: + ubuntu-run: + strategy: + fail-fast: false + matrix: + version: [22, 24] + # runs-on: ubuntu-latest + runs-on: [runs-on,runner=8cpu-linux-x64,"image=ubuntu${{ matrix.version }}-full-x64","run-id=${{ github.run_id }}"] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # - name: ownership workaround + # run: git config --system --add safe.directory '*' + + - name: Install Dependencies + run: | + ./Tools/setup/ubuntu.sh + + - name: Make Default Build + run: | + make px4_sitl_default diff --git a/Tools/setup/ubuntu.sh b/Tools/setup/ubuntu.sh index 48e23709fb84..c7e8ef76250f 100755 --- a/Tools/setup/ubuntu.sh +++ b/Tools/setup/ubuntu.sh @@ -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, 20.04, 18.04). ## Can also be used in docker. ## ## Installs: @@ -49,28 +49,17 @@ if [[ ! -f "${DIR}/${REQUIREMENTS_FILE}" ]]; then return 1 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" +UBUNTU_RELEASE="$(lsb_release -rs)" +SUPPORTED_UBUNTU_VERSIONS=("18.04" "20.04" "22.04" "24.04") +if [[ ! " ${SUPPORTED_UBUNTU_VERSIONS[*]} " =~ ${UBUNTU_RELEASE} ]]; then + echo "Unsupported Ubuntu version: ${UBUNTU_RELEASE}" 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" +else + echo "Ubuntu ${UBUNTU_RELEASE}" fi - echo echo "Installing PX4 general dependencies" @@ -105,12 +94,17 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends i # 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) @@ -137,9 +131,6 @@ if [[ $INSTALL_NUTTX == "true" ]]; then libisl-dev \ libmpc-dev \ libmpfr-dev \ - libncurses5 \ - libncurses5-dev \ - libncursesw5-dev \ libtool \ pkg-config \ screen \ @@ -153,7 +144,36 @@ if [[ $INSTALL_NUTTX == "true" ]]; then kconfig-frontends \ ; fi - + if [[ "${UBUNTU_RELEASE}" == "22.04" ]]; then + sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \ + libunwind-dev \ + ; + fi + if [[ "${UBUNTU_RELEASE}" == "24.04" ]]; then + sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \ + kconfig-frontends \ + libncurses6 \ + libncurses-dev \ + libncursesw6 \ + libzmq3-dev \ + libunwind-dev \ + ; + + # Ubuntu 24.04 requires ZeroMQ + git clone https://github.com/zeromq/cppzmq.git + cd cppzmq + mkdir build + cd build + cmake .. + sudo make install + cd ../.. + else + sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \ + libncurses5 \ + libncurses5-dev \ + libncursesw5-dev \ + ; + fi if [ -n "$USER" ]; then # add user to dialout group (serial port access) @@ -209,6 +229,8 @@ if [[ $INSTALL_SIM == "true" ]]; then java_version=11 elif [[ "${UBUNTU_RELEASE}" == "21.3" ]]; then java_version=11 + elif [[ "${UBUNTU_RELEASE}" == "24.04" ]]; then + java_version=11 else java_version=14 fi @@ -224,7 +246,7 @@ if [[ $INSTALL_SIM == "true" ]]; then sudo update-alternatives --set java $(update-alternatives --list java | grep "java-$java_version") # Gazebo / Gazebo classic installation - if [[ "${UBUNTU_RELEASE}" == "22.04" ]]; then + if [[ "${UBUNTU_RELEASE}" == "22.04" || "${UBUNTU_RELEASE}" == "24.04" ]]; then echo "Gazebo (Harmonic) will be installed" echo "Earlier versions will be removed" # Add Gazebo binary repository