add check step
This commit is contained in:
@ -3,6 +3,25 @@ run-name: ${{ gitea.actor }} is running backend actions
|
|||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: rust-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./backend
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Load Cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-check-${{ hashFiles('backend/Cargo.lock') }}
|
||||||
|
- name: Run Clippy
|
||||||
|
run: cargo clippy --no-deps -- -Dwarnings -Dclippy::correctness -Wclippy::pedantic -Wclippy::perf -Aclippy::missing_errors_doc -Aclippy::missing_panics_doc
|
||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: rust-latest
|
runs-on: rust-latest
|
||||||
defaults:
|
defaults:
|
||||||
@ -17,7 +36,7 @@ jobs:
|
|||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
target
|
target
|
||||||
key: ${{ runner.os }}-cargo-build-${{ hashFiles('Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-build-${{ hashFiles('backend/Cargo.lock') }}
|
||||||
- name: Build Release Binary
|
- name: Build Release Binary
|
||||||
run: cargo build --release --locked
|
run: cargo build --release --locked
|
||||||
|
|
||||||
@ -35,7 +54,9 @@ jobs:
|
|||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
target
|
target
|
||||||
key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-test-${{ hashFiles('backend/Cargo.lock') }}
|
||||||
|
- name: Build Binary with Shutdown
|
||||||
|
run: cargo build --features shutdown --bin nuchat
|
||||||
- name: Build Test Binary
|
- name: Build Test Binary
|
||||||
run: cargo test --no-run
|
run: cargo test --no-run
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
|
|||||||
@ -45,7 +45,7 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::unused_async)]
|
#[allow(clippy::unused_async)]
|
||||||
#[allow(clippy::unused)]
|
#[allow(unused)]
|
||||||
async fn await_shutdown(rx: mpsc::Receiver<bool>) -> Result<bool, mpsc::RecvError> {
|
async fn await_shutdown(rx: mpsc::Receiver<bool>) -> Result<bool, mpsc::RecvError> {
|
||||||
rx.recv()
|
rx.recv()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ use std::time::Duration;
|
|||||||
use axum::extract::Request;
|
use axum::extract::Request;
|
||||||
use axum::middleware::{Next, from_fn};
|
use axum::middleware::{Next, from_fn};
|
||||||
use axum::response::Response;
|
use axum::response::Response;
|
||||||
|
#[allow(unused_imports)]
|
||||||
use axum::routing::{get, post};
|
use axum::routing::{get, post};
|
||||||
use axum::{Router, body::Body};
|
use axum::{Router, body::Body};
|
||||||
use http::StatusCode;
|
use http::StatusCode;
|
||||||
|
|||||||
Reference in New Issue
Block a user