From 2fc55ef9385fac9dc727e8cf0c526481a6ac5ca0 Mon Sep 17 00:00:00 2001 From: Matt Green Date: Fri, 2 Aug 2024 10:17:59 -0700 Subject: [PATCH 1/3] Add github actions --- .github/workflows/rust.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..aecc3cb --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,36 @@ +name: Rust + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: "-Dwarnings" + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run Clippy + run: cargo clippy --all-targets --all-features + + rust_fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run rust fmt + run: cargo fmt --all -- --check From 08d98ad0b63277dfb2c8ea516c0ac3dac747e62f Mon Sep 17 00:00:00 2001 From: Matt Green Date: Fri, 2 Aug 2024 10:20:37 -0700 Subject: [PATCH 2/3] update format --- .github/workflows/rust.yml | 14 +++++++------- crates/core/src/context.rs | 3 ++- crates/core/src/datastream.rs | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index aecc3cb..0a91501 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,13 +24,13 @@ jobs: clippy_check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Run Clippy - run: cargo clippy --all-targets --all-features - + - uses: actions/checkout@v4 + - name: Run Clippy + run: cargo clippy --all-targets --all-features + rust_fmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Run rust fmt - run: cargo fmt --all -- --check + - uses: actions/checkout@v4 + - name: Run rust fmt + run: cargo fmt --all -- --check diff --git a/crates/core/src/context.rs b/crates/core/src/context.rs index bb73387..b106c6d 100644 --- a/crates/core/src/context.rs +++ b/crates/core/src/context.rs @@ -44,7 +44,8 @@ impl Context { pub async fn from_topic(&self, topic: TopicReader) -> Result { let topic_name = topic.0.topic.clone(); - self.register_table(topic_name.clone(), Arc::new(topic)).await?; + self.register_table(topic_name.clone(), Arc::new(topic)) + .await?; let df = self .session_conext diff --git a/crates/core/src/datastream.rs b/crates/core/src/datastream.rs index 5542f3f..c50f25d 100644 --- a/crates/core/src/datastream.rs +++ b/crates/core/src/datastream.rs @@ -80,7 +80,8 @@ impl DataStream { .await?; self.context - .register_table(topic.clone(), Arc::new(sink_topic)).await?; + .register_table(topic.clone(), Arc::new(sink_topic)) + .await?; self.df .as_ref() From 032a4b672efd9d0eba42bf3f62d5243625ac4a71 Mon Sep 17 00:00:00 2001 From: Matt Green Date: Fri, 2 Aug 2024 10:42:01 -0700 Subject: [PATCH 3/3] add caching --- .github/workflows/rust.yml | 40 ++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0a91501..7fc74d3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,35 +2,41 @@ name: Rust on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: CARGO_TERM_COLOR: always RUSTFLAGS: "-Dwarnings" - jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + components: clippy + - uses: Swatinem/rust-cache@v2 - clippy_check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run Clippy - run: cargo clippy --all-targets --all-features + - name: Build + run: cargo build --verbose + - name: Run Clippy + run: cargo clippy --all-targets --all-features + - name: Run tests + run: cargo test --verbose rust_fmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Run rust fmt - run: cargo fmt --all -- --check + - uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + components: rustfmt + - name: Run rust fmt + run: cargo fmt --all -- --check