Skip to content

Commit

Permalink
add trial workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
saint1991 committed Nov 2, 2024
1 parent 58f6499 commit 6da2380
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 33 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "docker build and push"

on:
pull_request:
paths:
- .github/workflows/docker.yml
- proto/**.proto
- src/**
- Cargo.toml
- Cargo.lock
push:
tags:
- '*'

env:
PUBLISH: ${{ github.ref_type == 'tags' }}

jobs:
docker_build:
runs-on: ubuntu-latest
steps:
- name: check publish
run: echo '${{ env.PUBLISH }}'
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: ${{ env.PUBLISH == 'true' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/build-push-action@v6
with:
context: .
push: ${{ env.PUBLISH == 'true' }}
tags: saint1991/gduck:${{ env.PUBLISH == 'true' && github.ref_name || 'latest' }}
21 changes: 21 additions & 0 deletions .github/workflows/lint-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: check-rust

on:
pull_request:
paths:
- .github/workflows/lint-rust.yml
- **.rs
- Cargo.toml
- Cargo.lock

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Rust format check
run: cargo fmt --check
103 changes: 75 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ version = "0.1.0"
edition = "2021"

[dependencies]
anyhow = { version = "1.0.90", features = ["backtrace", "std"] }
anyhow = { version = "1.0.92", features = ["backtrace", "std"] }
async-stream = { version = "0.3.6" }
chrono = { version = "0.4.38" }
clap = { version = "4.5.20", features = ["derive"] }
duckdb = { version = "1.1.1", features = ["bundled", "chrono"] }
env_logger = { version = "0.11.5" }
futures-core = { version = "0.3.31" }
log = { version = "0.4.22" }
prost = { version = "0.13.3" }
prost-types = { version = "0.13.3" }
thiserror = { version = "1.0.64" }
tokio = { version = "1.40.0", features = ["rt-multi-thread", "macros", "sync" ] }
thiserror = { version = "1.0.66" }
tokio = { version = "1.41.0", features = ["rt-multi-thread", "macros", "sync" ] }
tokio-stream = { version = "0.1.16" }
tonic = { version = "0.12.3" }

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# gduck-rpc
PoC implementation that uses DuckDB feature via gRPC API
[![Build](https://github.com/saint1991/gduck-rpc/actions/workflows/docker.yml/badge.svg)](https://github.com/saint1991/gduck-rpc/actions/workflows/docker.yml)

A DuckDB server that serves duckdb feature via gRPC API.
18 changes: 17 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,28 @@ mod uri;

use std::net::SocketAddr;

use clap::Parser;
use tonic::transport::Server;

/// gRPC server for duckdb service
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
/// Bind address
#[arg(short, long, default_value = "0.0.0.0" )]
bind_address: String,

/// Port number to listen to
#[arg(short, long, default_value_t = 50051)]
port: i32,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = Args::parse();

env_logger::init();
let addr: SocketAddr = "0.0.0.0:50051".parse()?;
let addr: SocketAddr = format!("{}:{}", args.bind_address, args.port).parse()?;

let service = service::DuckDbService::new_server();

Expand Down

0 comments on commit 6da2380

Please sign in to comment.