Skip to content

Commit

Permalink
Update CI with cargo fmt, nightly build, and release (#39)
Browse files Browse the repository at this point in the history
* Add cargo fmt in CI.

Signed-off-by: ChenYing Kuo <[email protected]>

* Add nightly build

Signed-off-by: ChenYing Kuo <[email protected]>

* Fix release issue.

Signed-off-by: ChenYing Kuo <[email protected]>

---------

Signed-off-by: ChenYing Kuo <[email protected]>
  • Loading branch information
evshary authored Dec 14, 2024
1 parent cb4c1ff commit c1eb133
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 73 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
- "examples/**"
- "Cargo.*"
- ".github/**"
schedule:
- cron: '0 1 * * *'
# Able to call by other workflow
workflow_call:
# Able to call on GitHub
Expand Down Expand Up @@ -52,10 +54,13 @@ jobs:
- name: Run cargo check
run: |
cargo check --all --tests
- name: Check code format
run: |
cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate"
- name: Run cargo clippy
run: |
cargo clippy --version
cargo clippy --all-targets -- -W warnings -D warnings
cargo clippy --all-targets --all-features -- -W warnings -D warnings
- name: Create Documentation
run: |
cargo doc --no-deps --all-features
Expand Down
34 changes: 6 additions & 28 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,10 @@ jobs:
steps:
- uses: actions/checkout@v4

# README - we later need the download_url output of the upload step
- name: Upload README to release
uses: svenstaro/upload-release-action@v2
id: upload_readme
- name: 'Create Release'
uses: softprops/action-gh-release@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: README.md
tag: ${{ github.ref }}

- name: Gets latest created release info
id: latest_release_info
uses: joutvhu/get-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Collect all artifacts
uses: anotherdaniel/[email protected]
id: quevee_manifest
with:
release_url: ${{ steps.latest_release_info.outputs.html_url }}
artifacts_readme: ${{ steps.upload_readme.outputs.browser_download_url }}

- name: Upload manifest to release
uses: svenstaro/upload-release-action@v2
id: upload_quality_manifest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.quevee_manifest.outputs.manifest_file }}
tag: ${{ github.ref }}
generate_release_notes: true
files: |
README.md
token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion src/autoware.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::bridge::sensor_bridge::SensorType;
use std::collections::HashMap;

use crate::bridge::sensor_bridge::SensorType;

#[derive(Default, Clone)]
pub struct Autoware {
pub _ros2: bool,
Expand Down
8 changes: 5 additions & 3 deletions src/bridge/actor_bridge.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
use std::sync::Arc;

use carla::client::{Actor, ActorKind};
use zenoh::Session;

use super::{
other_bridge::OtherActorBridge,
sensor_bridge::{SensorBridge, SensorType},
Expand All @@ -6,9 +11,6 @@ use super::{
vehicle_bridge::VehicleBridge,
};
use crate::{autoware::Autoware, error::Result};
use carla::client::{Actor, ActorKind};
use std::sync::Arc;
use zenoh::Session;

#[derive(Debug)]
pub enum BridgeType {
Expand Down
8 changes: 5 additions & 3 deletions src/bridge/other_bridge.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use super::actor_bridge::ActorBridge;
use crate::error::Result;
use carla::client::Actor;
use std::sync::Arc;

use carla::client::Actor;
use zenoh::Session;

use super::actor_bridge::ActorBridge;
use crate::error::Result;

pub struct OtherActorBridge {
_actor: Actor,
}
Expand Down
34 changes: 18 additions & 16 deletions src/bridge/sensor_bridge.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
use super::actor_bridge::{ActorBridge, BridgeType};
use crate::{
autoware::Autoware,
error::{BridgeError, Result},
types::{GnssService, GnssStatus, PointFieldType},
utils,
use std::{
convert::Infallible,
mem,
str::FromStr,
sync::{
mpsc::{self, Receiver, Sender},
Arc,
},
thread,
};

use carla::{
client::{ActorBase, Sensor},
geom::Location,
Expand All @@ -18,19 +22,17 @@ use carla::{
};
use cdr::{CdrLe, Infinite};
use nalgebra::{coordinates::XYZ, UnitQuaternion};
use std::{
convert::Infallible,
mem,
str::FromStr,
sync::{
mpsc::{self, Receiver, Sender},
Arc,
},
thread,
};
use zenoh::{Session, Wait};
use zenoh_ros_type::{geometry_msgs, sensor_msgs, std_msgs};

use super::actor_bridge::{ActorBridge, BridgeType};
use crate::{
autoware::Autoware,
error::{BridgeError, Result},
types::{GnssService, GnssStatus, PointFieldType},
utils,
};

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SensorType {
CameraRgb,
Expand Down
8 changes: 5 additions & 3 deletions src/bridge/trafficlight_bridge.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use super::actor_bridge::ActorBridge;
use crate::error::Result;
use carla::client::TrafficLight;
use std::sync::Arc;

use carla::client::TrafficLight;
use zenoh::Session;

use super::actor_bridge::ActorBridge;
use crate::error::Result;

pub struct TrafficLightBridge {
_actor: TrafficLight,
}
Expand Down
8 changes: 5 additions & 3 deletions src/bridge/trafficsign_bridge.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use super::actor_bridge::ActorBridge;
use crate::error::Result;
use carla::client::TrafficSign;
use std::sync::Arc;

use carla::client::TrafficSign;
use zenoh::Session;

use super::actor_bridge::ActorBridge;
use crate::error::Result;

pub struct TrafficSignBridge {
_actor: TrafficSign,
}
Expand Down
16 changes: 9 additions & 7 deletions src/bridge/vehicle_bridge.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
use super::actor_bridge::{ActorBridge, BridgeType};
use crate::{
autoware::Autoware,
error::{BridgeError, Result},
utils,
};
use std::sync::{atomic::Ordering, Arc};

use arc_swap::ArcSwap;
use atomic_float::AtomicF32;
use carla::{
client::{ActorBase, Vehicle},
rpc::{VehicleAckermannControl, VehicleWheelLocation},
};
use cdr::{CdrLe, Infinite};
use std::sync::{atomic::Ordering, Arc};
use zenoh::{
pubsub::{Publisher, Subscriber},
Session, Wait,
Expand All @@ -27,6 +22,13 @@ use zenoh_ros_type::{
tier4_control_msgs::{gate_mode_data, GateMode},
};

use super::actor_bridge::{ActorBridge, BridgeType};
use crate::{
autoware::Autoware,
error::{BridgeError, Result},
utils,
};

pub struct VehicleBridge<'a> {
vehicle_name: String,
actor: Vehicle,
Expand Down
6 changes: 4 additions & 2 deletions src/clock.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use crate::error::Result;
use cdr::{CdrLe, Infinite};
use std::{
sync::Arc,
time::{SystemTime, UNIX_EPOCH},
};

use cdr::{CdrLe, Infinite};
use zenoh::{pubsub::Publisher, Session, Wait};
use zenoh_ros_type::{builtin_interfaces, rosgraph_msgs};

use crate::error::Result;

pub struct SimulatorClock<'a> {
publisher_clock: Publisher<'a>,
}
Expand Down
13 changes: 7 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ mod error;
mod types;
mod utils;

use std::{
collections::{HashMap, HashSet},
sync::Arc,
thread,
time::Duration,
};

use bridge::actor_bridge::{ActorBridge, BridgeType};
use carla::{
client::{ActorBase, Client},
Expand All @@ -14,12 +21,6 @@ use clap::{Parser, ValueEnum};
use clock::SimulatorClock;
use error::{BridgeError, Result};
use serde_json::json;
use std::{
collections::{HashMap, HashSet},
sync::Arc,
thread,
time::Duration,
};
use zenoh::{Config, Wait};

// The default interval between ticks
Expand Down
1 change: 1 addition & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::time::{SystemTime, UNIX_EPOCH};

use zenoh_ros_type::{builtin_interfaces, std_msgs};

pub fn is_bigendian() -> bool {
Expand Down

0 comments on commit c1eb133

Please sign in to comment.