Fix mistake in docs generatation and CI docs test

This commit is contained in:
Martin Dahl 2023-06-20 11:13:59 +02:00
parent 5c78ecaebe
commit dedbf11486
8 changed files with 38 additions and 7 deletions

View File

@ -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

View File

@ -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"]

View File

@ -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"]

View File

@ -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"]

View File

@ -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!"));

View File

@ -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"]

View File

@ -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"]

19
tests/Dockerfile_no_ros Normal file
View File

@ -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" ]