Skip to content
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
54 changes: 42 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ name: Build code0-flow crate

on:
push:
pull_request:

permissions:
contents: read

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

jobs:
crates:
ci:
runs-on: ubuntu-latest

defaults:
Expand All @@ -13,17 +21,39 @@ jobs:

steps:
- uses: actions/checkout@v7

- name: Setup rust
run: rustup update --no-self-update stable
run: |
rustup update --no-self-update stable
rustup component add rustfmt clippy

- name: Install protoc
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
- name: Build crate
run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo build
env:
RUST_BACKTRACE: 'full'
- name: Run Tests
run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo test --features all
env:
RUST_BACKTRACE: 'full'
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
protoc --version

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

- name: Check default feature set
run: cargo check --locked --all-targets

- name: Check feature combinations
run: |
cargo check --locked --all-targets --no-default-features
cargo check --locked --all-targets --features flow_definition
cargo check --locked --all-targets --features flow_config
cargo check --locked --all-targets --features flow_health
cargo check --locked --all-targets --features flow_service
cargo check --locked --all-targets --features flow_telemetry
cargo check --locked --all-targets --features all

- name: Run clippy
run: cargo clippy --locked --all-targets --features all -- -D warnings

- name: Run tests
run: cargo test --locked --features all

- name: Package crate
run: cargo package --allow-dirty
run: cargo package --locked
42 changes: 32 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ on:
tags:
- '*'

permissions:
contents: read

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

jobs:
crates:
publish:
runs-on: ubuntu-latest

environment: packages
Expand All @@ -16,21 +23,36 @@ jobs:
shell: bash

steps:
# Set up
- uses: actions/checkout@v7

- name: Setup rust
run: rustup update --no-self-update stable
run: |
rustup update --no-self-update stable
rustup component add rustfmt clippy

- name: Install protoc
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
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
protoc --version

- name: Set version
run: sed -i "s/version = \"0.0.0\"/version = \"${{ github.ref_name }}\"/" Cargo.toml

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

- name: Check crate
run: cargo check --locked --all-targets --features all

- name: Run clippy
run: cargo clippy --locked --all-targets --features all -- -D warnings

- name: Run tests
run: cargo test --locked --features all

- name: Cargo Login
run: cargo login ${{secrets.CARGO_REGISTRY_TOKEN}}
- name: Build crate
run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo build
env:
RUST_BACKTRACE: 'full'

# Release
- name: Publish crate
run: cargo publish --allow-dirty
run: cargo publish --allow-dirty
4 changes: 2 additions & 2 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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Internal Rust library for CodeZero execution services (Aquila, Draco, Taurus). I
- `flow_service` push definitions to Aquila via gRPC (depends on `flow_definition`)
- `flow_config` env helpers and `.env` loading
- `flow_health` tonic health service with NATS readiness

- `flow_telemetry` helpers for Open Telemetry
10 changes: 5 additions & 5 deletions src/flow_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ pub fn env_with_default<T: FromStr + Debug>(key: &str, default: T) -> T {
match std::env::var(key) {
Ok(string) => match T::from_str(&string) {
Ok(value) => {
log::info!("Found env: {} with value: {:?}", key, &value);
log::info!("Found env: {} with value: {:?}", key, value);
value
}
Err(_) => {
log::warn!("Failed to parse env: {} with value: {:?}", key, &string);
log::warn!("Failed to parse env: {} with value: {:?}", key, string);
default
}
},
Expand Down Expand Up @@ -99,7 +99,7 @@ mod tests {
}

let result = env_with_default(key, false);
assert_eq!(result, true);
assert!(result);

unsafe {
env::remove_var(key);
Expand All @@ -114,7 +114,7 @@ mod tests {
}

let result = env_with_default(key, true);
assert_eq!(result, false);
assert!(!result);

unsafe {
env::remove_var(key);
Expand All @@ -141,7 +141,7 @@ mod tests {
}

let result = env_with_default(key, false);
assert_eq!(result, false);
assert!(!result);

unsafe {
env::remove_var(key);
Expand Down
1 change: 1 addition & 0 deletions src/flow_definition/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::io;
use std::path::PathBuf;

#[derive(Debug)]
#[allow(clippy::enum_variant_names)]
pub enum ReaderError {
JsonError {
path: PathBuf,
Expand Down
Loading