From 5fe2d7ba79dec52e8b18be3ac684ad27425c3085 Mon Sep 17 00:00:00 2001 From: Fergus Molloy Date: Tue, 22 Jul 2025 00:23:06 +0100 Subject: [PATCH] add check step --- .gitea/workflows/backend.yaml | 31 ++++++++++++++++++++++++++----- backend/src/main.rs | 2 +- backend/src/router.rs | 1 + 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/backend.yaml b/.gitea/workflows/backend.yaml index bf88f9e..d0abcfa 100644 --- a/.gitea/workflows/backend.yaml +++ b/.gitea/workflows/backend.yaml @@ -3,6 +3,25 @@ run-name: ${{ gitea.actor }} is running backend actions on: [push] 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 + backend/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: runs-on: rust-latest defaults: @@ -16,8 +35,8 @@ jobs: path: | ~/.cargo/registry ~/.cargo/git - target - key: ${{ runner.os }}-cargo-build-${{ hashFiles('Cargo.lock') }} + backend/target + key: ${{ runner.os }}-cargo-build-${{ hashFiles('backend/Cargo.lock') }} - name: Build Release Binary run: cargo build --release --locked @@ -34,8 +53,10 @@ jobs: path: | ~/.cargo/registry ~/.cargo/git - target - key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.lock') }} + backend/target + 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 run: cargo test --no-run - name: Run Tests @@ -44,4 +65,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: nuchat-${{ hashFiles('src/**') }}-${{ hashFiles('tests/**') }}.log - path: logs/* + path: backend/logs/* diff --git a/backend/src/main.rs b/backend/src/main.rs index 7f0c844..1c68980 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -45,7 +45,7 @@ async fn main() { } #[allow(clippy::unused_async)] -#[allow(clippy::unused)] +#[allow(unused)] async fn await_shutdown(rx: mpsc::Receiver) -> Result { rx.recv() } diff --git a/backend/src/router.rs b/backend/src/router.rs index 28ae287..df733dc 100644 --- a/backend/src/router.rs +++ b/backend/src/router.rs @@ -5,6 +5,7 @@ use std::time::Duration; use axum::extract::Request; use axum::middleware::{Next, from_fn}; use axum::response::Response; +#[allow(unused_imports)] use axum::routing::{get, post}; use axum::{Router, body::Body}; use http::StatusCode;