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

chore: CI with unit tests #21

Merged
merged 4 commits into from
Dec 6, 2023
Merged
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
51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Rust

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Cache Cargo dependencies
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install protoc (for Protocol Buffers)
run: |
set -eux -o pipefail
PROTOC_VERSION=3.19.4
PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
sudo chmod +x /usr/local/bin/protoc
sudo find /usr/local/include -type f | xargs sudo chmod a+r
sudo find /usr/local/include -type d | xargs sudo chmod a+rx
rm -f $PROTOC_ZIP

- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose
2 changes: 1 addition & 1 deletion src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait Mapper {
///
/// Following is an example of a cat container that just copies the input to output.
///
/// ```rust
/// ```rust,ignore
/// use numaflow::map::start_uds_server;
///
/// #[tokio::main]
Expand Down
4 changes: 2 additions & 2 deletions src/reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub trait Reducer {
///
/// Below is a reduce code to count the number of elements for a given set of keys and window.
///
/// ```rust
// use numaflow::reduce::start_uds_server;
/// ```rust,ignore
/// use numaflow::reduce::start_uds_server;
/// #[tokio::main]
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let reduce_handler = counter::Counter::new();
Expand Down
2 changes: 1 addition & 1 deletion src/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub trait Sinker {
///
/// A simple log sink.
///
/// ```rust
/// ```rust,ignore
/// use numaflow::sink;
/// use numaflow::sink::{Datum, Response};
/// use tonic::async_trait;
Expand Down
7 changes: 3 additions & 4 deletions src/sourcetransform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ pub trait SourceTransformer {
///
/// #Example
///
///
/// ```rust
/// ```rust,ignore
/// use numaflow::sourcetransform::start_uds_server;
///
/// A simple source transformer which assigns event time to the current time in utc.
/// // A simple source transformer which assigns event time to the current time in utc.
///
/// #[tokio::main]
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down Expand Up @@ -69,7 +68,7 @@ pub trait SourceTransformer {
/// reponse
/// }
/// }
///}
/// }
/// ```
async fn transform<T: Datum + Send + Sync + 'static>(&self, input: T) -> Vec<Message>;
}
Expand Down