diff --git a/.github/workflows/.checks.yml b/.github/workflows/.checks.yml index 41bce08..bed60e3 100644 --- a/.github/workflows/.checks.yml +++ b/.github/workflows/.checks.yml @@ -11,6 +11,14 @@ jobs: uses: soltiHQ/actions/taskfile@main with: { command: cargo/fmt } + check: + runs-on: ${{ vars.RUNS_ON }} + steps: + - uses: actions/checkout@v4 + - name: Run check + uses: soltiHQ/actions/taskfile@main + with: { command: cargo/check } + test: runs-on: ${{ vars.RUNS_ON }} steps: diff --git a/Taskfile.yml b/Taskfile.yml index b82a474..4eeed85 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -43,7 +43,7 @@ tasks: \ --volume "{{.git_root}}/{{.MOUNT_DIR}}:/workspace:rw" \ {{if .VOLUMES}}{{range $vol := .VOLUMES}}--volume {{$vol}} {{end}}{{end}} \ - {{if .ENVS}}{{range $env := .ENVS}}--env {{$env}} {{end}}{{end}} \ + {{if .ENVS}}{{range $env := .ENVS}}--env "{{$env}}" {{end}}{{end}} \ \ --workdir /workspace \ {{.IMAGE}} \ @@ -70,6 +70,7 @@ tasks: - "RUSTUP_TOOLCHAIN={{.rust_version}}" - "RUSTUP_NO_UPDATE_CHECK=1" - "CARGO_INCREMENTAL=0" + - "RUSTFLAGS=-D warnings" # ================================================# # ----------------------PUBLIC--------------------# @@ -83,6 +84,14 @@ tasks: vars: CMD: "fmt --check --verbose" + cargo/check: + desc: Run 'cargo check'. + silent: true + cmds: + - task: _cargo/tool + vars: + CMD: "check" + cargo/clippy: desc: Run 'cargo clippy'. silent: true diff --git a/examples/controller.rs b/examples/controller.rs index 60b5116..65662de 100644 --- a/examples/controller.rs +++ b/examples/controller.rs @@ -60,7 +60,7 @@ async fn main() -> anyhow::Result<()> { println!("Demo 1: Queue Policy"); println!(" └► Submit 3 tasks with same name: they run sequentially"); - for i in 1..=3 { + for _ in 1..=3 { let spec = make_spec("job-in-queue", 800); sup.submit(ControllerSpec::queue(spec)).await?; } diff --git a/src/core/supervisor.rs b/src/core/supervisor.rs index 0118bf2..75d7195 100644 --- a/src/core/supervisor.rs +++ b/src/core/supervisor.rs @@ -91,9 +91,12 @@ //! ``` use std::{sync::Arc, time::Duration}; -use tokio::{sync::Notify, sync::OnceCell, sync::broadcast, time::timeout}; +use tokio::{sync::Notify, sync::broadcast, time::timeout}; use tokio_util::sync::CancellationToken; +#[cfg(feature = "controller")] +use tokio::sync::OnceCell; + use crate::core::{alive::AliveTracker, builder::SupervisorBuilder, registry::Registry}; use crate::{ config::Config,