description |
---|
Learn how to seamlessly integrate Rust CosmWasm contracts into your GitHub workflow. Follow our step-by-step guide to set up your project, configure chain parameters, write tests, and automate. |
{% embed url="https://www.youtube.com/watch?v=yRpYYp5ZSCQ" %}
- Make sure you have Rust and CosmWasm contract development environment set up on your local machine.
- Create a GitHub repository where you want to host your Rust CosmWasm contract project.
- Clone or create a new GitHub repository for your Rust CosmWasm contract project.
- Inside your project, create a
source
folder. This folder will contain your standard CosmWasm contract with messages (e.g., increment and reset).
- Within your project, create an
interchain-test
folder. This folder will be used to set up tests for your contract.
- Determine the configuration you want for your blockchain. Define the necessary configuration settings, such as the chain parameters, and consider any startup commands required.
- Abstract away some of the configuration requirements into environment variables. This allows you to specify different configurations for different chains without much hassle.
- If needed, configure the relayer and server settings for your project. This step may not be necessary for all users.
- Within the
interchain-test
folder, write the tests you want to perform on your CosmWasm contract. This could include instantiation, querying, and incrementing the contract's state.
- In your GitHub repository, create an
.github/workflows
directory if it doesn't already exist. - Inside the
.github/workflows
directory, create anend-to-end.yml
file. This workflow file will trigger when a pull request or push happens to specific branches.
- In the
end-to-end.yml
workflow file, define the following actions:- Download the interchain test.
- Set up and automatically install the interchain binary.
- Run your contract tests. You can run any tests you want, including uploading the wasm file and starting your contract on a specific port.
- Ensure that the tests pass without errors.
- If all the tests have passed without any issues, the GitHub workflow will automatically kill the contract instance, exit out, and mark the entire workflow as completed.
Following this step-by-step guide, you can set up and run Rust CosmWasm contracts in a GitHub workflow using the local interchain tool. This ensures that your contract works in both local and GitHub environments, providing convenience and reliability for your project development and testing.
\