Skip to content

Conversation

@nhussein11
Copy link
Contributor

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 root versions.yml file. 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:

  • Added scripts/load-versions.sh, a robust Bash utility to load tool versions from either a tutorial's versions.yml or the root config, and export them as environment variables for use in all setup scripts.
  • Added tutorials/zero-to-hero/versions.yml to specify tutorial-specific versions for Rust, polkadot-omni-node, and chain_spec_builder.

Script Refactoring for Version Awareness:

  • Refactored setup scripts (setup-rust.sh, install-chain-spec-builder.sh, install-omni-node.sh, and generate-chain-spec.sh) in tutorials/zero-to-hero/scripts/ to source load-versions.sh and use the dynamically loaded version variables, removing hardcoded versions. [1] [2] [3] [4]
  • Improved generate-chain-spec.sh to work from the correct directory, use environment/configurable parameters, and provide better output and validation. [1] [2]

New Orchestration Scripts:

  • Added scripts/setup-tutorial-env.sh to automate installing all dependencies for a tutorial using its versions.yml.
  • Added scripts/prepare-node-for-tutorial.sh to build the node and generate the chain spec for a tutorial, also using versioned dependencies.

Test Automation Improvements:

  • Updated E2E test (zero-to-hero-e2e.test.ts) to automatically ensure the correct version of polkadot-omni-node is 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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant