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

Containerize the non-ros testing pipeline #161

Merged
merged 18 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 17 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
43 changes: 29 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,42 @@ concurrency:
cancel-in-progress: true

jobs:
# Pure Python testing
# Build and test the base, non-ROS image
python-test:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
- name: Login to Docker Hub Registry
uses: docker/login-action@v3
with:
python-version: '3.10'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -e pyrobosim
pip3 install -r test/python_test_requirements.txt
setup/setup_pddlstream.bash
- name: Run unit tests
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PAT }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Build Docker image
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
target: pyrobosim
context: .
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:base
push: true
cache-from: |
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:buildcache-base
cache-to: |
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:buildcache-base,mode=max
- name: Run tests
run: |
export PYTHONPATH=./dependencies/pddlstream:$PYTHONPATH
test/run_tests.bash
docker run \
-w /opt/pyrobosim \
--volume ./test/results:/opt/pyrobosim/test/results:rw \
${{ secrets.DOCKERHUB_USERNAME }}/pyrobosim:base \
/bin/bash -c 'PYTHONPATH=./dependencies/pddlstream:$PYTHONPATH ./test/run_tests.bash'
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
Expand Down Expand Up @@ -65,7 +79,7 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Login to DockerHub Registry
- name: Login to Docker Hub Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -78,6 +92,7 @@ jobs:
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
target: pyrobosim_ros
context: .
build-args: |
ROS_DISTRO=${{ matrix.ros_distro }}
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@

services:
base:
image: pyrobosim:${ROS_DISTRO:-humble}
image: pyrobosim_ros:${ROS_DISTRO:-humble}
build:
context: .
dockerfile: docker/Dockerfile
target: pyrobosim_ros
args:
ROS_DISTRO: ${ROS_DISTRO:-humble}
# Ensures signals are actually passed and reaped in the container for shutdowns.
Expand Down
49 changes: 47 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,52 @@
# Dockerfile for pyrobosim builds with and without ROS
ARG ROS_DISTRO=humble

# pyrobosim Dockerfile for Ubuntu / ROS
FROM osrf/ros:${ROS_DISTRO}-desktop
##################################
#
# base pyrobosim build for Ubuntu
#
##################################
FROM ubuntu:latest as pyrobosim

# Install dependencies
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update &&\
apt-get install -y \
apt-utils \
python3 \
python3-pip \
python3-tk \
git \
cmake \
ffmpeg \
libsm6 \
libxext6

RUN mkdir -p /opt/pyrobosim/test
RUN mkdir -p /opt/pyrobosim/setup
WORKDIR /opt/pyrobosim/

# Install baseline pip dependencies
COPY test/python_test_requirements.txt test/
RUN pip3 install -r test/python_test_requirements.txt

# Install PDDL
COPY setup/setup_pddlstream.bash setup/
RUN setup/setup_pddlstream.bash

# Copy the rest of the source directory
COPY . /opt/pyrobosim/
RUN pip3 install -e pyrobosim

# Start it up
CMD /bin/bash

##################################
#
# pyrobosim build for Ubuntu / ROS
#
##################################
FROM osrf/ros:${ROS_DISTRO}-desktop as pyrobosim_ros
ENV ROS_DISTRO=${ROS_DISTRO}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

Expand Down
Loading