feat: implement CI

This commit is contained in:
2026-08-07 15:23:58 -04:00
parent fc63991c39
commit 3df06a9992
11 changed files with 1126 additions and 38 deletions
+46 -35
View File
@@ -1,62 +1,73 @@
[workspace]
authors = ["Alex Maldonado <alexm@scient.ing>"]
channels = ["conda-forge"]
name = "coursebank"
version = "26.8.0"
authors = ["Scientific Computing Studio <opensource@scient.ing>"]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-arm64", "osx-64"]
version = "0.1.0"
[environments]
dev = ["dev"]
docs = ["docs"]
[dependencies]
rust = ">=1.96.0,<1.97"
c-compiler = "*"
pkg-config = "*"
[tasks]
build = "cargo build --release"
debug = "cargo build"
tests = "cargo test"
format = "cargo fmt"
lint = { cmd = "cargo clippy --all-targets -- -D warnings", depends-on = [
"format",
] }
check-docs = "cargo test --test docs"
doc = { cmd = "cargo doc --no-deps --open", depends-on = ["check-docs"] }
doc-build = { cmd = "cargo doc --no-deps", depends-on = ["check-docs"] }
doctests = "cargo test --doc"
# --- Build and run ---
build = { cmd = "cargo build --release", description = "Compile the release binary at target/release/coursebank" }
debug = { cmd = "cargo build", description = "Compile the debug binary" }
build-lean = { cmd = "cargo build --release --no-default-features", description = "Release build without the parquet feature" }
install = { cmd = "cargo install --path . --locked", description = "Install the coursebank binary onto your PATH" }
clean = { cmd = "cargo clean", description = "Remove the target directory" }
cb = { cmd = "cargo run --release --quiet --", description = "Run the CLI, e.g., `pixi run cb validate -C path/to/course`" }
clean = "cargo clean"
install = "cargo install --path . --locked"
check = { depends-on = ["format", "lint", "tests", "check-docs", "doc-build"] }
build-lean = "cargo build --release --no-default-features"
# --- Quality gate ---
format = { cmd = "cargo fmt --all", description = "Reformat the source in place" }
fmt-check = { cmd = "cargo fmt --all --check", description = "Fail if the source is not formatted; does not rewrite" }
lint = { cmd = "cargo clippy --all-targets -- -D warnings", description = "Run clippy with warnings treated as errors" }
tests = { cmd = "cargo test", description = "Run all tests: unit, integration, and doctests" }
doctests = { cmd = "cargo test --doc", description = "Run only the documentation examples" }
check-docs = { cmd = "cargo test --test docs", description = "Check that included markdown fences declare a language" }
check = { depends-on = ["fmt-check", "lint", "tests", "doctests", "check-docs", "doc-build"], description = "Full verify-only gate: formatting, lint, tests, and doc build" }
setup-tools = "cargo install cargo-about --locked --features cli"
licenses = "cargo about generate about.hbs -o THIRD-PARTY-LICENSES.txt"
# --- Documentation ---
doc = { cmd = "cargo doc --no-deps --open", depends-on = ["check-docs"], description = "Build the API docs and open them in a browser" }
doc-build = { cmd = "cargo doc --no-deps", depends-on = ["check-docs"], description = "Build the API docs without opening a browser" }
[tasks.dist]
description = "Assemble a release bundle (binary + license notices) in dist/"
depends-on = ["build", "licenses"]
cmd = "mkdir -p dist && cp target/release/coursebank dist/ && cp LICENSE.md THIRD-PARTY-LICENSES.txt dist/"
# --- Release packaging ---
setup-tools = { cmd = "cargo install cargo-about --locked --features cli", description = "Install cargo-about, which the licenses task needs" }
licenses = { cmd = "cargo about generate about.hbs -o THIRD-PARTY-LICENSES.txt", description = "Regenerate THIRD-PARTY-LICENSES.txt" }
dist = { cmd = "mkdir -p dist && cp target/release/coursebank dist/ && cp LICENSE.md THIRD-PARTY-LICENSES.txt dist/", depends-on = ["build", "licenses"], description = "Assemble a release bundle (binary and license notices) in dist/" }
[environments]
dev = ["dev"]
docs = ["docs"]
release = ["release"]
[tasks.cb]
cmd = "cargo run --release --quiet --"
description = "Run the CLI, e.g., `pixi run cb validate --course examples/course`"
# Developer tooling: editor support, a debugger, a faster test runner, and a
# file watcher.
[feature.dev.dependencies]
rust-analyzer = "*"
lldb = "*"
cargo-nextest = "*"
[feature.dev.tasks]
watch = "cargo watch -x check -x test"
nextest = "cargo nextest run"
nextest = { cmd = "cargo nextest run", description = "Run the test suite with nextest" }
# Typst is only needed to typeset exported .typ files by hand. The exporter
# writes .typ on its own and does not require typst to be installed.
[feature.docs.dependencies]
typst = "*"
[feature.docs.tasks]
typeset = "typst compile"
typeset = { cmd = "typst compile", description = "Compile a .typ file to PDF" }
# Release tooling, kept in its own environment so the default and dev
# environments do not pull in Python. bump-my-version reads .bumpversion.toml,
# which encodes the YY.MM.PATCH scheme.
[feature.release.dependencies]
bump-my-version = "*"
[feature.release.tasks]
bump = { cmd = "bump-my-version bump patch", description = "Cut the next release: rewrite the version in both manifests, commit, and tag" }
bump-show = { cmd = "bump-my-version show-bump", description = "Preview the next version without changing anything" }