diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..7ba0a1e --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,28 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + check_fmt_and_test: + name: Check, Format, and Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + # - uses: Swatinem/rust-cache@v2 + # with: + # shared-key: check + # cache-on-failure: true + - run: cargo fmt --check + - run: cargo clippy --all-targets --all-features + - run: cargo test diff --git a/src/env.rs b/src/env.rs index 3c8d50c..de0e7f0 100644 --- a/src/env.rs +++ b/src/env.rs @@ -4,5 +4,5 @@ use std::env; pub static ERGO_NODE_URL: Lazy = Lazy::new(|| get_var("ERGO_NODE_URL")); fn get_var(key: &str) -> String { - env::var(key).expect(&format!("Environment variable `{}` must be set", key)) + env::var(key).unwrap_or_else(|_| panic!("Environment variable `{key}` must be set")) } diff --git a/src/lib.rs b/src/lib.rs index a1104a7..6be3b86 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,5 +2,5 @@ pub mod clients; pub mod env; pub mod error; pub mod mempool; -pub mod types; pub mod tracing; +pub mod types;