# Local Interchain Rust Example

##

{% embed url="<https://www.youtube.com/watch?v=yRpYYp5ZSCQ>" %}

## **Step-by-Step Guide to Running Rust Cosm Wasm Contracts in GitHub Workflow**

#### **Prerequisites:**

1. Make sure you have Rust and CosmWasm contract development environment set up on your local machine.
2. Create a GitHub repository where you want to host your Rust CosmWasm contract project.

### **Step 1: Set Up Your Project**

* Clone or create a new GitHub repository for your Rust CosmWasm contract project.

### **Step 2: Organize Your Project**

* Inside your project, create a `source` folder. This folder will contain your standard CosmWasm contract with messages (e.g., increment and reset).

### **Step 3: Create an Interchange Test Folder**

* Within your project, create an `interchain-test` folder. This folder will be used to set up tests for your contract.

### **Step 4: Define Chain Configuration**

* Determine the configuration you want for your blockchain. Define the necessary configuration settings, such as the chain parameters, and consider any startup commands required.

### **Step 5: Use Environment Variables**

* Abstract away some of the configuration requirements into environment variables. This allows you to specify different configurations for different chains without much hassle.

### **Step 6: Configure Relayer and Server (Optional)**

* If needed, configure the relayer and server settings for your project. This step may not be necessary for all users.

### **Step 7: Write Your Tests**

* 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.

### **Step 8: Set Up GitHub Workflow**

* In your GitHub repository, create an `.github/workflows` directory if it doesn't already exist.
* Inside the `.github/workflows` directory, create an `end-to-end.yml` file. This workflow file will trigger when a pull request or push happens to specific branches.

### **Step 9: Define GitHub Workflow Actions**

* 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.

### **Step 10: Workflow Completion**

* 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.

#### **Conclusion:**

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.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.junonetwork.io/developer-guides/local-interchain/local-interchain-rust-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
