Library CI

.github/workflows/libGlobalBuild.yml

Source: .github/workflows/libGlobalBuild.yml · reusable workflow

Verify Rust libraries, publish crates and deploy their API documentation.

Intended for: Library crates/workspaces; crate_names match Cargo package names, not guessed directory names.

Release behavior#

One lint job (fmt, audit, MSRV, packaging dry runs) and a test job per desktop (Clippy with every feature and with default features, then the default cargo test targets, doctests included and benches excluded). publish refreshes the GitHub Release, uploads the changelog and on tags opens dependent issues; tagged runs publish crates, per crate or as the dependency-ordered workspace. Main pushes can deploy rustdoc. Benchmarks run on tags with generate_benchmarks, after publish, through benchmarks.yml.

Artifacts and effects#

  • crates.io packages
  • Rustdoc Pages
  • Refreshed GitHub Release with optional changelog/benchmarks
  • Dependent repository notifications on configured tags

Assumptions and permissions#

  • Caller permissions must allow release contents writes and Pages/OIDC when selected.
  • resolve-crate-manifest.sh uses cargo metadata and normalizes hyphens/underscores.
  • Workspace publishing removes the temporary .stroggforge checkout before Cargo's dirty-tree check.
  • Registry token is required for publishing; dependent issue creation requires DW_BOT_PAT.

Failure modes#

  • Manifest/package mismatch: use [package].name, not the repository spelling.
  • Crates.io 429 or dependency visibility: workspace publisher retries and waits for the index; inspect its log before manual publishing.
  • Missing full Git history breaks changelog quality.

Example#

Use the generated library caller template.

Inputs#

NameTypeRequiredDefaultDescription
cargo_publishbooleanfalsetruePublish to crates.io on tagged releases; run a dry-run on all other pushes. Requires CARGO_REGISTRY_TOKEN secret.
cargo_publish_workspacebooleanfalsefalsePublish every publishable workspace member in dependency order instead of one crate per crate name. Skips versions already on crates.io and waits out crates.io rate limits.
crate_namesstringtrue—JSON array of crate names to publish, e.g. '["my-lib"]'. Must match [package].name in Cargo.toml.
dependent_repo_namesstringfalseDependent repositories to notify on tagged releases, one owner/repo per line. JSON arrays are still accepted for compatibility.
generate_benchmarksbooleanfalsefalseRun cargo bench, generate BENCHMARKS.md from Criterion output or the raw benchmark log, and upload it to the release.
generate_changelogbooleanfalsetrueGenerate a CHANGELOG.md from git history and upload it to the release.
generate_discord_notificationbooleanfalsetrueGenerate a discord notification to DreamWeave upon success.
mod_templatebooleanfalsefalseThe repository is a DreamWeave Mod Template site. modGlobalBuild records each version crates.io has in mod.lock, after a tag's publish, and builds and deploys the site. Replaces rustdoc Pages; the caller also grants actions: write.
msrvstringfalseMinimum supported Rust version to check the workspace against before release, e.g. '1.88'. 'auto' reads rust-version from Cargo.toml. Empty skips the check.
publish_docsbooleanfalsetrueBuild cargo doc and deploy to GitHub Pages. Disable if the project uses its own SSG.

Secrets#

NameTypeRequiredDefaultDescription
CARGO_REGISTRY_TOKEN—false——
DISCORD_CHANNEL_WEBHOOK—false——
DW_BOT_PAT—false——
DW_TOOLS_CHANNEL_WEBHOOK—false——

Permissions#

Top-level: —. Undeclared means inherited from the caller, not "none needed".

Job dependency graph#

Edges are YAML needs; conditional jobs may not run. Conditions are listed below.

workflow-libGlobalBuild relationship diagram. Its textual ledger or workflow contract is on this page or linked below.
workflow libGlobalBuild · Mermaid source · Full-size SVG
Read diagram source
flowchart TD
  n_benchmarks["benchmarks"]
  n_crates["crates"]
  n_docs["docs"]
  n_lint["lint"]
  n_mod_template["mod-template"]
  n_notify["notify"]
  n_publish["publish"]
  n_site_check["site-check"]
  n_test["test"]
  n_publish --> n_benchmarks
  n_lint --> n_crates
  n_test --> n_crates
  n_lint --> n_docs
  n_test --> n_docs
  n_publish --> n_mod_template
  n_crates --> n_mod_template
  n_lint --> n_notify
  n_test --> n_notify
  n_publish --> n_notify
  n_crates --> n_notify
  n_docs --> n_notify
  n_benchmarks --> n_notify
  n_mod_template --> n_notify
  n_lint --> n_publish
  n_test --> n_publish

Jobs#

JobNeedsRunner / delegateContainer / strategyCondition
benchmarkspublish— / DreamWeave-MP/StroggForge/.github/workflows/benchmarks.yml@v72— / —inputs.generate_benchmarks && github.ref_type == 'tag' && needs.publish.result == 'success'
crateslint, testubuntu-24.04 / —— / —inputs.cargo_publish && github.ref_type == 'tag'
docslint, testubuntu-24.04 / —— / —inputs.publish_docs && !inputs.mod_template && github.event_name == 'push' && github.ref == 'refs/heads/main'
lintubuntu-24.04 / —— / ——
mod-templatepublish, crates— / DreamWeave-MP/StroggForge/.github/workflows/modGlobalBuild.yml@v72— / —always() && !cancelled() && inputs.mod_template && github.event_name != 'pull_request' && needs.publish.result == 'success' && (github.ref_type != 'tag' || !inputs.cargo_publish || needs.crates.result == 'success')
notifylint, test, publish, crates, docs, benchmarks, mod-template— / DreamWeave-MP/StroggForge/.github/workflows/discord.yml@v72— / —always() && !cancelled() && inputs.generate_discord_notification && github.event_name == 'push'
publishlint, testubuntu-24.04 / —— / —github.event_name != 'pull_request'
site-check— / DreamWeave-MP/StroggForge/.github/workflows/modGlobalBuild.yml@v72— / —inputs.mod_template && github.event_name == 'pull_request'
test${{ matrix.os }} / —— / {"fail-fast":false,"matrix":{"os":["macos-latest","macos-26-intel","ubuntu-22.04","windows-2025-vs2026"]}}—

Steps#

benchmarks#

StepAction / commandCondition

crates#

StepAction / commandCondition
—actions/checkout@v6—
—actions/checkout@v6—
—DreamWeave-MP/StroggForge/.github/actions/rust-setup@v72—
Publish to crates.ioif [ "$PUBLISH_WORKSPACE" = true ]; then cp .stroggforge/.github/scripts/publish_workspace.py "$RUNNER_TEMP/publish_workspace.py" rm -rf .stroggforge python3 "$RUNNER_TEMP/publish_workspace.py" exit 0 fi manifests=() for crate in $(jq -r '.[]' <<<"$CRATE_NAMES"); do manifests+=("$(bash .stroggforge/scripts/shared/resolve-crate-manifest.sh "$crate")") done rm -rf .stroggforge for manifest in "${manifests[@]}"; do cargo publish --manifest-path "$manifest" done—

docs#

StepAction / commandCondition
—actions/checkout@v6—
—actions/checkout@v6—
—DreamWeave-MP/StroggForge/.github/actions/rust-setup@v72—
Build the documentationrm -rf target/doc cargo doc --no-deps --workspace bash .stroggforge/scripts/shared/docs-index.sh '${{ inputs.crate_names }}' target/doc/index.html—
—actions/configure-pages@v6.0.0—
—actions/upload-pages-artifact@v5.0.0—
Deploy to GitHub Pagesactions/deploy-pages@v5.0.0—

lint#

StepAction / commandCondition
—actions/checkout@v6—
—actions/checkout@v6—
—DreamWeave-MP/StroggForge/.github/actions/rust-setup@v72—
Check formattingcargo fmt --all --check—
Generate Cargo.lock for the auditif [ ! -f Cargo.lock ]; then cargo generate-lockfile fi—
—taiki-e/install-action@cargo-audit—
Audit dependencies against RustSeccargo audit—
Package each crate for crates.io (dry run)if [ "$PUBLISH_WORKSPACE" = true ]; then cargo publish --workspace --dry-run exit 0 fi for crate in $(jq -r '.[]' <<<"$CRATE_NAMES"); do manifest=$(bash .stroggforge/scripts/shared/resolve-crate-manifest.sh "$crate") cargo publish --dry-run --manifest-path "$manifest" doneinputs.cargo_publish && github.ref_type != 'tag'
Resolve the MSRVbash .stroggforge/scripts/shared/resolve-msrv.sh "$MSRV_INPUT"inputs.msrv != ''
—DreamWeave-MP/StroggForge/.github/actions/rust-setup@v72inputs.msrv != ''
Check on the MSRVcargo "+$MSRV_TOOLCHAIN" check --workspace --all-features --all-targetsinputs.msrv != ''

mod-template#

StepAction / commandCondition

notify#

StepAction / commandCondition

publish#

StepAction / commandCondition
—actions/checkout@v6—
—actions/checkout@v6—
Refresh the GitHub releaseecho "release_name=$RELEASE_NAME" >> "$GITHUB_OUTPUT" bash .stroggforge/scripts/shared/refresh-github-release.sh "$RELEASE_NAME" "$WORKFLOW_RUN_ID" "$RELEASE_REPOSITORY"—
Generate and upload the changelogbash .stroggforge/scripts/shared/changelog.sh CHANGELOG.md gh release upload "$RELEASE_NAME" CHANGELOG.md --clobber --repo "$REPOSITORY"inputs.generate_changelog
Open an issue in each dependent repositorybash .stroggforge/scripts/shared/create-dependent-update-issues.sh "$DEPENDENT_REPO_NAMES" ''github.ref_type == 'tag' && inputs.dependent_repo_names != '' && inputs.dependent_repo_names != '[]'

site-check#

StepAction / commandCondition

test#

StepAction / commandCondition
—actions/checkout@v6—
—DreamWeave-MP/StroggForge/.github/actions/rust-setup@v72—
Clippy with every featurecargo clippy --workspace --all-targets --all-features -- -W clippy::pedantic -D warnings—
Clippy with the default featurescargo clippy --workspace -- -W clippy::pedantic -D warnings—
Build the testscargo test --workspace --all-features --no-run --timings—
Run the testscargo test --workspace --all-features -- --show-output—
—actions/upload-artifact@v7always() && steps.build_tests.outcome != 'skipped'