Skip to content

Commit c611d87

Browse files
Merge pull request #171 from code0-tech/#96-reader-verification-tests
reader verification tests
2 parents 6df9a67 + 47d2cbd commit c611d87

7 files changed

Lines changed: 332 additions & 32 deletions

File tree

.github/workflows/build.yml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ name: Build code0-flow crate
22

33
on:
44
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
RUST_BACKTRACE: full
513

614
jobs:
7-
crates:
15+
ci:
816
runs-on: ubuntu-latest
917

1018
defaults:
@@ -13,17 +21,39 @@ jobs:
1321

1422
steps:
1523
- uses: actions/checkout@v7
24+
1625
- name: Setup rust
17-
run: rustup update --no-self-update stable
26+
run: |
27+
rustup update --no-self-update stable
28+
rustup component add rustfmt clippy
29+
1830
- name: Install protoc
19-
run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d ${{ runner.temp }}/proto && chmod +x ${{ runner.temp }}/proto/bin/protoc && ${{ runner.temp }}/proto/bin/protoc --version
20-
- name: Build crate
21-
run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo build
22-
env:
23-
RUST_BACKTRACE: 'full'
24-
- name: Run Tests
25-
run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo test --features all
26-
env:
27-
RUST_BACKTRACE: 'full'
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y protobuf-compiler
34+
protoc --version
35+
36+
- name: Check formatting
37+
run: cargo fmt --all -- --check
38+
39+
- name: Check default feature set
40+
run: cargo check --locked --all-targets
41+
42+
- name: Check feature combinations
43+
run: |
44+
cargo check --locked --all-targets --no-default-features
45+
cargo check --locked --all-targets --features flow_definition
46+
cargo check --locked --all-targets --features flow_config
47+
cargo check --locked --all-targets --features flow_health
48+
cargo check --locked --all-targets --features flow_service
49+
cargo check --locked --all-targets --features flow_telemetry
50+
cargo check --locked --all-targets --features all
51+
52+
- name: Run clippy
53+
run: cargo clippy --locked --all-targets --features all -- -D warnings
54+
55+
- name: Run tests
56+
run: cargo test --locked --features all
57+
2858
- name: Package crate
29-
run: cargo package --allow-dirty
59+
run: cargo package --locked

.github/workflows/publish.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ on:
55
tags:
66
- '*'
77

8+
permissions:
9+
contents: read
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
RUST_BACKTRACE: full
14+
815
jobs:
9-
crates:
16+
publish:
1017
runs-on: ubuntu-latest
1118

1219
environment: packages
@@ -16,21 +23,36 @@ jobs:
1623
shell: bash
1724

1825
steps:
19-
# Set up
2026
- uses: actions/checkout@v7
27+
2128
- name: Setup rust
22-
run: rustup update --no-self-update stable
29+
run: |
30+
rustup update --no-self-update stable
31+
rustup component add rustfmt clippy
32+
2333
- name: Install protoc
24-
run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d ${{ runner.temp }}/proto && chmod +x ${{ runner.temp }}/proto/bin/protoc && ${{ runner.temp }}/proto/bin/protoc --version
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y protobuf-compiler
37+
protoc --version
38+
2539
- name: Set version
2640
run: sed -i "s/version = \"0.0.0\"/version = \"${{ github.ref_name }}\"/" Cargo.toml
41+
42+
- name: Check formatting
43+
run: cargo fmt --all -- --check
44+
45+
- name: Check crate
46+
run: cargo check --locked --all-targets --features all
47+
48+
- name: Run clippy
49+
run: cargo clippy --locked --all-targets --features all -- -D warnings
50+
51+
- name: Run tests
52+
run: cargo test --locked --features all
53+
2754
- name: Cargo Login
2855
run: cargo login ${{secrets.CARGO_REGISTRY_TOKEN}}
29-
- name: Build crate
30-
run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo build
31-
env:
32-
RUST_BACKTRACE: 'full'
3356

34-
# Release
3557
- name: Publish crate
36-
run: cargo publish --allow-dirty
58+
run: cargo publish --allow-dirty

Cargo.lock

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ Internal Rust library for CodeZero execution services (Aquila, Draco, Taurus). I
1111
- `flow_service` push definitions to Aquila via gRPC (depends on `flow_definition`)
1212
- `flow_config` env helpers and `.env` loading
1313
- `flow_health` tonic health service with NATS readiness
14-
14+
- `flow_telemetry` helpers for Open Telemetry

src/flow_config/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ pub fn env_with_default<T: FromStr + Debug>(key: &str, default: T) -> T {
77
match std::env::var(key) {
88
Ok(string) => match T::from_str(&string) {
99
Ok(value) => {
10-
log::info!("Found env: {} with value: {:?}", key, &value);
10+
log::info!("Found env: {} with value: {:?}", key, value);
1111
value
1212
}
1313
Err(_) => {
14-
log::warn!("Failed to parse env: {} with value: {:?}", key, &string);
14+
log::warn!("Failed to parse env: {} with value: {:?}", key, string);
1515
default
1616
}
1717
},
@@ -99,7 +99,7 @@ mod tests {
9999
}
100100

101101
let result = env_with_default(key, false);
102-
assert_eq!(result, true);
102+
assert!(result);
103103

104104
unsafe {
105105
env::remove_var(key);
@@ -114,7 +114,7 @@ mod tests {
114114
}
115115

116116
let result = env_with_default(key, true);
117-
assert_eq!(result, false);
117+
assert!(!result);
118118

119119
unsafe {
120120
env::remove_var(key);
@@ -141,7 +141,7 @@ mod tests {
141141
}
142142

143143
let result = env_with_default(key, false);
144-
assert_eq!(result, false);
144+
assert!(!result);
145145

146146
unsafe {
147147
env::remove_var(key);

src/flow_definition/error/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::io;
22
use std::path::PathBuf;
33

44
#[derive(Debug)]
5+
#[allow(clippy::enum_variant_names)]
56
pub enum ReaderError {
67
JsonError {
78
path: PathBuf,

0 commit comments

Comments
 (0)