diff --git a/.github/workflows/rust_and_ros2.yml b/.github/workflows/rust_and_ros2.yml index abdbea1..7f44b9c 100644 --- a/.github/workflows/rust_and_ros2.yml +++ b/.github/workflows/rust_and_ros2.yml @@ -10,12 +10,12 @@ env: CARGO_TERM_COLOR: always jobs: - docs_humble: + docs_no_ros: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: docker build . --file ./tests/Dockerfile_humble --tag r2r_humble - - run: docker run r2r_humble cargo build --features doc-only + - run: docker build . --file ./tests/Dockerfile_no_ros --tag r2r_no_ros + - run: docker run r2r_no_ros cargo build --features doc-only tests_humble: runs-on: ubuntu-latest diff --git a/r2r/Cargo.toml b/r2r/Cargo.toml index d3d0363..2680651 100644 --- a/r2r/Cargo.toml +++ b/r2r/Cargo.toml @@ -37,7 +37,7 @@ r2r_msg_gen = { path = "../r2r_msg_gen", version = "0.3.10" } [features] save-bindgen = ["r2r_rcl/save-bindgen", "r2r_msg_gen/save-bindgen", "r2r_actions/save-bindgen"] -doc-only = ["r2r_rcl/doc-only", "r2r_msg_gen/doc-only", "r2r_actions/doc-only"] +doc-only = ["r2r_common/doc-only", "r2r_rcl/doc-only", "r2r_msg_gen/doc-only", "r2r_actions/doc-only"] [package.metadata.docs.rs] features = ["doc-only"] diff --git a/r2r_actions/Cargo.toml b/r2r_actions/Cargo.toml index ca915e1..d6a25cb 100644 --- a/r2r_actions/Cargo.toml +++ b/r2r_actions/Cargo.toml @@ -20,7 +20,7 @@ r2r_common = { path = "../r2r_common", version = "0.3.5" } [features] save-bindgen = ["r2r_rcl/save-bindgen", "r2r_msg_gen/save-bindgen"] -doc-only = ["r2r_rcl/doc-only", "r2r_msg_gen/doc-only"] +doc-only = ["r2r_common/doc-only", "r2r_rcl/doc-only", "r2r_msg_gen/doc-only"] [package.metadata.docs.rs] features = ["doc-only"] diff --git a/r2r_common/Cargo.toml b/r2r_common/Cargo.toml index 8ac5a7e..dbc9b35 100644 --- a/r2r_common/Cargo.toml +++ b/r2r_common/Cargo.toml @@ -14,3 +14,9 @@ documentation = "https://docs.rs/r2r/latest/r2r" bindgen = "0.63.0" itertools = "0.10.5" sha2 = "0.10.6" + +[features] +doc-only = [] + +[package.metadata.docs.rs] +features = ["doc-only"] diff --git a/r2r_common/src/lib.rs b/r2r_common/src/lib.rs index 47f9824..7616c4a 100644 --- a/r2r_common/src/lib.rs +++ b/r2r_common/src/lib.rs @@ -6,6 +6,7 @@ use std::fs::{self, File}; use std::io::Read; use std::path::Path; +#[cfg(not(feature = "doc-only"))] const SUPPORTED_ROS_DISTROS: &[&str] = &[ "foxy", "galactic", @@ -119,6 +120,11 @@ pub fn setup_bindgen_builder() -> bindgen::Builder { builder } +#[cfg(feature = "doc-only")] +pub fn print_cargo_ros_distro() { +} + +#[cfg(not(feature = "doc-only"))] pub fn print_cargo_ros_distro() { let ros_distro = env::var("ROS_DISTRO") .unwrap_or_else(|_| panic!("ROS_DISTRO not set: Source your ROS!")); diff --git a/r2r_msg_gen/Cargo.toml b/r2r_msg_gen/Cargo.toml index 88e698c..867eacf 100644 --- a/r2r_msg_gen/Cargo.toml +++ b/r2r_msg_gen/Cargo.toml @@ -23,7 +23,7 @@ heck = "0.4.0" [features] save-bindgen = ["r2r_rcl/save-bindgen"] -doc-only = ["r2r_rcl/doc-only"] +doc-only = ["r2r_common/doc-only", "r2r_rcl/doc-only"] [package.metadata.docs.rs] features = ["doc-only"] diff --git a/r2r_rcl/Cargo.toml b/r2r_rcl/Cargo.toml index 7b2e53a..3b9a2e8 100644 --- a/r2r_rcl/Cargo.toml +++ b/r2r_rcl/Cargo.toml @@ -20,7 +20,7 @@ r2r_common = { path = "../r2r_common", version = "0.3.5" } [features] save-bindgen = [] -doc-only = [] +doc-only = ["r2r_common/doc-only"] [package.metadata.docs.rs] features = ["doc-only"] diff --git a/tests/Dockerfile_no_ros b/tests/Dockerfile_no_ros new file mode 100644 index 0000000..e97ba46 --- /dev/null +++ b/tests/Dockerfile_no_ros @@ -0,0 +1,19 @@ +# syntax=docker/dockerfile:1 +FROM ubuntu:latest + +# Update default packages +RUN apt-get update + +# Get Ubuntu packages +RUN apt-get install -y \ + build-essential \ + curl \ + libclang-dev + +# Get Rust +RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | bash -s -- -y +RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc + +COPY . /r2r +RUN chmod +x /r2r/tests/test.bash +ENTRYPOINT [ "/r2r/tests/test.bash" ]