Add corex library with resource-aware execution primitives

- Implement CI workflow for formatting, linting, testing, and documentation checks.
- Create publish workflow for automated publishing to crates.io.
- Add .gitignore to exclude build artifacts and editor files.
- Define Cargo.toml for corex and corex-core with dependencies and metadata.
- Add README.md files for corex and corex-core with usage instructions and licensing.
- Implement core execution primitives: spawn_io, compute, and spawn_bg with panic isolation.
- Establish global engine context for resource management based on logical CPU cores.
- Introduce error handling for compute panics.
This commit is contained in:
asepharyana
2026-08-28 16:05:04 +07:00
commit d8144e249e
17 changed files with 898 additions and 0 deletions
+86
View File
@@ -0,0 +1,86 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Clippy (all features)
run: cargo clippy --workspace --all-features -- -D warnings
- name: Clippy (no default features)
run: cargo clippy --workspace --no-default-features -- -D warnings
test-matrix:
name: Test (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: default features
flags: ""
- name: all features
flags: "--all-features"
- name: io only
flags: "--no-default-features --features io"
- name: compute only
flags: "--no-default-features --features compute"
- name: bg only
flags: "--no-default-features --features bg"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --workspace ${{ matrix.flags }}
- name: Test
run: cargo test --workspace ${{ matrix.flags }}
example:
name: Run example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo run --example main --features full
docs:
name: Docs check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps
package:
name: Cargo package dry-run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Package corex-core
run: cargo package -p corex-core --no-verify
- name: Package corex
run: cargo package -p corex --no-verify
+23
View File
@@ -0,0 +1,23 @@
name: Publish to crates.io
on:
push:
tags: ["v*.*.*"]
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Publish corex-core
run: cargo publish -p corex-core --allow-dirty --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Wait for crates.io indexing
run: sleep 30
- name: Publish corex
run: cargo publish -p corex --allow-dirty --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}