Skip to content

Commit

Permalink
Run rust formatting on all rust code and add check to CI (#334)
Browse files Browse the repository at this point in the history
## Overview
This PR adds a rust linter to the CI.

## Upstream Changes
- [ ] To be upstreamed to OSS

## Issue
We can not ignore generated files on the stable rust compiler: https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#ignore. I'm okay with running `cargo fmt --all` and just format everything.
  • Loading branch information
thomasjpfan authored Jun 24, 2024
1 parent d975d6a commit 7cf7643
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 29 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/fasttask.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: fasttask tests


concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
pull_request:
push:
branches:
- master


jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Rust linting
run: cargo fmt --all -- --check
working-directory: fasttask/worker
59 changes: 30 additions & 29 deletions fasttask/worker/bridge/src/pb/fasttask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,53 @@
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskStatus {
#[prost(string, tag="1")]
#[prost(string, tag = "1")]
pub task_id: ::prost::alloc::string::String,
#[prost(string, tag="2")]
#[prost(string, tag = "2")]
pub namespace: ::prost::alloc::string::String,
#[prost(string, tag="3")]
#[prost(string, tag = "3")]
pub workflow_id: ::prost::alloc::string::String,
#[prost(int32, tag="4")]
#[prost(int32, tag = "4")]
pub phase: i32,
#[prost(string, tag="5")]
#[prost(string, tag = "5")]
pub reason: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Capacity {
#[prost(int32, tag="1")]
#[prost(int32, tag = "1")]
pub execution_count: i32,
#[prost(int32, tag="2")]
#[prost(int32, tag = "2")]
pub execution_limit: i32,
#[prost(int32, tag="3")]
#[prost(int32, tag = "3")]
pub backlog_count: i32,
#[prost(int32, tag="4")]
#[prost(int32, tag = "4")]
pub backlog_limit: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HeartbeatRequest {
#[prost(string, tag="1")]
#[prost(string, tag = "1")]
pub worker_id: ::prost::alloc::string::String,
#[prost(string, tag="2")]
#[prost(string, tag = "2")]
pub queue_id: ::prost::alloc::string::String,
#[prost(message, optional, tag="3")]
#[prost(message, optional, tag = "3")]
pub capacity: ::core::option::Option<Capacity>,
#[prost(message, repeated, tag="4")]
#[prost(message, repeated, tag = "4")]
pub task_statuses: ::prost::alloc::vec::Vec<TaskStatus>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HeartbeatResponse {
#[prost(string, tag="1")]
#[prost(string, tag = "1")]
pub task_id: ::prost::alloc::string::String,
#[prost(string, tag="2")]
#[prost(string, tag = "2")]
pub namespace: ::prost::alloc::string::String,
#[prost(string, tag="3")]
#[prost(string, tag = "3")]
pub workflow_id: ::prost::alloc::string::String,
#[prost(string, repeated, tag="4")]
#[prost(string, repeated, tag = "4")]
pub cmd: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(enumeration="heartbeat_response::Operation", tag="5")]
#[prost(enumeration = "heartbeat_response::Operation", tag = "5")]
pub operation: i32,
}
/// Nested message and enum types in `HeartbeatResponse`.
Expand Down Expand Up @@ -86,33 +86,34 @@ pub mod heartbeat_response {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FastTaskEnvironment {
#[prost(string, tag="1")]
#[prost(string, tag = "1")]
pub queue_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FastTaskEnvironmentSpec {
#[prost(int32, tag="1")]
#[prost(int32, tag = "1")]
pub backlog_length: i32,
#[prost(int32, tag="2")]
#[prost(int32, tag = "2")]
pub parallelism: i32,
#[prost(bytes="vec", tag="3")]
#[prost(bytes = "vec", tag = "3")]
pub pod_template_spec: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag="4")]
#[prost(string, tag = "4")]
pub primary_container_name: ::prost::alloc::string::String,
#[prost(int32, tag="5")]
#[prost(int32, tag = "5")]
pub replica_count: i32,
#[prost(oneof="fast_task_environment_spec::TerminationCriteria", tags="6")]
pub termination_criteria: ::core::option::Option<fast_task_environment_spec::TerminationCriteria>,
#[prost(oneof = "fast_task_environment_spec::TerminationCriteria", tags = "6")]
pub termination_criteria:
::core::option::Option<fast_task_environment_spec::TerminationCriteria>,
}
/// Nested message and enum types in `FastTaskEnvironmentSpec`.
pub mod fast_task_environment_spec {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum TerminationCriteria {
#[prost(int32, tag="6")]
#[prost(int32, tag = "6")]
TtlSeconds(i32),
}
}
include!("fasttask.tonic.rs");
// @@protoc_insertion_point(module)
// @@protoc_insertion_point(module)

0 comments on commit 7cf7643

Please sign in to comment.