Skip to content
Draft
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
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Lint

on:
push:
branches:
- main
- master
pull_request:


env:
CARGO_TERM_COLOR: always

jobs:
clippy:
name: Clippy linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-clippy-

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

fmt:
name: Check Rust Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Check formatting
run: cargo fmt --all -- --check
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-test-

- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose
6 changes: 3 additions & 3 deletions src/api/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ pub struct ServiceHealthResponse {

/// Construct supported api v1 routes
pub fn get_v1_routes() -> Router<AppState> {
return Router::new()
Router::new()
.route("/", get(root))
.route("/info", get(info))
.route("/health", get(handler_health));
.route("/health", get(handler_health))
}

/// Return API v1 root info
async fn root() -> impl IntoResponse {
return (StatusCode::OK, Json(json!({"name": "v1"})));
(StatusCode::OK, Json(json!({"name": "v1"})))
}

/// Return v1 API infos
Expand Down
Loading
Loading