Compare commits

...

1 Commits

Author SHA1 Message Date
Daniel Agar ad63ab4abd .github/workflows: expand ubuntu setup script test matrix 2024-11-20 16:13:18 -05:00
5 changed files with 156 additions and 132 deletions
-46
View File
@@ -1,46 +0,0 @@
name: Ubuntu environment build
on:
push:
branches:
- 'main'
- 'stable'
- 'beta'
- 'release/**'
pull_request:
branches:
- '*'
jobs:
build_and_test:
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 }}",spot=false]
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 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
make quick_check
+43
View File
@@ -0,0 +1,43 @@
name: PX4 setup script (ubuntu)
on:
push:
branches:
- 'main'
- 'stable'
- 'beta'
- 'release/**'
pull_request:
branches:
- '*'
jobs:
run_setup_and_test:
name: PX4 setup script
strategy:
fail-fast: false
matrix:
version: [
'ubuntu:22.04',
'ubuntu:24.04',
'ubuntu:24.10'
]
runs-on: [runs-on,runner=8cpu-linux-x64,"image=ubuntu24-full-x64","run-id=${{ github.run_id }}",spot=false]
container:
image: ${{ matrix.version }}
volumes:
- /github/workspace:/github/workspace
steps:
- name: Install git
run: |
# git needed for checkout in minimal container
apt-get update && apt-get install git -y
git config --global --add safe.directory '*'
- uses: actions/checkout@v4
- name: Run setup script and verify (make quick_check)
run: |
./Tools/setup/ubuntu.sh
make quick_check
+14 -86
View File
@@ -1,19 +1,18 @@
#! /usr/bin/env bash
set -e
#set -e
## Bash script to setup PX4 development environment on Ubuntu LTS (24.04, 22.04).
## Bash script to setup PX4 development environment on Ubuntu
## Can also be used in docker.
##
## Installs:
## - Common dependencies and tools for nuttx, jMAVSim, Gazebo
## - Common dependencies and tools for PX4 development
## - NuttX toolchain (omit with arg: --no-nuttx)
## - jMAVSim and Gazebo9 simulator (omit with arg: --no-sim-tools)
## - Gazebo simulator (omit with arg: --no-sim-tools)
##
INSTALL_NUTTX="true"
INSTALL_SIM="true"
INSTALL_ARCH=`uname -m`
# Parse arguments
for arg in "$@"
@@ -55,26 +54,29 @@ fi
# check ubuntu version
# otherwise warn and point to docker?
UBUNTU_RELEASE="`lsb_release -rs`"
echo "Ubuntu ${UBUNTU_RELEASE}"
echo
echo "Installing PX4 general dependencies"
sudo apt-get update -y --quiet
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
astyle \
bc \
build-essential \
cmake \
cppcheck \
curl \
file \
g++ \
gcc \
gdb \
git \
gnupg \
lcov \
libssl-dev \
libxml2-dev \
libxml2-utils \
lsb-release \
make \
ninja-build \
python3 \
@@ -88,9 +90,8 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends i
zip \
;
# Python3 dependencies
echo
echo "Installing PX4 Python3 dependencies"
# PX4 python dependencies
echo "Installing PX4 dependencies"
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
@@ -104,11 +105,10 @@ else
fi
fi
# NuttX toolchain (arm-none-eabi-gcc)
# NuttX toolchain
if [[ $INSTALL_NUTTX == "true" ]]; then
echo
echo "Installing NuttX dependencies"
echo "Installing PX4 NuttX dependencies"
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
automake \
@@ -154,78 +154,6 @@ fi
# Simulation tools
if [[ $INSTALL_SIM == "true" ]]; then
echo
echo "Installing PX4 simulation dependencies"
# General simulation dependencies
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
bc \
;
# Gazebo / Gazebo classic installation
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 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"
# 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 jammy main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
sudo apt-get update -y --quiet
# Install Gazebo
gazebo_packages="gz-garden"
else
# 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
gazebo_packages="gz-harmonic libunwind-dev"
if [[ "${UBUNTU_RELEASE}" == "24.04" ]]; then
gazebo_packages="$gazebo_packages cppzmq-dev"
fi
fi
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
dmidecode \
$gazebo_packages \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \
gstreamer1.0-libav \
libeigen3-dev \
libgstreamer-plugins-base1.0-dev \
libimage-exiftool-perl \
libopencv-dev \
libxml2-utils \
pkg-config \
protobuf-compiler \
;
if sudo dmidecode -t system | grep -q "Manufacturer: VMware, Inc." ; then
# fix VMWare 3D graphics acceleration for gazebo
echo "export SVGA_VGPU10=0" >> ~/.profile
fi
sudo ${DIR}/ubuntu_gazebo.sh
fi
+40
View File
@@ -0,0 +1,40 @@
#! /usr/bin/env bash
set -e
## Bash script to setup Gazebo for PX4 simulation
if [ "$(id -u)" -ne 0 ]; then
echo 'This script must be run by root' >&2
exit 1
fi
UBUNTU_RELEASE="`lsb_release -rs`"
export DEBIAN_FRONTEND=noninteractive
# First install some necessary tools:
apt-get update
apt-get -y --quiet --no-install-recommends install \
lsb-release \
curl \
gnupg \
;
if [[ "${UBUNTU_RELEASE}" == "24.04" ]]; then
apt-get -y --quiet --no-install-recommends install \
cppzmq-dev \
libunwind-dev \
;
fi
echo "Installing Gazebo (Harmonic)"
curl https://packages.osrfoundation.org/gazebo.gpg --output /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" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
apt-get update
apt-get -y --quiet --no-install-recommends install \
gz-harmonic \
;
+59
View File
@@ -0,0 +1,59 @@
#! /usr/bin/env bash
set -e
## Bash script to setup Gazebo classic for PX4 simulation
UBUNTU_RELEASE="`lsb_release -rs`"
if [[ "${UBUNTU_RELEASE}" == "20.04" ]]; then
echo "Installing Gazebo classic"
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 -
sudo apt-get update -y --quiet
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
gazebo11 \
gstreamer1.0-libav \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \
libeigen3-dev \
libgazebo11-dev \
libgstreamer-plugins-base1.0-dev \
libimage-exiftool-perl \
libopencv-dev \
libxml2-utils \
pkg-config \
protobuf-compiler \
;
elif [[ "${UBUNTU_RELEASE}" == "22.04" ]]; then
sudo add-apt-repository ppa:openrobotics/gazebo11-gz-cli
sudo apt-get update -y --quiet
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install gazebo11
elif [[ "${UBUNTU_RELEASE}" == "24.04" ]]; then
sudo add-apt-repository ppa:openrobotics/gazebo11-gz-cli
sudo apt-get update -y --quiet
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install gazebo11
else
# otherwise try the one-liner (no promises)
# First install some necessary tools:
sudo apt-get update -y --quiet
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
lsb-release \
curl \
gnupg \
;
# Install
curl -sSL http://get.gazebosim.org | sh
fi