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

ci: set up GitHub Actions #2

Merged
merged 7 commits into from
Oct 26, 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
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: ci

on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
branches: ["main"]

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Rust
uses: dsherret/rust-toolchain-file@v1

- name: Install protoc
uses: arduino/setup-protoc@v2
with:
version: "21.12"

- name: Check formatting
run: cargo fmt -- --check

- name: Check linting
run: cargo clippy --all-targets --all-features -- -D clippy::all

- name: Build
run: cargo build --all-targets --all-features --tests -v

- name: Test
run: cargo test

- name: Publish
if: |
contains(matrix.os, 'ubuntu') &&
github.repository == 'denoland/denokv' &&
startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish -vv -p denokv_proto
cargo publish -vv -p denokv_sqlite
7 changes: 4 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ num-bigint = "0.4"
prost = "0.11"
prost-build = "0.11"
rand = "0.8.5"
rusqlite = "0.29.0"
rusqlite = { version = "0.29.0" }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.107"
tokio = { version = "1.33.0", features = ["full"] }
Expand Down
2 changes: 1 addition & 1 deletion proto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "deno_kv_proto"
name = "denokv_proto"
version = "0.1.0"
edition.workspace = true
license.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.73.0"
components = ["rustfmt", "clippy"]
8 changes: 6 additions & 2 deletions sqlite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "deno_kv_sqlite"
name = "denokv_sqlite"
version = "0.1.0"
edition.workspace = true
license.workspace = true
Expand All @@ -9,11 +9,15 @@ authors.workspace = true
[lib]
path = "lib.rs"

[features]
default = ["bundled"]
bundled = ["rusqlite/bundled"]

[dependencies]
anyhow.workspace = true
async-trait.workspace = true
chrono.workspace = true
deno_kv_proto = { path = "../proto" }
denokv_proto = { path = "../proto" }
futures.workspace = true
log.workspace = true
num-bigint.workspace = true
Expand Down
24 changes: 12 additions & 12 deletions sqlite/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ use std::time::Duration;
use anyhow::anyhow;
use chrono::DateTime;
use chrono::Utc;
use deno_kv_proto::decode_value;
use deno_kv_proto::encode_value;
use deno_kv_proto::encode_value_owned;
use deno_kv_proto::AtomicWrite;
use deno_kv_proto::CommitResult;
use deno_kv_proto::KvEntry;
use deno_kv_proto::MutationKind;
use deno_kv_proto::ReadRange;
use deno_kv_proto::ReadRangeOutput;
use deno_kv_proto::SnapshotReadOptions;
use deno_kv_proto::Value;
use deno_kv_proto::VALUE_ENCODING_V8;
use denokv_proto::decode_value;
use denokv_proto::encode_value;
use denokv_proto::encode_value_owned;
use denokv_proto::AtomicWrite;
use denokv_proto::CommitResult;
use denokv_proto::KvEntry;
use denokv_proto::MutationKind;
use denokv_proto::ReadRange;
use denokv_proto::ReadRangeOutput;
use denokv_proto::SnapshotReadOptions;
use denokv_proto::Value;
use denokv_proto::VALUE_ENCODING_V8;
use rand::Rng;
use rand::RngCore;
use rusqlite::params;
Expand Down
14 changes: 7 additions & 7 deletions sqlite/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ use crate::backend::SqliteBackend;
pub use crate::backend::TypeError;
use chrono::DateTime;
use chrono::Utc;
use deno_kv_proto::AtomicWrite;
use deno_kv_proto::CommitResult;
use deno_kv_proto::Database;
use deno_kv_proto::QueueMessageHandle;
use deno_kv_proto::ReadRange;
use deno_kv_proto::ReadRangeOutput;
use deno_kv_proto::SnapshotReadOptions;
use denokv_proto::AtomicWrite;
use denokv_proto::CommitResult;
use denokv_proto::Database;
use denokv_proto::QueueMessageHandle;
use denokv_proto::ReadRange;
use denokv_proto::ReadRangeOutput;
use denokv_proto::SnapshotReadOptions;
use futures::future::Either;
use rand::RngCore;
pub use rusqlite::Connection;
Expand Down