Skip to content

Commit 265e46d

Browse files
SSebosebo
authored andcommitted
feat: github pipeline
1 parent 575c339 commit 265e46d

File tree

8 files changed

+93
-34
lines changed

8 files changed

+93
-34
lines changed

.github/workflows/rust.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Test
18+
run: make test
19+
- name: Release
20+
run: make release
21+
22+
test:
23+
runs-on: ubuntu-latest
24+
container:
25+
image: xd009642/tarpaulin:develop-nightly
26+
options: --security-opt seccomp=unconfined
27+
steps:
28+
- name: checkout repository
29+
uses: actions/checkout@v2
30+
31+
- name: generate code coverage
32+
run: |
33+
cargo +nightly tarpaulin --verbose --workspace --timeout 120 --out Xml
34+
35+
- name: upload to codecov.io
36+
uses: codecov/codecov-action@v2
37+
with:
38+
fail_ci_if_error: true
39+

Cargo.lock

Lines changed: 7 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name = "feature-probe-server-sdk"
44
version = "1.0.1"
55
license = "Apache-2.0"
66
authors = ["maintain@featureprobe.com"]
7+
description = "FeatureProbe Server Side SDK for Rust"
78

89
[lib]
910
name = "feature_probe_server_sdk"
@@ -59,5 +60,5 @@ criterion = "0.3"
5960
rusty-hook = "^0.11.2"
6061
tokio = { version = "1", features = ["full"] }
6162
tracing-subscriber = "0.2"
62-
feature-probe-server = { git = "ssh://git@github.com/FeatureProbe/feature-probe-server.git" }
63+
feature-probe-server = { git = "https://github.com/FeatureProbe/feature-probe-server.git" }
6364

Makefile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@ version = `git rev-parse --short HEAD`
66
clean:
77
cargo clean
88
release:
9-
(ssh-agent -k || true) && \
10-
eval `ssh-agent -s` && \
11-
ssh-add && \
12-
cargo build --release --verbose
9+
cargo build --release --verbose
1310
release-test:
14-
(ssh-agent -k || true) && \
15-
eval `ssh-agent -s` && \
16-
ssh-add && \
17-
cargo test --release --verbose && \
18-
cargo test --release --verbose --features async --no-default-features
11+
cargo test --release --verbose && \
12+
cargo test --release --verbose --features async --no-default-features
1913
test:
2014
cargo test --verbose && \
2115
cargo test --verbose --features use_tokio --features internal --features event_tokio --no-default-features

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# FeatureProbe Server Side SDK for Rust
2+
[![Top Language](https://img.shields.io/github/languages/top/FeatureProbe/server-sdk-rust)](https://github.com/FeatureProbe/server-sdk-rust/search?l=rust)
3+
[![codecov](https://codecov.io/gh/featureprobe/server-sdk-rust/branch/main/graph/badge.svg?token=TAN3AU4CK2)](https://codecov.io/gh/featureprobe/server-sdk-rust)
4+
[![Github Star](https://img.shields.io/github/stars/FeatureProbe/server-sdk-rust)](https://github.com/FeatureProbe/server-sdk-rust/stargazers)
5+
[![Apache-2.0 license](https://img.shields.io/github/license/FeatureProbe/FeatureProbe)](https://github.com/FeatureProbe/FeatureProbe/blob/main/LICENSE)
6+
27

38
Feature Probe is an open source feature management service. This SDK is used to control features in rust programs. This
49
SDK is designed primarily for use in multi-user systems such as web servers and applications.

grcov.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
branch: true
2+
ignore-not-existing: true
3+
llvm: true
4+
filter: covered
5+
output-type: lcov
6+
output-path: ./coverage/lcov.info
7+
ignore:
8+
- "*cargo*"
9+
- "*.md"
10+
- "*.toml"
11+
- "*.lock"
12+
- "*.json"
13+
- "examples"
14+
- "resources"
15+
- "Dockerfile"
16+
- "LICENSE"

src/core.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,13 @@ mod tests {
423423
assert!(repo.is_ok());
424424
}
425425

426+
#[test]
427+
fn test_load_invalid_json() {
428+
let json_str = "{invalid_json}";
429+
let repo = load_json(json_str);
430+
assert!(repo.is_err());
431+
}
432+
426433
#[test]
427434
fn test_salt_hash() {
428435
let bucket = salt_hash("key", "salt", 10000);

src/lib.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ pub struct FPDetail<T: Default> {
2626
pub enum FPError {
2727
#[error("invalid json: {0}")]
2828
JsonError(String),
29-
#[error("invalid http: {0}")]
30-
HttpError(String),
3129
#[error("invalid url: {0}")]
3230
UrlError(String),
3331
#[error("evaluation error")]
@@ -70,3 +68,17 @@ impl Header for SdkAuthorization {
7068
}
7169
}
7270
}
71+
72+
#[cfg(test)]
73+
mod tests {
74+
use super::*;
75+
76+
#[test]
77+
#[should_panic]
78+
fn test_encode_panic() {
79+
let v: Vec<u8> = vec![21, 20, 19, 18]; // not visible string
80+
let s = String::from_utf8(v).unwrap();
81+
let auth = SdkAuthorization(s);
82+
let _ = auth.encode();
83+
}
84+
}

0 commit comments

Comments
 (0)