Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
qhdwight committed Sep 14, 2024
1 parent b4ed79e commit d0ca75a
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 62 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI
on:
pull_request:
branches:
- master
- integration
push:
branches:
- master
jobs:
ci:
name: CI
runs-on: ubuntu-latest
container:
image: umrover1/ros:latest
# GitHub is silly and requires us to be running as root for their checkout action
# Our docker container exports the user mrover, so we have to specific this explicitly
options: --user root
steps:
- uses: actions/checkout@v4
with:
lfs: "true"
# This makes sure that $GITHUB_WORKSPACE is the catkin workspace path
path: "src/mrover"
- name: Style Check
run: . /home/mrover/ros2_ws/src/mrover/venv/bin/activate && cd $GITHUB_WORKSPACE/src/mrover/ && ./style.sh
- name: Build
if: github.event.pull_request.draft == false && github.event.pull_request.base.ref != 'refs/heads/master'
run: . /opt/ros/humble/setup.sh && . /home/mrover/ros2_ws/src/mrover/venv/bin/activate && ./build.sh
# - name: Test
# if: github.event.pull_request.draft == false
# run: . /opt/ros/noetic/setup.sh && . /home/mrover/ros2_ws/src/mrover/venv/bin/activate && . $GITHUB_WORKSPACE/devel/setup.sh && catkin test && rostest mrover integration.test --text
16 changes: 15 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
# ROS2 build directories
/build/
/install/
/log/

__pycache__/
# Common IDE's, ideally this should be in global gitignore per user
.vscode/
.idea/

# clangd cache
.cache/

# IMGUI window layout
imgui.ini

# Python Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
.mypy_cache/
*.egg-info/
venv/
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:jammy

# DEBIAN_FRONTEND=noninteractive prevents apt from asking for user input
# software-properties-common is needed for apt-add-repository
# sudo is needed for ansible since it escalates from a normal user to root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get install software-properties-common sudo -y
RUN apt-add-repository ppa:ansible/ansible -y && apt-get install -y git git-lfs ansible

RUN useradd --create-home --groups sudo --shell /bin/zsh mrover
# Give mrover user sudo access with no password
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER mrover
RUN mkdir -p /home/mrover/ros2_ws/src/mrover
WORKDIR /home/mrover/ros2_ws/src/mrover
# Defines the APT packages that need to be installed
# rosdep is called from Ansible to install them
ADD --chown=mrover:mrover ./package.xml .
# Defines the Python packages that need to be installed
# pip is called from Ansible to install them
ADD --chown=mrover:mrover ./pyproject.toml .
ADD --chown=mrover:mrover ./README.md .
# Copy over all Ansible files
ADD --chown=mrover:mrover ./ansible ./ansible
ADD --chown=mrover:mrover ./ansible.sh .
ADD --chown=mrover:mrover ./pkg ./pkg
RUN ./ansible.sh ci.yml

USER root
RUN apt-get purge ansible -y && apt-get autoremove -y
# Remove apt cache to free up space in the image
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

USER mrover
ENTRYPOINT [ "/bin/bash" ]
7 changes: 2 additions & 5 deletions ansible/roles/build/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@
- unzip
- rsync
- python3-pip
- python3-dev
- python3-venv
- python3-rosdep
- python3-virtualenvwrapper
- clang-18
- clangd-18
- clang-tidy-18
Expand All @@ -82,10 +83,6 @@
- lldb-18
- gcc-13
- g++-13
- python3.10
- python3.10-dev
- python3.10-venv
- lld
- libbullet-dev
- libglfw3-dev
- libx11-xcb-dev
Expand Down
143 changes: 87 additions & 56 deletions ansible/roles/ci/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Allows us to install Python versions newer than 3.8
- name: Add Python PPA
become: True
apt_repository:
repo: ppa:deadsnakes/ppa
# # Allows us to install Python versions newer than 3.10 (unused since Ubuntu 22 upgrade)
# - name: Add Python PPA
# become: True
# apt_repository:
# repo: ppa:deadsnakes/ppa

# Allows us to install G++13, so we can use an updated libstdc++ which provides more standard library features (C++20)
- name: Add GCC PPA
Expand All @@ -15,11 +15,11 @@
apt_key:
url: https://apt.llvm.org/llvm-snapshot.gpg.key

# Allows us to install Clang 16 and other LLVM tools
# Allows us to install LLVM tools
- name: Add LLVM APT List
become: True
apt_repository:
repo: deb http://apt.llvm.org/{{ ubuntu_release }}/ llvm-toolchain-{{ ubuntu_release }}-16 main
repo: deb http://apt.llvm.org/{{ ubuntu_release }}/ llvm-toolchain-{{ ubuntu_release }}-18 main
filename: llvm

- name: Add CMake APT Key
Expand All @@ -28,7 +28,7 @@
url: https://apt.kitware.com/keys/kitware-archive-latest.asc
keyring: /usr/share/keyrings/kitware-archive-keyring.gpg

# Allows us to install CMake versions newer than 3.16
# Allows us to install CMake versions newer than 3.22
- name: Add CMake APT List
become: True
apt_repository:
Expand All @@ -38,12 +38,12 @@
- name: Add ROS APT Key
become: True
apt_key:
url: https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc
url: https://raw.githubusercontent.com/ros/rosdistro/master/ros.key

- name: Add ROS APT List
become: True
apt_repository:
repo: deb http://packages.ros.org/ros/ubuntu {{ ubuntu_release }} main
repo: deb http://packages.ros.org/ros2/ubuntu {{ ubuntu_release }} main
filename: ros

- name: Upgrade APT Packages
Expand All @@ -59,27 +59,48 @@
cache_valid_time: 604800
state: latest
name:
# - zsh
# - fzf
# - neovim
# - sudo
- cmake
# - ccache # Caches intermediate build files, speeds up compilation over time
- ninja-build # Faster than make
# - tmux
# - htop
# - curl
# - unzip
- rsync
- python3-pip
- python3-dev
- python3-venv
- python3-rosdep
- python3-catkin-tools
- clang-tidy-16
- clang-format-16
- lld-16
- clang-18
# - clangd-18
- clang-tidy-18
- clang-format-18
- lld-18
# - lldb-18
- gcc-13
- g++-13
- python3.10
- python3.10-dev
- python3.10-venv
- libbullet-dev
- libglfw3-dev
- libx11-xcb-dev
- libnl-3-dev
- libnl-route-3-dev
- libtbb-dev
- libassimp-dev
- libeigen3-dev
- libopencv-dev
- libgstreamer1.0-dev
- libgstreamer-plugins-base1.0-dev
# - vainfo
# - x264
- ros-humble-ros-base
- ros-humble-rviz2
- ros-humble-xacro
# TODO (ali): why does this need to be installed manually
- libboost-dev

- name: Install Local APT Packages
become: True
Expand All @@ -100,31 +121,25 @@
- name: Update rosdep
command: rosdep update

- name: Install ROS Packages
command: rosdep install --from-paths {{ ros2_workspace }}/src --ignore-src -y --rosdistro={{ ros_distro }}

#- name: Download Bun Installer
# get_url:
# url: https://bun.sh/install
# dest: /tmp/bun_installer.sh
# mode: 0755
#
#- name: Run Bun Installer
# command: /tmp/bun_installer.sh
# args:
# creates: ~/.bun/bin/bun
#
#- name: Upgrade Bun
# command: ~/.bun/bin/bun upgrade
#
#- name: Install Bun Packages
# command: ~/.bun/bin/bun install --cwd {{ catkin_workspace }}/src/mrover/src/teleoperation/frontend

#- name: Install Catkin Profiles
# synchronize:
# src: files/profiles
# dest: "{{ catkin_workspace }}/.catkin_tools"
# recursive: true
# - name: Install ROS Packages
# # command: rosdep install --from-paths {{ ros2_workspace }}/src --ignore-src -y --rosdistro={{ ros_distro }}

# - name: Download Bun Installer
# get_url:
# url: https://bun.sh/install
# dest: /tmp/bun_installer.sh
# mode: 0755

# - name: Run Bun Installer
# command: /tmp/bun_installer.sh
# args:
# creates: ~/.bun/bin/bun

# - name: Upgrade Bun
# command: ~/.bun/bin/bun upgrade

# - name: Install Bun Packages
# command: ~/.bun/bin/bun install --cwd {{ catkin_workspace }}/src/mrover/src/teleoperation/frontend

- name: Set G++ 13 as Default
become: True
Expand All @@ -142,34 +157,50 @@
link: /usr/bin/gcc
priority: 130

#- name: Set clangd 16 as Default
# become: True
# alternatives:
# name: clangd
# path: /usr/bin/clangd-16
# link: /usr/bin/clangd
# priority: 160
- name: Set clang++18 as Default
become: True
alternatives:
name: clang++
path: /usr/bin/clang++-18
link: /usr/bin/clang++
priority: 180

- name: Set clang-18 as Default
become: True
alternatives:
name: clang
path: /usr/bin/clang-18
link: /usr/bin/clang
priority: 180

# - name: Set clangd 18 as Default
# become: True
# alternatives:
# name: clangd
# path: /usr/bin/clangd-18
# link: /usr/bin/clangd
# priority: 180

- name: Set LLD 16 as Default
- name: Set LLD 18 as Default
become: True
alternatives:
name: lld
path: /usr/bin/lld-16
path: /usr/bin/lld-18
link: /usr/bin/lld
priority: 160
priority: 180

- name: Set clang-tidy 16 as Default
- name: Set clang-tidy 18 as Default
become: True
alternatives:
name: clang-tidy
path: /usr/bin/clang-tidy-16
path: /usr/bin/clang-tidy-18
link: /usr/bin/clang-tidy
priority: 160
priority: 180

- name: Setup Python Virtual Environment
pip:
name:
# Installs from pyproject.toml
- "{{ ros2_workspace }}/src/mrover[dev]"
virtualenv: "{{ ros2_workspace }}/src/mrover/venv"
virtualenv_command: /usr/bin/python3.10 -m venv
virtualenv_command: /usr/bin/python3 -m venv

0 comments on commit d0ca75a

Please sign in to comment.