Skip to content

Commit

Permalink
standalone rclrs testing
Browse files Browse the repository at this point in the history
  • Loading branch information
stelzo committed Mar 25, 2024
1 parent 152fce7 commit bc447af
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/r2r_galactic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ name: r2r_galactic

on:
push:
branches:
- "*"
- "!rclrs"
pull_request:
branches:
- "*"
- "!rclrs"
workflow_dispatch:

env:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/r2r_humble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ name: r2r_humble

on:
push:
branches:
- "*"
- "!rclrs"
pull_request:
branches:
- "*"
- "!rclrs"
workflow_dispatch:

env:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/r2r_iron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ name: r2r_iron

on:
push:
branches:
- "*"
- "!rclrs"
pull_request:
branches:
- "*"
- "!rclrs"
workflow_dispatch:

env:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/rclrs_humble.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: rclrs_humble

on:
push:
branches:
- rclrs
pull_request:
branches:
- rclrs
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
tests_humble:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: docker build . --file ./tests/Dockerfile_rclrs_humble --tag rclrs_humble
- run: docker run rclrs_humble cargo test
6 changes: 6 additions & 0 deletions .github/workflows/rosrust_noetic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ name: rosrust_noetic

on:
push:
branches:
- "*"
- "!rclrs"
pull_request:
branches:
- "*"
- "!rclrs"
workflow_dispatch:

jobs:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ name: Tests

on:
push:
branches:
- "*"
- "!rclrs"
pull_request:
branches:
- "*"
- "!rclrs"
workflow_dispatch:

env:
Expand Down
34 changes: 34 additions & 0 deletions tests/Dockerfile_rclrs_humble
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# syntax=docker/dockerfile:1
FROM ros:humble

# Update default packages
RUN apt-get update

# Get Ubuntu packages
RUN apt-get install -y \
build-essential \
curl \
libclang-dev \
git \
python3-pip \
python3-vcstool

# Get Rust
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | bash -s -- -y
RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
RUN . $HOME/.cargo/env && cargo install --debug cargo-ament-build
RUN pip install git+https://github.com/colcon/colcon-cargo.git
RUN pip install git+https://github.com/colcon/colcon-ros-cargo.git

WORKDIR /ros2_rust_build
RUN git clone https://github.com/ros2-rust/ros2_rust.git src/ros2_rust
RUN vcs import src < src/ros2_rust/ros2_rust_humble.repos

WORKDIR /ros2_rust_build/src/ros_pointcloud2_tests
COPY . .

WORKDIR /ros2_rust_build
RUN . $HOME/.cargo/env && . /opt/ros/humble/setup.sh && colcon build

RUN chmod +x /ros2_rust_build/src/ros_pointcloud2_tests/tests/rclrs_test.bash
ENTRYPOINT [ "/ros2_rust_build/src/ros_pointcloud2_tests/tests/rclrs_test.bash" ]
25 changes: 25 additions & 0 deletions tests/rclrs_test.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

. "$HOME/.cargo/env"

# run rustup to test with latest rust version
rustup update

if [ -e "/opt/ros/iron/setup.bash" ]; then
. "/opt/ros/iron/setup.bash"
. "/ros2_rust_build/install/local_setup.bash"
fi

if [ -e "/opt/ros/humble/setup.bash" ]; then
. "/opt/ros/humble/setup.bash"
. "/ros2_rust_build/install/local_setup.bash"
fi

if [ -e "/opt/ros/galactic/setup.bash" ]; then
. "/opt/ros/galactic/setup.bash"
. "/ros2_rust_build/install/local_setup.bash"
fi

cd /ros2_rust_build/src/ros_pointcloud2_tests/ || exit

"$@"

0 comments on commit bc447af

Please sign in to comment.