Refactor scripts to load versions dynamically for CI testing #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Solves #6
This pull request introduces a new, version-aware scripting system for tutorial setup and node preparation, with a focus on maintainability and consistency across environments. The main change is the introduction of a centralized version loader (
load-versions.sh) that allows all relevant scripts to dynamically pick up tool versions from either a tutorial-local or rootversions.ymlfile. Scripts for installing dependencies, setting up Rust, building the node, and running tests have been refactored to use this system. This ensures that tutorials can specify and override their required tool versions in a single place, reducing duplication and risk of version drift.Key changes:
Version Management Infrastructure:
scripts/load-versions.sh, a robust Bash utility to load tool versions from either a tutorial'sversions.ymlor the root config, and export them as environment variables for use in all setup scripts.tutorials/zero-to-hero/versions.ymlto specify tutorial-specific versions for Rust,polkadot-omni-node, andchain_spec_builder.Script Refactoring for Version Awareness:
setup-rust.sh,install-chain-spec-builder.sh,install-omni-node.sh, andgenerate-chain-spec.sh) intutorials/zero-to-hero/scripts/to sourceload-versions.shand use the dynamically loaded version variables, removing hardcoded versions. [1] [2] [3] [4]generate-chain-spec.shto work from the correct directory, use environment/configurable parameters, and provide better output and validation. [1] [2]New Orchestration Scripts:
scripts/setup-tutorial-env.shto automate installing all dependencies for a tutorial using itsversions.yml.scripts/prepare-node-for-tutorial.shto build the node and generate the chain spec for a tutorial, also using versioned dependencies.Test Automation Improvements:
zero-to-hero-e2e.test.ts) to automatically ensure the correct version ofpolkadot-omni-nodeis installed and the chain spec is generated by invoking the new orchestration scripts, making tests more robust and less dependent on manual setup. [1] [2]