From 1a9cdb084f5393a5441f4b8196a494cd1ff8f1ea Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 17 Jul 2025 20:46:04 +0800 Subject: [PATCH 1/9] Use resolver v2 for compatibility with 1.75 Signed-off-by: Michael X. Grey --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e60fee1..862a6d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] members = ["rosidl_runtime_rs"] -resolver = "3" +resolver = "2" From a533fe91864b327aef73d52641773c43aaa90934 Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 17 Jul 2025 20:46:31 +0800 Subject: [PATCH 2/9] Add CI for linux that includes 1.75 and the latest stable version Signed-off-by: Michael X. Grey --- .github/workflows/ci_linux.yml | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/ci_linux.yml diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml new file mode 100644 index 0000000..059684e --- /dev/null +++ b/.github/workflows/ci_linux.yml @@ -0,0 +1,38 @@ +name: Rust Minimal + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + # Run the CI at 01:22 UTC every Tuesday + # We pick an arbitrary time outside of most of the world's work hours + # to minimize the likelihood of running alongside a heavy workload. + - cron: '22 1 * * 2' + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + rust-version: [stable, 1.75] + + steps: + - uses: actions/checkout@v4 + + - name: Setup rust + run: rustup default ${{ matrix.rust-version }} + + - name: Test default features + run: cargo test --workspace + + - name: Test with serde + run: cargo test --workspace -F=serde + + - name: Build docs + run: cargo doc --all-features From 604634b9ddd48a973c887d375f47775ab8ed131a Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 17 Jul 2025 20:48:22 +0800 Subject: [PATCH 3/9] Remove lockfiles from git history Signed-off-by: Michael X. Grey --- .gitignore | 6 +- Cargo.lock | 210 ----------------------------------- rosidl_runtime_rs/Cargo.lock | 210 ----------------------------------- 3 files changed, 5 insertions(+), 421 deletions(-) delete mode 100644 Cargo.lock delete mode 100644 rosidl_runtime_rs/Cargo.lock diff --git a/.gitignore b/.gitignore index 0104787..b1e52d5 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,8 @@ target/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ \ No newline at end of file +#.idea/ + +# Do not commit cargo lockfiles since they create git history churn and are not +# necessarily compatible across different Rust versions. +Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 31aa1c1..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,210 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "cfg-if" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" - -[[package]] -name = "env_logger" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "getrandom" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "libc" -version = "0.2.174" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" - -[[package]] -name = "log" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" - -[[package]] -name = "memchr" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" - -[[package]] -name = "proc-macro2" -version = "1.0.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quickcheck" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6" -dependencies = [ - "env_logger", - "log", - "rand", -] - -[[package]] -name = "quote" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rosidl_runtime_rs" -version = "0.4.2" -dependencies = [ - "cfg-if", - "quickcheck", - "serde", - "serde_json", -] - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "syn" -version = "2.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" diff --git a/rosidl_runtime_rs/Cargo.lock b/rosidl_runtime_rs/Cargo.lock deleted file mode 100644 index 604d332..0000000 --- a/rosidl_runtime_rs/Cargo.lock +++ /dev/null @@ -1,210 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "env_logger" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "getrandom" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "libc" -version = "0.2.172" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" - -[[package]] -name = "log" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "proc-macro2" -version = "1.0.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quickcheck" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6" -dependencies = [ - "env_logger", - "log", - "rand", -] - -[[package]] -name = "quote" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rosidl_runtime_rs" -version = "0.4.1" -dependencies = [ - "cfg-if", - "quickcheck", - "serde", - "serde_json", -] - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "syn" -version = "2.0.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" From 13710ef35380aedb93a71fbabab7e3be07af8174 Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 17 Jul 2025 21:16:59 +0800 Subject: [PATCH 4/9] Add ros distros Signed-off-by: Michael X. Grey --- .github/workflows/ci_linux.yml | 38 ++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 059684e..21d9106 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -16,17 +16,47 @@ env: jobs: build: - runs-on: ubuntu-latest - strategy: matrix: - rust-version: [stable, 1.75] + rust_version: [stable, 1.75] + ros_distribution: + - humble + - jazzy + - kilted + - rolling + include: + # Humble Hawksbill (May 2022 - May 2027) + - docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest + ros_distribution: humble + ros_version: 2 + # Jazzy Jalisco (May 2024 - May 2029) + - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-jazzy-ros-base-latest + ros_distribution: jazzy + ros_version: 2 + # Kilted Kaiju (May 2025 - Dec 2026) + - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-kilted-ros-base-latest + ros_distribution: kilted + ros_version: 2 + # Rolling Ridley (June 2020 - Present) + - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-rolling-ros-base-latest + ros_distribution: rolling + ros_version: 2 + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.ros_distribution == 'rolling' }} + container: + image: ${{ matrix.docker_image }} steps: - uses: actions/checkout@v4 + - name: Setup ROS environment + uses: ros-tooling/setup-ros@v0.7 + with: + required-ros-distributions: ${{ matrix.ros_distribution }} + use-ros2-testing: ${{ matrix.ros_distribution == 'rolling' }} + - name: Setup rust - run: rustup default ${{ matrix.rust-version }} + run: rustup default ${{ matrix.rust_version }} - name: Test default features run: cargo test --workspace From 15b945d7c9c30f900ec767591be52ae5e177d978 Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 17 Jul 2025 21:19:04 +0800 Subject: [PATCH 5/9] Fix workflow syntax Signed-off-by: Michael X. Grey --- .github/workflows/ci_linux.yml | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 21d9106..dde7f50 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -20,27 +20,27 @@ jobs: matrix: rust_version: [stable, 1.75] ros_distribution: - - humble - - jazzy - - kilted - - rolling - include: - # Humble Hawksbill (May 2022 - May 2027) - - docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest - ros_distribution: humble - ros_version: 2 - # Jazzy Jalisco (May 2024 - May 2029) - - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-jazzy-ros-base-latest - ros_distribution: jazzy - ros_version: 2 - # Kilted Kaiju (May 2025 - Dec 2026) - - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-kilted-ros-base-latest - ros_distribution: kilted - ros_version: 2 - # Rolling Ridley (June 2020 - Present) - - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-rolling-ros-base-latest - ros_distribution: rolling - ros_version: 2 + - humble + - jazzy + - kilted + - rolling + include: + # Humble Hawksbill (May 2022 - May 2027) + - docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest + ros_distribution: humble + ros_version: 2 + # Jazzy Jalisco (May 2024 - May 2029) + - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-jazzy-ros-base-latest + ros_distribution: jazzy + ros_version: 2 + # Kilted Kaiju (May 2025 - Dec 2026) + - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-kilted-ros-base-latest + ros_distribution: kilted + ros_version: 2 + # Rolling Ridley (June 2020 - Present) + - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-rolling-ros-base-latest + ros_distribution: rolling + ros_version: 2 runs-on: ubuntu-latest continue-on-error: ${{ matrix.ros_distribution == 'rolling' }} From 5fe28321fca6bceb3a04bb03718c707848e28b8b Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 17 Jul 2025 21:27:06 +0800 Subject: [PATCH 6/9] Use dtolnay to install rust Signed-off-by: Michael X. Grey --- .../{ci_linux.yml => rust-minimal.yml} | 7 +- .github/workflows/rust-stable.yml | 69 +++++++++++++++++++ 2 files changed, 73 insertions(+), 3 deletions(-) rename .github/workflows/{ci_linux.yml => rust-minimal.yml} (94%) create mode 100644 .github/workflows/rust-stable.yml diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/rust-minimal.yml similarity index 94% rename from .github/workflows/ci_linux.yml rename to .github/workflows/rust-minimal.yml index dde7f50..ef924f6 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/rust-minimal.yml @@ -18,7 +18,6 @@ jobs: build: strategy: matrix: - rust_version: [stable, 1.75] ros_distribution: - humble - jazzy @@ -55,8 +54,10 @@ jobs: required-ros-distributions: ${{ matrix.ros_distribution }} use-ros2-testing: ${{ matrix.ros_distribution == 'rolling' }} - - name: Setup rust - run: rustup default ${{ matrix.rust_version }} + - name: Setup Rust + uses: dtolnay/rust-toolchain@1.75 + with: + components: clippy, rustfmt - name: Test default features run: cargo test --workspace diff --git a/.github/workflows/rust-stable.yml b/.github/workflows/rust-stable.yml new file mode 100644 index 0000000..d28bf59 --- /dev/null +++ b/.github/workflows/rust-stable.yml @@ -0,0 +1,69 @@ +name: Rust Minimal + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + # Run the CI at 01:22 UTC every Tuesday + # We pick an arbitrary time outside of most of the world's work hours + # to minimize the likelihood of running alongside a heavy workload. + - cron: '22 1 * * 2' + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + strategy: + matrix: + ros_distribution: + - humble + - jazzy + - kilted + - rolling + include: + # Humble Hawksbill (May 2022 - May 2027) + - docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest + ros_distribution: humble + ros_version: 2 + # Jazzy Jalisco (May 2024 - May 2029) + - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-jazzy-ros-base-latest + ros_distribution: jazzy + ros_version: 2 + # Kilted Kaiju (May 2025 - Dec 2026) + - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-kilted-ros-base-latest + ros_distribution: kilted + ros_version: 2 + # Rolling Ridley (June 2020 - Present) + - docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-rolling-ros-base-latest + ros_distribution: rolling + ros_version: 2 + + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.ros_distribution == 'rolling' }} + container: + image: ${{ matrix.docker_image }} + steps: + - uses: actions/checkout@v4 + + - name: Setup ROS environment + uses: ros-tooling/setup-ros@v0.7 + with: + required-ros-distributions: ${{ matrix.ros_distribution }} + use-ros2-testing: ${{ matrix.ros_distribution == 'rolling' }} + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy, rustfmt + + - name: Test default features + run: cargo test --workspace + + - name: Test with serde + run: cargo test --workspace -F=serde + + - name: Build docs + run: cargo doc --all-features From e7575eda6ef35bddf2aebbf23c39a634d5b8eb5f Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 17 Jul 2025 21:35:37 +0800 Subject: [PATCH 7/9] Source ROS before building Signed-off-by: Michael X. Grey --- .github/workflows/rust-minimal.yml | 12 +++++++++--- .github/workflows/rust-stable.yml | 14 ++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust-minimal.yml b/.github/workflows/rust-minimal.yml index ef924f6..53b635e 100644 --- a/.github/workflows/rust-minimal.yml +++ b/.github/workflows/rust-minimal.yml @@ -60,10 +60,16 @@ jobs: components: clippy, rustfmt - name: Test default features - run: cargo test --workspace + run: | + . /opt/ros/${{ matrix.ros_distribution }}/setup.sh + cargo test --workspace - name: Test with serde - run: cargo test --workspace -F=serde + run: | + . /opt/ros/${{ matrix.ros_distribution }}/setup.sh + cargo test --workspace -F=serde - name: Build docs - run: cargo doc --all-features + run: | + . /opt/ros/${{ matrix.ros_distribution }}/setup.sh + cargo doc --all-features diff --git a/.github/workflows/rust-stable.yml b/.github/workflows/rust-stable.yml index d28bf59..82a96db 100644 --- a/.github/workflows/rust-stable.yml +++ b/.github/workflows/rust-stable.yml @@ -1,4 +1,4 @@ -name: Rust Minimal +name: Rust Stable on: push: @@ -60,10 +60,16 @@ jobs: components: clippy, rustfmt - name: Test default features - run: cargo test --workspace + run: | + . /opt/ros/${{ matrix.ros_distribution }}/setup.sh + cargo test --workspace - name: Test with serde - run: cargo test --workspace -F=serde + run: | + . /opt/ros/${{ matrix.ros_distribution }}/setup.sh + cargo test --workspace -F=serde - name: Build docs - run: cargo doc --all-features + run: | + . /opt/ros/${{ matrix.ros_distribution }}/setup.sh + cargo doc --all-features From 9d37c868e78f7077e2c3a2f2ffa2f30c5d7e854c Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 17 Jul 2025 21:59:14 +0800 Subject: [PATCH 8/9] Ensure arbitrary characters remain within ascii range Signed-off-by: Michael X. Grey --- rosidl_runtime_rs/src/string.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rosidl_runtime_rs/src/string.rs b/rosidl_runtime_rs/src/string.rs index 9f0251c..7fbd142 100644 --- a/rosidl_runtime_rs/src/string.rs +++ b/rosidl_runtime_rs/src/string.rs @@ -522,10 +522,15 @@ mod tests { } } + fn generate_ascii(g: &mut Gen) -> char { + let c = u8::min(u8::arbitrary(g), 127); + c as char + } + impl Arbitrary for BoundedString<256> { fn arbitrary(g: &mut Gen) -> Self { let len = u8::arbitrary(g); - let s: std::string::String = (0..len).map(|_| char::arbitrary(g)).collect(); + let s: std::string::String = (0..len).map(|_| generate_ascii(g)).collect(); s.as_str().try_into().unwrap() } } @@ -533,7 +538,7 @@ mod tests { impl Arbitrary for BoundedWString<256> { fn arbitrary(g: &mut Gen) -> Self { let len = u8::arbitrary(g); - let s: std::string::String = (0..len).map(|_| char::arbitrary(g)).collect(); + let s: std::string::String = (0..len).map(|_| generate_ascii(g)).collect(); s.as_str().try_into().unwrap() } } From 873aa80bd2f7c258ebf4529fcb8563f8bac50d90 Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 17 Jul 2025 22:04:29 +0800 Subject: [PATCH 9/9] Add documentation to explain generate_ascii Signed-off-by: Michael X. Grey --- rosidl_runtime_rs/src/string.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rosidl_runtime_rs/src/string.rs b/rosidl_runtime_rs/src/string.rs index 7fbd142..5da7ef4 100644 --- a/rosidl_runtime_rs/src/string.rs +++ b/rosidl_runtime_rs/src/string.rs @@ -522,6 +522,15 @@ mod tests { } } + /// If we use char::arbitrary(g) then we can get back characters which are + /// outside the ASCII range. Since the length calculated by [`String`] is + /// based on the utf-8 length of the string (not based on the number of bytes + /// in the string), putting non-ASCII characters into it can skew the length + /// calculation in strange ways. + /// + /// This function generates only ASCII characters by cutting their values + /// off at 127. This does not give an even distribution of ASCII characters, + /// but that fact is not important for this smoke test. fn generate_ascii(g: &mut Gen) -> char { let c = u8::min(u8::arbitrary(g), 127); c as char