Skip to content

Adding python IDE typing #2676

Adding python IDE typing

Adding python IDE typing #2676

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
RUST_LOG: INFO
jobs:
test:
name: "Test"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
steps:
- name: Print available space (Windows only)
run: Get-PSDrive
if: runner.os == 'Windows'
- name: Override cargo target dir (Windows only)
run: echo "CARGO_TARGET_DIR=C:\cargo-target" >> "$GITHUB_ENV"
shell: bash
if: runner.os == 'Windows'
- uses: actions/checkout@v3
- uses: r7kamura/rust-problem-matchers@v1.1.0
- run: cargo --version --verbose
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: runner.os == 'Linux'
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false
- name: Free disk Space (Windows)
if: runner.os == 'Windows'
run: |
docker system prune --all -f
Remove-Item "C:\Android" -Force -Recurse
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-directories: ${{ env.CARGO_TARGET_DIR }}
- name: "Check"
run: cargo check --all
- name: "Build (Without Python node as it is build with maturin)"
run: cargo build --all --exclude dora-node-api-python
- name: "Test"
run: cargo test --all --exclude dora-ros2-bridge-python
# Run examples as separate job because otherwise we will exhaust the disk
# space of the GitHub action runners.
examples:
name: "Examples"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: r7kamura/rust-problem-matchers@v1.1.0
- run: cargo --version --verbose
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: runner.os == 'Linux'
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false
- name: Free disk Space (Windows)
if: runner.os == 'Windows'
run: |
docker system prune --all -f
Remove-Item "C:\Android" -Force -Recurse
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
# general examples
- name: "Build examples"
timeout-minutes: 30
run: cargo build --examples
- name: "Rust Dataflow example"
timeout-minutes: 30
run: cargo run --example rust-dataflow
- name: "Multiple Daemons example"
timeout-minutes: 30
run: cargo run --example multiple-daemons
- name: "C Dataflow example"
timeout-minutes: 15
run: cargo run --example c-dataflow
- name: "C++ Dataflow example"
timeout-minutes: 15
run: cargo run --example cxx-dataflow
- name: "Cmake example"
if: runner.os == 'Linux'
timeout-minutes: 30
run: cargo run --example cmake-dataflow
# 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
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: r7kamura/rust-problem-matchers@v1.1.0
- run: cargo --version --verbose
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: ros-tooling/setup-ros@v0.6
with:
required-ros-distributions: humble
- run: 'source /opt/ros/humble/setup.bash && echo AMENT_PREFIX_PATH=${AMENT_PREFIX_PATH} >> "$GITHUB_ENV"'
- name: "Install pyarrow for testing"
run: pip install numpy pyarrow
- name: "Test"
run: cargo test -p dora-ros2-bridge-python
- name: "Rust ROS2 Bridge example"
timeout-minutes: 30
env:
QT_QPA_PLATFORM: offscreen
run: |
source /opt/ros/humble/setup.bash && ros2 run turtlesim turtlesim_node &
source /opt/ros/humble/setup.bash && ros2 run examples_rclcpp_minimal_service service_main &
cargo run --example rust-ros2-dataflow --features="ros2-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-ros2-dataflow"
timeout-minutes: 30
env:
QT_QPA_PLATFORM: offscreen
run: |
# Reset only the turtlesim instance as it is not destroyed at the end of the previous job
source /opt/ros/humble/setup.bash && ros2 service call /reset std_srvs/srv/Empty &
cargo run --example python-ros2-dataflow --features="ros2-examples"
- name: "c++-ros2-dataflow"
timeout-minutes: 30
env:
QT_QPA_PLATFORM: offscreen
run: |
# Reset only the turtlesim instance as it is not destroyed at the end of the previous job
source /opt/ros/humble/setup.bash && ros2 service call /reset std_srvs/srv/Empty &
cargo run --example cxx-ros2-dataflow --features="ros2-examples"
bench:
name: "Bench"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: r7kamura/rust-problem-matchers@v1.1.0
- run: cargo --version --verbose
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "Benchmark example"
timeout-minutes: 30
run: cargo run --example benchmark --release
CLI:
name: "CLI Test"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: r7kamura/rust-problem-matchers@v1.1.0
- run: cargo --version --verbose
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
# CLI tests
- name: "Build cli and binaries"
timeout-minutes: 45
# fail-fast by using bash shell explictly
shell: bash
run: |
cargo install --path binaries/cli --locked
- name: "Test CLI (Rust)"
timeout-minutes: 30
# fail-fast by using bash shell explictly
shell: bash
run: |
# Test Rust template Project
dora new test_rust_project --internal-create-with-path-dependencies
cd test_rust_project
cargo build --all
dora up
dora list
dora start dataflow.yml --name ci-rust-test
sleep 10
dora stop --name ci-rust-test
dora destroy
- name: "Test CLI (Python)"
timeout-minutes: 30
# fail-fast by using bash shell explictly
shell: bash
run: |
# Test Python template Project
python3 -m venv .venv
if [ ! -d ".venv/bin" ]; then
mv .venv/Scripts .venv/bin # venv is placed under `Scripts` on Windows
fi
source .venv/bin/activate
pip3 install maturin
maturin build -m apis/python/node/Cargo.toml
pip3 install target/wheels/*
dora new test_python_project --lang python --internal-create-with-path-dependencies
cd test_python_project
dora up
dora list
dora start dataflow.yml --name ci-python-test
sleep 10
dora stop --name ci-python-test
dora destroy
clippy:
name: "Clippy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: r7kamura/rust-problem-matchers@v1.1.0
- run: cargo --version --verbose
- name: "Clippy"
run: cargo clippy --all
- name: "Clippy (tracing feature)"
run: cargo clippy --all --features tracing
if: false # only the dora-runtime has this feature, but it is currently commented out
- name: "Clippy (metrics feature)"
run: cargo clippy --all --features metrics
if: false # only the dora-runtime has this feature, but it is currently commented out
rustfmt:
name: "Formatting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: r7kamura/rust-problem-matchers@v1.1.0
- name: "rustfmt"
run: cargo fmt --all -- --check
check-license:
name: "License Checks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: r7kamura/rust-problem-matchers@v1.1.0
- run: cargo --version --verbose
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo install cargo-lichking
- name: "Check dependency licenses"
run: cargo lichking check