This directory contains bash scripts that mirror the GitHub Actions workflow defined in .github/workflows/test.yml.
These scripts allow you to run the same tests locally that run in CI, ensuring consistency between local development and
the CI environment.
-
Setup your environment (run once):
./scripts/setup.sh
-
Run all tests (equivalent to the full CI pipeline):
./scripts/run-all.sh
You can also run individual test suites:
setup.sh- Install dependencies and setup the development environmentrun-all.sh- Run the complete test suite (all scripts below in sequence)
build-and-test.sh- Build and test the native workspace, build WASM examples, and run craftbuild.sh- Build all examples (acceptsreleaseargument for release builds), then shrink the release WASM viawasm-opt.sh
clippy.sh- Run Clippy linting on both native and WASM workspacesfmt.sh- Check Rust code formattingrun-markdown.sh- Execute bash code blocks in Markdown filesrun-tests.sh- Run integration tests for examples and end-to-end tests (reuses a running rippled, else starts one in Docker; see below)docker-rippled.sh- Start/stop/check a local rippled node in Docker, pinned to the same image CI uses; also used by CI itself, so this is the only place the container'sdocker run/health-check/logs logic lives (start/stop/status/logs)host-function-audit.sh- Audit host functions against XRPLd (requires Node.js)cargo-deny.sh- Check RustSec advisories on the library workspace (requirescargo-deny)wasm-opt.sh- Shrink the built release contracts in place with Binaryen'swasm-opt(run automatically at the end ofbuild.sh; auto-installs a pinnedwasm-optvia cargo if none is found, and fails the build if it can't; exits quietly when there's no release WASM to optimize).--ensure-toolresolves/installs the tool without optimizing anything.benchmark-gas.sh- Measure and compare gas costs of optimized helper functionsgenerate-sfields.sh- Generate type-safe SField constants from rippled source (requires Node.js)
# Setup environment (run once)
./scripts/setup.sh
# Run quick checks before committing
./scripts/fmt.sh
# Run comprehensive tests
./scripts/run-all.sh
# Build in release mode
./scripts/build.sh release
# Run only clippy checks
./scripts/clippy.sh
# Run only integration tests (reuses a running rippled, else auto-starts one in Docker)
./scripts/run-tests.sh
# Run integration tests against a rippled you're already running yourself
NO_DOCKER=true ./scripts/run-tests.sh
# Run integration tests against WASM Devnet instead
DEVNET=true ./scripts/run-tests.sh
# Manage the local Docker rippled directly
./scripts/docker-rippled.sh start # no-op if rippled is already reachable on port 6006
./scripts/docker-rippled.sh status
./scripts/docker-rippled.sh logs
./scripts/docker-rippled.sh stop
# Run gas benchmarks (requires local rippled instance)
./scripts/benchmark-gas.sh
# Generate SField constants from rippled source
./scripts/generate-sfields.sh
# Check RustSec advisories (install cargo-deny first)
./scripts/cargo-deny.shAll scripts respect the RUSTFLAGS environment variable. By default, they set:
export RUSTFLAGS="-Dwarnings"This matches the CI environment and ensures warnings are treated as errors.
run-tests.sh additionally respects:
DEVNET=true- test against WASM Devnet instead of a local nodeNO_DOCKER=true- skip the automatic Docker rippled and test against a rippled you're already running yourself onws://localhost:6006
The benchmark-gas.sh script measures and compares gas costs of optimized helper functions:
# Run gas benchmarks (requires local rippled instance running on ws://127.0.0.1:6006)
./scripts/benchmark-gas.shThis script:
- Builds the gas_benchmark contract
- Deploys it to a local rippled instance
- Executes it multiple times to measure gas consumption
- Generates a comparison report
Requirements for gas benchmarking:
- Local rippled instance running on
ws://127.0.0.1:6006 - Node.js (for the benchmark runner scripts)
Output files:
gas_benchmark_results.json- Raw measurement dataGAS_BENCHMARK_REPORT.md- Formatted comparison report
The generate-sfields.sh script generates type-safe SField constants from the rippled source code:
# Generate from default rippled repository (se/supported branch)
./scripts/generate-sfields.sh
# Generate from a specific rippled repository or branch
./scripts/generate-sfields.sh https://github.com/XRPLF/rippled/tree/develop
# Generate to a custom output file
./scripts/generate-sfields.sh https://github.com/XRPLF/rippled/tree/ripple/se/supported custom_output.rsThis script:
- Fetches SField definitions from rippled source (local path or GitHub URL)
- Generates type-safe Rust constants with proper type mappings
- Applies custom type overrides for special fields (TransactionType, Condition, Fulfillment)
- Outputs to
xrpl-common-stdlib/src/sfield.rsby default
Custom type mappings:
The script automatically applies custom type mappings for fields that need specialized types:
TransactionType→TransactionTypeenum (notu16)Condition→ConditionBlob(notStandardBlob)Fulfillment→FulfillmentBlob(notStandardBlob)
To add more custom mappings, edit the customFieldTypes object in tools/generateSFields.js.
- Rust: Stable toolchain (installed automatically by
setup.sh) - Pre-commit: For running pre-commit hooks (installed by
setup.sh) - Node.js: Required for host function audit, gas benchmark, and integration test scripts
- Docker: Required for
run-tests.sh's default local rippled (skip withNO_DOCKER=trueorDEVNET=true)
These scripts are designed to work both locally and in GitHub Actions. The same scripts can be called from GitHub Actions workflows, ensuring perfect consistency between local and CI environments.
- Permission denied: Run
chmod +x scripts/*.shto make scripts executable - Pre-commit not found: Run
./scripts/setup.shto install dependencies - Node.js required: Install Node.js for the host function audit, or skip that script
- WASM target missing: The scripts automatically install the
wasm32v1-nonetarget - Build pauses on "installing wasm-opt via cargo": expected on a machine with no
wasm-opt; it compiles Binaryen from source once (a few minutes, needs a C++17 toolchain). Install a native Binaryen instead (brew install binaryen/apt-get install binaryen) to skip the compile, or setSKIP_WASM_OPT=trueto build without the optimization step - Docker not found / daemon not reachable: Install/start Docker, or set
NO_DOCKER=true(use your own local rippled) orDEVNET=true(use WASM Devnet)
setup.sh (run first)
├── build-and-test.sh
├── build.sh
└── wasm-opt.sh (required; auto-installs a pinned wasm-opt via cargo)
├── check-wasm-exports.sh
├── clippy.sh
├── run-tests.sh
└── ../build.sh (dependency)
├── fmt.sh
├── host-function-audit.sh (requires Node.js)
├── cargo-deny.sh (requires cargo-deny; library workspace only; not in run-all.sh while advisory-only)
└── run-markdown.sh
Note: Pre-commit checks are handled by the GitHub Actions workflow using pre-commit/action@v3.0.1 rather than a
local script.
The run-all.sh script runs all individual scripts in the correct order.