Skip to content

Commit

Permalink
fix CI, update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-labs committed Jul 30, 2024
1 parent 0ac88f6 commit c503f25
Show file tree
Hide file tree
Showing 38 changed files with 325 additions and 148 deletions.
37 changes: 16 additions & 21 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG ROS_DISTRO=humble

FROM ros:${ROS_DISTRO}-ros-base
FROM osrf/ros:${ROS_DISTRO}-desktop-full
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

##############################################################################
## Global Dependencies ##
## Global Dependencies ##
##############################################################################
# Install libraries for rendering
# hadolint ignore=DL3008
Expand Down Expand Up @@ -35,15 +35,17 @@ RUN chmod +x /ros_entrypoint.sh
##############################################################################
## Scenario Execution Dependencies ##
##############################################################################
# hadolint ignore=DL3008
RUN --mount=type=bind,target=/tmp_setup apt-get update \
&& xargs -a "/tmp_setup/.devcontainer/deb_requirements_${ROS_DISTRO}.txt" apt-get install -y --no-install-recommends "ros-${ROS_DISTRO}-rosbag2-storage-mcap" \
&& rm -rf /var/lib/apt/lists/*

# hadolint ignore=DL3013
RUN --mount=type=bind,target=/tmp_setup \
python3 -m pip install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -r /tmp_setup/requirements.txt

RUN --mount=type=bind,target=/tmp_setup export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
xargs -a /tmp_setup/deb_requirements.txt apt-get install -y --no-install-recommends && \
rosdep update --rosdistro="${ROS_DISTRO}" && \
for d in /tmp_setup/*; do \
[[ ! -d "$d" ]] && continue; \
[[ "$(basename $d)" =~ ^(install|build|log)$ ]] && continue; \
rosdep install --rosdistro="${ROS_DISTRO}" --from-paths "$d" --ignore-src -r -y; \
done && \
rm -rf /var/lib/apt/lists/*

##############################################################################
## Create Non-root User ##
Expand All @@ -60,19 +62,13 @@ RUN groupadd -g "$GID" "$USER" && \
echo "$USER:$PASSWORD" | chpasswd && \
echo "%sudo ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudogrp

RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /etc/bash.bashrc
USER $USER


##############################################################################
## Build ROS and run ##
## Setup ROS environment ##
##############################################################################

RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /etc/bash.bashrc
USER $USER
WORKDIR /workspace
RUN . "/opt/ros/$ROS_DISTRO/setup.sh" \
&& colcon build
# --symlink-install

RUN printf "if [ -f /workspace/install/setup.bash ]; then \n\
source /workspace/install/setup.bash \n\
else \n\
Expand All @@ -81,4 +77,3 @@ RUN printf "if [ -f /workspace/install/setup.bash ]; then \n\

# Switch to cyclonedds
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ENV IGN_FILE_PATH=/workspace/install/tb4_sim_scenario/share/
9 changes: 5 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"context": "..",
"dockerfile": "Dockerfile",
"args": {
"USERNAME": "ros"
"USERNAME": "ros",
"http_proxy": "${env:http_proxy}",
"https_proxy": "${env:https_proxy}",
"no_proxy": "${env:no_proxy}",
"NO_PROXY": "${env:NO_PROXY}",
"NO_PROXY": "${env:NO_PROXY}"
}
},
"workspaceFolder": "/workspace",
Expand All @@ -25,7 +25,8 @@
"twxs.cmake",
"donjayamanne.python-extension-pack",
"eamodio.gitlens",
"ms-iot.vscode-ros"
"ms-iot.vscode-ros",
"BenjaminEngel.asam-osc2"
]
}
},
Expand All @@ -42,7 +43,7 @@
"-e", "DISPLAY=${env:DISPLAY}"
],
"mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
"source=/dev/dri,target=/dev/dri,type=bind,consistency=cached"
],
}
13 changes: 6 additions & 7 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG ROS_DISTRO=humble
# Use the ROS desktop-full image as the base

FROM osrf/ros:${ROS_DISTRO}-desktop-full
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]

# Install system dependencies
# hadolint ignore=DL3008
Expand All @@ -16,14 +17,10 @@ RUN --mount=type=bind,source=.,target=/scenario_execution \
rosdep install --rosdistro=${ROS_DISTRO} --from-paths /scenario_execution/ --ignore-src -r -y && \
rm -rf /var/lib/apt/lists/*

# hadolint ignore=DL3042
RUN --mount=type=bind,source=.,target=/scenario_execution \
pip3 install -r /scenario_execution/requirements.txt && \
pip3 install -r /scenario_execution/libs/scenario_execution_floorplan_dsl/requirements.txt && \
pip3 install -r /scenario_execution/libs/scenario_execution_pybullet/requirements.txt
pip3 install --no-cache-dir -r /scenario_execution/libs/scenario_execution_pybullet/requirements.txt

# install rosbag2_to_video used within github actions
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
WORKDIR /rosbag2_to_video/src
RUN git clone https://github.com/ivanpauno/rosbag2_to_video.git
WORKDIR /rosbag2_to_video/src/rosbag2_to_video
Expand All @@ -32,5 +29,7 @@ WORKDIR /rosbag2_to_video
RUN apt-get update && \
rosdep install --from-paths src --ignore-src -y && \
rm -rf "/var/lib/apt/lists/*" && \
. /opt/ros/${ROS_DISTRO}/setup.bash && \
. "/opt/ros/${ROS_DISTRO}/setup.bash" && \
colcon build

WORKDIR /scenario_execution
27 changes: 25 additions & 2 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ on:
branches: [main, humble, jazzy]
paths:
- 'deb_requirements.txt'
- 'requirements.txt'
- '.github/workflows/Dockerfile'
- '.devcontainer/Dockerfile'
- '**/package.xml'
pull_request:
branches: [main, humble, jazzy]
paths:
- 'deb_requirements.txt'
- 'requirements.txt'
- '.github/workflows/Dockerfile'
- '.devcontainer/Dockerfile'
- '**/package.xml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -46,3 +48,24 @@ jobs:
tags: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref || steps.extract_branch.outputs.branch }}
build-args: |
ROS_DISTRO=${{ github.ref == 'refs/heads/main' && 'humble' || github.event.pull_request.base.ref == 'main' && 'humble' || github.event.pull_request.base.ref }}
test-devcontainer:
runs-on: intellabs-01
permissions:
packages: write
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 #v3.0.0
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT"
id: extract_branch
- name: Build Docker image
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 #v5.0.0
with:
context: .
file: .devcontainer/Dockerfile
push: false
build-args: |
ROS_DISTRO=${{ github.ref == 'refs/heads/main' && 'humble' || github.event.pull_request.base.ref == 'main' && 'humble' || github.event.pull_request.base.ref }}
6 changes: 2 additions & 4 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
name: Scan
on:
# Triggers the workflow on push or pull request events but
# only for the main branch
push:
branches: [main,humble,jazzy]
branches: [main, humble, jazzy]
pull_request:
branches: [main,humble,jazzy]
branches: [main, humble, jazzy]
workflow_dispatch:
permissions: read-all
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
# For private repositories:
# - `publish_results` will always be set to `false`, regardless
# of the value entered here.
publish_results: true
publish_results: false

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
build:
#TODO model dependency to image-workflow. Workaround: retrigger run after image-workflow finished.
Expand Down Expand Up @@ -302,7 +303,7 @@ jobs:
export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID}
sed -i 's/240s/900s/g' examples/example_multi_robot/scenarios/example_multi_robot.osc
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_multi_robot/scenarios/ -o test_example_multirobot -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} yaw:=3.14 output_dir:={OUTPUT_DIR} headless:=True
scenario_batch_execution -i examples/example_multi_robot/scenarios/ -o test_example_multirobot -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR} headless:=True
- name: Upload result
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
if: always()
Expand Down Expand Up @@ -412,7 +413,7 @@ jobs:
source install/setup.bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
sed -i 's/p.GUI/p.DIRECT/g' ./install/scenario_execution_pybullet/lib/python3.10/site-packages/scenario_execution_pybullet/actions/sim_initialize.py
sed -i 's/p.GUI/p.DIRECT/g' ./install/scenario_execution_pybullet/lib/python3.1*/site-packages/scenario_execution_pybullet/actions/sim_initialize.py
ros2 run scenario_execution scenario_execution libs/scenario_execution_pybullet/scenarios/example_pybullet.osc -t -s 0.00416666666 -o test_scenario_execution_pybullet
- name: Upload result
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
Expand All @@ -436,6 +437,9 @@ jobs:
- test-scenario-execution-pybullet
runs-on: intellabs-01
if: ${{ always() }}
permissions:
checks: write
pull-requests: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 #v4.0
Expand Down Expand Up @@ -467,4 +471,4 @@ jobs:
downloaded-artifacts/test-example-multirobot-result/test.xml
downloaded-artifacts/test-example-external-method-result/test.xml
downloaded-artifacts/test-scenario-execution-gazebo/test.xml
downloaded-artifacts/test-scenario-execution-pybullet/test.xml
downloaded-artifacts/test-scenario-execution-pybullet/test.xml
4 changes: 1 addition & 3 deletions deb_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
ros-humble-turtlebot4-simulator
ros-humble-py-trees-ros-interfaces
ros-humble-py-trees
python3-autopep8
clang-format
pylint
python3-antlr4
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ scenario multi_robot:
robot2.spawn(pose_3d(position_3d(x: -3.0, y: 1.5, z: 0.3), orientation_3d(yaw: -1.57)), model: 'example_multi_robot://models/robot.sdf')
ros_launch("example_multi_robot", "robot2_launch.py", wait_for_shutdown: false)
ros_launch("gazebo_static_camera", "spawn_static_camera_launch.py", [ key_value('x', '-3'), key_value('z', '10'), key_value('pitch', '1.57')], wait_for_shutdown: false)
record_bag(['/tf', '/tf_static', '/scenario_execution/snapshots', '/map', '/static_camera/image_raw', '/local_costmap/costmap', '/initialpose'], use_sim_time: true)
record_bag(['/tf', '/tf_static', '/scenario_execution/snapshots', '/map', '/static_camera/image_raw', '/local_costmap/costmap'], use_sim_time: true)
parallel:
test_drive: serial:
robot.init_nav2(initial_pose: pose_3d(orientation: orientation_3d(yaw: 3.14rad)))
robot.init_nav2(initial_pose: pose_3d())
robot.nav_to_pose(goal_pose: pose_3d(position: position_3d(x: -4.0m), orientation: orientation_3d(yaw: 3.14rad)))
emit end
serial:
Expand Down
1 change: 1 addition & 0 deletions libs/scenario_execution_floorplan_dsl/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

<exec_depend>docker</exec_depend>
<exec_depend>py_trees</exec_depend>
<exec_depend>python3-docker</exec_depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
Expand Down
1 change: 0 additions & 1 deletion libs/scenario_execution_floorplan_dsl/requirements.txt

This file was deleted.

2 changes: 2 additions & 0 deletions libs/scenario_execution_gazebo/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

<exec_depend>rclpy</exec_depend>
<exec_depend>py_trees</exec_depend>
<exec_depend>python3-transforms3d</exec_depend>
<exec_depend>python3-defusedxml</exec_depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class ActorExistsActionState(Enum):
"""
States for executing a entity check in ignition
States for executing a entity check in gazebo
"""
IDLE = 1
WAITING_FOR_ACTOR = 2
Expand All @@ -33,7 +33,7 @@ class ActorExistsActionState(Enum):

class GazeboActorExists(RunProcess):
"""
Class to check existance of an entity in Ignition
Class to check existance of an entity in gazebo
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DeleteActionState(Enum):

class GazeboDeleteActor(RunProcess):
"""
Class to delete an entity in Ignition
Class to delete an entity in gazebo
"""

Expand Down
6 changes: 5 additions & 1 deletion libs/scenario_execution_gazebo/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
['resource/' + PACKAGE_NAME]),
('share/' + PACKAGE_NAME, ['package.xml'])
],
install_requires=['setuptools'],
install_requires=[
'setuptools',
'transforms3d==0.3.1',
'defusedxml==0.7.1',
],
zip_safe=True,
maintainer='Intel Labs',
maintainer_email='[email protected]',
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
antlr4-python3-runtime==4.7.2
antlr4-python3-runtime==4.9.1
transforms3d==0.3.1
pexpect==4.9.0
pexpect==4.8.0
defusedxml==0.7.1
pyyaml==6.0.1
pyyaml==5.4.1
2 changes: 2 additions & 0 deletions scenario_coverage/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<license file="../LICENSE">Apache-2.0</license>

<exec_depend>scenario_execution</exec_depend>
<test_depend>python3-pexpect</test_depend>
<test_depend>python3-defusedxml</test_depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
Expand Down
6 changes: 5 additions & 1 deletion scenario_coverage/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
('share/' + PACKAGE_NAME, ['package.xml']),
(os.path.join('share', PACKAGE_NAME, 'launch'), glob('launch/*launch.py'))
],
install_requires=['setuptools'],
install_requires=[
'setuptools',
'pexpect==4.8.0',
'defusedxml==0.7.1',
],
zip_safe=True,
maintainer='Intel Labs',
maintainer_email='[email protected]',
Expand Down
1 change: 1 addition & 0 deletions scenario_execution/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<license file="../LICENSE">Apache-2.0</license>

<exec_depend>py_trees</exec_depend>
<exec_depend>python3-yaml</exec_depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
# SPDX-License-Identifier: Apache-2.0

# Generated from OpenSCENARIO2.g4 by ANTLR 4.7.2
# Generated from OpenSCENARIO2.g4 by ANTLR 4.9.1
from antlr4 import *
from io import StringIO
from typing.io import TextIO
Expand Down Expand Up @@ -579,7 +579,7 @@ class OpenSCENARIO2Lexer(Lexer):

def __init__(self, input=None, output: TextIO = sys.stdout):
super().__init__(input, output)
self.checkVersion("4.7.2")
self.checkVersion("4.9.1")
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
self._actions = None
self._predicates = None
Expand Down
Loading

0 comments on commit c503f25

Please sign in to comment.