Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ros2 bridge incompatibility with CI Ubuntu 24 and with pyo3 22 #670

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 21 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
name: "Examples"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
platform: [ubuntu-22.04, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
Expand Down Expand Up @@ -133,31 +133,10 @@ jobs:
if: runner.os == 'Linux'
run: cargo run --example rust-dataflow -- dataflow_socket.yml

# python examples
- uses: actions/setup-python@v2
if: runner.os != 'Windows'
with:
python-version: "3.8"
- uses: actions/setup-python@v2
if: runner.os == 'Windows'
with:
python-version: "3.10"
- name: "Python Dataflow example"
run: cargo run --example python-dataflow
- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
activate-environment: ""
- name: "Python Operator Dataflow example"
shell: bash -l {0}
run: |
conda deactivate
cargo run --example python-operator-dataflow

# ROS2 bridge examples
ros2-bridge-examples:
name: "ROS2 Bridge Examples"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -270,7 +249,7 @@ jobs:
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
tool-cache: true

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
Expand All @@ -279,7 +258,7 @@ jobs:
haskell: true
large-packages: false
docker-images: true
swap-storage: false
swap-storage: true
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
Expand Down Expand Up @@ -338,11 +317,27 @@ jobs:
dora start dataflow.yml --name ci-python-test --detach
sleep 10
dora stop --name ci-python-test --grace-duration 5s
dora build ../examples/python-dataflow/dataflow_dynamic.yml

# Run Python Node Example

dora build ../examples/python-dataflow/dataflow.yml
dora start ../examples/python-dataflow/dataflow.yml --name ci-python --detach
sleep 5
dora stop --name ci-python --grace-duration 5s

# Run Python Dynamic Node Example

dora start ../examples/python-dataflow/dataflow_dynamic.yml --name ci-python-dynamic --detach
opencv-plot --name plot
sleep 5
dora stop --name ci-python-dynamic --grace-duration 5s

# Run Python Operator Example

dora start ../examples/python-operator-dataflow/dataflow.yml --name ci-python-operator --detach
sleep 5
dora stop --name ci-python-operator --grace-duration 5s

dora destroy

- name: "Test CLI (C)"
Expand Down
13 changes: 10 additions & 3 deletions libraries/extensions/ros2-bridge/python/src/typed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ mod tests {
use arrow::pyarrow::FromPyArrow;
use arrow::pyarrow::ToPyArrow;

use eyre::eyre;
use pyo3::types::IntoPyDict;
use pyo3::types::PyAnyMethods;
use pyo3::types::PyDict;
use pyo3::types::PyList;
use pyo3::types::PyListMethods;
use pyo3::types::PyModule;
use pyo3::types::PyTuple;
use pyo3::PyNativeType;

use pyo3::Python;
use serde::de::DeserializeSeed;
use serde::Serialize;
Expand Down Expand Up @@ -71,9 +73,14 @@ mod tests {

let my_module = PyModule::import_bound(py, "test_utils")?;

let arrays: &PyList = my_module.getattr("TEST_ARRAYS")?.extract()?;
let arrays = my_module.getattr("TEST_ARRAYS")?;
let arrays = arrays
.downcast::<PyList>()
.map_err(|err| eyre!("Could not downcast PyAny. Err: {}", err))?;
for array_wrapper in arrays.iter() {
let arrays: &PyTuple = array_wrapper.extract()?;
let arrays = array_wrapper.downcast::<PyTuple>().map_err(|err| {
eyre!("Could not downcast expected tuple test array. Err: {}", err)
})?;
let package_name: String = arrays.get_item(0)?.extract()?;
let message_name: String = arrays.get_item(1)?.extract()?;
println!("Checking {}::{}", package_name, message_name);
Expand Down
Loading