feat(xtask): consolidate CI workflows onto xtask helpers (#542)

- split the xtask crate into structured modules for
  - bindings
  - ci
  - dev
  - util
  - no-std
- Adding commands for
  - ci-release/ci-debug
  - MUSL/no-std
  - per- binding language smoke tests
  - developer tasks (fmt, clippy, pre-commit, pre-push)
- refresh Cargo manifests/locks, binding readmes, and shared FFI helpers so every binding reuses the same preparation steps
- refactor GitHub Actions (release/debug, extensions, CodeQL, clippy, bindings) to call the new xtask commands
- Use rust-cache in ci workflows (microsoft qdk also does this)
- extend README with a contributor workflow section describing how xtask mirrors CI expectations
- update pre-commit and pre-push hooks to use the xtask dev commands

WORKAROUND:
When dotnet is run from an xtask, codeql tracer intercepts it an routes to a nonexistent binary.
Therefore in codeql workflow, xtask is not used for c# and instead dotnet is directly invoked.
Tracked by #545

closes #475

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2026-01-27 07:42:21 +05:30
committed by GitHub
parent 2b1434b3ac
commit e68e852ee3
56 changed files with 3478 additions and 608 deletions

View File

@@ -4,25 +4,4 @@
set -eo pipefail
if [ -f Cargo.toml ]; then
# Ensure that all targets can be built.
cargo build --all-targets
#Ensure that code is correctly formatted.
cargo fmt --check || (echo "Run cargo fmt to fix formatting" && exit 1)
# Ensure that clippy warnings are addressed.
cargo clippy --all-targets --no-deps -- -Dwarnings
# Ensure binding versions reflect the staged changes.
cargo xtask bindings --check
# Ensure that all modifications are included.
# TODO refine status checking.
if git status -s | grep -e "MM " -e "??" -e "AM " -e " M " > /dev/null; then
printf "\nUnstaged changes found:\n"
git status -s | grep -e "MM " -e "??" -e "AM " -e " M "
echo "Stage them and try again"
exit 1
fi
fi
cargo xtask pre-commit

View File

@@ -4,37 +4,4 @@
set -eo pipefail
if [ -f Cargo.toml ]; then
# Run precommit checks.
dir=$(dirname "${BASH_SOURCE[0]}")
"$dir/pre-commit"
# Ensure that the public API works.
cargo test --doc
# Ensure that no_std build succeeds.
# Build for a target that has no std available.
if command -v rustup > /dev/null; then
rustup target add thumbv7m-none-eabi
(cd tests/ensure_no_std; cargo build -r --target thumbv7m-none-eabi)
fi
# Ensure that we can build with only std.
cargo build --example regorus --no-default-features --features std
# Ensure that we can build with all features.
cargo build --all-features
# Ensure that all tests pass.
cargo test
cargo test --test aci
cargo test --test kata
# Ensure that all tests pass with extensions
cargo test --features rego-extensions
cargo test --test aci --features rego-extensions
cargo test --test kata --features rego-extensions
# Ensure that OPA conformance tests don't regress.
cargo test --features opa-testutil,serde_json/arbitrary_precision,rego-extensions --test opa -- $(tr '\n' ' ' < tests/opa.passing)
fi
cargo xtask pre-push