Skip to content
Merged
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
61 changes: 0 additions & 61 deletions .github/actions/taskfile/action.yml

This file was deleted.

16 changes: 3 additions & 13 deletions .github/workflows/.checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,13 @@ name: Checks

on: { workflow_call: {} }

permissions: {
contents: read,
actions: write
}

env:
CI: "true"
RUST_BACKTRACE: "1"
CARGO_TERM_COLOR: "always"

jobs:
fmt:
runs-on: ${{ vars.RUNS_ON }}
steps:
- uses: actions/checkout@v4
- name: Run fmt
uses: ./.github/actions/taskfile
uses: soltiHQ/actions/taskfile@main
with: { command: cargo/fmt }

test:
Expand All @@ -32,7 +22,7 @@ jobs:
with: { job_name: test }

- name: Run Job
uses: ./.github/actions/taskfile
uses: soltiHQ/actions/taskfile@main
with: { command: cargo/test }

- name: Put Cache
Expand All @@ -51,7 +41,7 @@ jobs:
with: { job_name: clippy }

- name: Run Job
uses: ./.github/actions/taskfile
uses: soltiHQ/actions/taskfile@main
with: { command: cargo/clippy }

- name: Put Cache
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/.docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Docs

on: { workflow_call: {} }

jobs:
docs:
runs-on: ${{ vars.RUNS_ON }}
steps:
- uses: actions/checkout@v4
- name: Run docs gen
uses: soltiHQ/actions/taskfile@main
with: { command: cargo/docs }
27 changes: 27 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Pr

on:
pull_request:
types: [opened, synchronize]

concurrency:
group: pr-${{ github.ref }}
cancel-in-progress: true

permissions: {
contents: read,
actions: write
}

jobs:
docs:
name: Docs
uses: ./.github/workflows/.docs.yml

pr-check:
name: Pr Check
needs: docs
runs-on: ${{ vars.RUNS_ON }}
steps:
- name: All checks passed
run: echo "All Pr checks completed successfully!"
22 changes: 17 additions & 5 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ vars:
git_root:
sh: git rev-parse --show-toplevel

rust_version: "1.90"
rust_version: "1.90.0"
cache_dir: ".cache"

tasks:
Expand Down Expand Up @@ -59,14 +59,16 @@ tasks:
- cmd: mkdir -p "{{.git_root}}/{{.cache_dir}}"
- task: _docker/run
vars:
IMAGE: "rust:{{.rust_version}}-slim"
IMAGE: "ghcr.io/soltihq/cargo-tools:{{.rust_version}}"
CMD: "{{.CMD}}"
MOUNT_DIR: "."
VOLUMES:
- "{{.git_root}}/{{.cache_dir}}:/tmp/{{.cache_dir}}"
ENVS:
- "CARGO_TARGET_DIR=/tmp/{{.cache_dir}}/target"
- "CARGO_HOME=/tmp/{{.cache_dir}}/cargo"
- "RUSTUP_TOOLCHAIN={{.rust_version}}"
- "RUSTUP_NO_UPDATE_CHECK=1"
- "CARGO_INCREMENTAL=0"

# ================================================#
Expand All @@ -78,18 +80,28 @@ tasks:
cmds:
- task: _cargo/tool
vars:
CMD: "rustup component add rustfmt && cargo fmt --check --verbose"
CMD: "fmt --check --verbose"

cargo/clippy:
desc: Run 'cargo clippy'.
cmds:
- task: _cargo/tool
vars:
CMD: "rustup component add clippy && cargo clippy --all --all-features -- -D warnings"
CMD: "clippy --all --all-features -- -D warnings"

cargo/test:
desc: Run 'cargo test'.
cmds:
- task: _cargo/tool
vars:
CMD: "cargo test --all --all-features"
CMD: "test --all --all-features"

cargo/docs:
desc: Run 'rustdoc'.
cmds:
- task: _cargo/tool
vars:
CMD: >-
+nightly rustdoc --lib -Zrustdoc-map --features "logging controller"
-Zunstable-options -Zrustdoc-scrape-examples
--config 'build.rustdocflags=["--cfg","docsrs","-Z","unstable-options","--cap-lints","warn"]'
1 change: 0 additions & 1 deletion src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ impl SupervisorBuilder {
///
/// Requires the `controller` feature flag.
#[cfg(feature = "controller")]
#[cfg_attr(docsrs, doc(cfg(feature = "controller")))]
pub fn with_controller(mut self, config: crate::controller::ControllerConfig) -> Self {
self.controller_config = Some(config);
self
Expand Down
2 changes: 0 additions & 2 deletions src/core/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ impl Supervisor {
///
/// Requires the `controller` feature flag.
#[cfg(feature = "controller")]
#[cfg_attr(docsrs, doc(cfg(feature = "controller")))]
pub async fn submit(
&self,
spec: crate::controller::ControllerSpec,
Expand All @@ -280,7 +279,6 @@ impl Supervisor {
///
/// Requires the `controller` feature flag.
#[cfg(feature = "controller")]
#[cfg_attr(docsrs, doc(cfg(feature = "controller")))]
pub fn try_submit(
&self,
spec: crate::controller::ControllerSpec,
Expand Down
23 changes: 9 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![doc(html_no_source)]
#![cfg_attr(docsrs, feature(doc_cfg))]

//! # taskvisor
//!
//! **Taskvisor** is a lightweight task orchestration library for Rust.
Expand All @@ -13,8 +10,8 @@
//! ### Overview
//! ```text
//! β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
//! β”‚ TaskSpec β”‚ … β”‚ TaskSpec β”‚ … β”‚ TaskSpec β”‚
//! β”‚(user task #1)β”‚ … β”‚(user task #2)β”‚ … β”‚(user task #3)β”‚
//! β”‚ TaskSpec β”‚ β”‚ TaskSpec β”‚ β”‚ TaskSpec β”‚
//! β”‚(user task #1)β”‚ β”‚(user task #2)β”‚ β”‚(user task #3)β”‚
//! β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
//! β–Ό β–Ό β–Ό
//! β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
Expand All @@ -40,7 +37,7 @@
//! β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
//! β”‚ Bus (broadcast channel) β”‚
//! β”‚ (capacity: Config::bus_capacity) β”‚
//! β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
//!β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
//! β–Ό
//! β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
//! β”‚ subscriber_listener β”‚
Expand All @@ -49,11 +46,9 @@
//! β–Ό β–Ό
//! AliveTracker SubscriberSet
//! (sequence-based) (per-sub queues)
//! β”‚
//! β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
//! β–Ό β–Ό β–Ό
//! worker1 worker2 workerN
//! β”‚ β”‚ β”‚
//! β–Ό β–Ό β–Ό
//! sub1.on sub2.on subN.on
//! _event() _event() _event()
Expand All @@ -70,12 +65,12 @@
//! β”œβ”€β–Ί run_once(task, timeout, attempt)
//! β”‚ β”‚
//! β”‚ β”œβ”€ Ok ──► publish TaskStopped
//! β”‚ β”‚ β”œβ”€ RestartPolicy::Never β†’ ActorExhausted, exit
//! β”‚ β”‚ β”œβ”€ RestartPolicy::OnFailure β†’ ActorExhausted, exit
//! β”‚ β”‚ └─ RestartPolicy::Always β†’ reset delay, continue
//! β”‚ β”‚ β”œβ”€ RestartPolicy::Never ─► ActorExhausted, exit
//! β”‚ β”‚ β”œβ”€ RestartPolicy::OnFailure ─► ActorExhausted, exit
//! β”‚ β”‚ └─ RestartPolicy::Always ─► reset delay, continue
//! β”‚ β”‚
//! β”‚ └─ Err ──► publish TaskFailed{ task, error, attempt }
//! β”‚ β”œβ”€ RestartPolicy::Never β†’ ActorExhausted, exit
//! β”‚ β”œβ”€ RestartPolicy::Never ─► ActorExhausted, exit
//! β”‚ └─ RestartPolicy::OnFailure/Always:
//! β”‚ β”œβ”€ compute delay = backoff.next(prev_delay)
//! β”‚ β”œβ”€ publish BackoffScheduled{ delay, attempt }
Expand All @@ -84,8 +79,8 @@
//! β”‚
//! └─ exit conditions:
//! - runtime_token cancelled (OS signal or explicit remove)
//! - RestartPolicy forbids continuation β†’ ActorExhausted
//! - Fatal error β†’ ActorDead
//! - RestartPolicy forbids continuation ─► ActorExhausted
//! - Fatal error ─► ActorDead
//! - semaphore closed
//! }
//!
Expand Down