Skip to content

Commit

Permalink
Testing env docs (#453)
Browse files Browse the repository at this point in the history
Added docs about our development and testing cycle.
  • Loading branch information
michalinacienciala authored Oct 20, 2023
2 parents 4a5b0c4 + 946fc62 commit 88266ef
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 43 deletions.
46 changes: 3 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,7 @@
```
3. Open [http://localhost:9000](http://localhost:9000) to view it in the browser.

## Working with locally forked Arbitrum Sepolia chain
## Docs

### In the dapp:

- Override `USE_LOCALHOST_FORK="true"` in `.env` file.
- Run the dapp

### In the [extension](https://github.com/tahowallet/extension):

- Install extension due to readme
- Change `.env` variables
```bash
# Forking Arbitrum Sepolia
USE_MAINNET_FORK=true
MAINNET_FORK_CHAIN_ID="421614"
CHAIN_API_URL="https://sepolia-rollup.arbitrum.io/rpc"
```
- Restart extension's process
- Install extension as usual in the browser
- In the wallet let's import the account from the private key of the `testertesting.eth`
- Based on the Taho token's contract address (see `deployment-info.json` in the dapp or contracts repository) add the Taho asset to the wallet
### In the [contracts](https://github.com/tahowallet/contracts):
Instruction based on [the system tests readme](https://github.com/tahowallet/contracts/blob/main/system-tests/README.md)
- Install contracts
- `nvm use`
- `yarn install`
- Provide [`.envrc`](https://github.com/tahowallet/contracts/blob/main/system-tests/.envrc.SAMPLE) variables, make sure you have [Direnv](https://direnv.net/) installed
```bash
export FORKING_URL="https://sepolia-rollup.arbitrum.io/rpc"
export TAHO_DEPLOYER_PRIVATE_KEY="..." # mnemonic or first private key from `testertesting.eth`
export FORKING_BLOCK="..." # historical block; optional - setting this var enables cache and speeds up repatable read operations
```
- Open first terminal and run `yarn run test:fork`
---
After all the steps above you should have:
- the Taho token deployed on the Arbitrum Sepolia forked chain
- the dapp should be able to interact with the token
- the extension should be able to display the token's balance
- [Local environment setup](docs/local-env-setup.md)
- [Testing environment](docs/testing-env.md)
44 changes: 44 additions & 0 deletions docs/local-env-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Working with locally forked Arbitrum Sepolia chain

### In the dapp:

- Override `USE_LOCALHOST_FORK="true"` in `.env` file.
- Run the dapp

### In the [extension](https://github.com/tahowallet/extension):

- Install extension due to readme
- Change `.env` variables
```bash
# Forking Arbitrum Sepolia
USE_MAINNET_FORK=true
MAINNET_FORK_CHAIN_ID="421614"
CHAIN_API_URL="https://sepolia-rollup.arbitrum.io/rpc"
```
- Restart extension's process
- Install extension as usual in the browser
- In the wallet let's import the account from the private key of the `testertesting.eth`
- Based on the Taho token's contract address (see `deployment-info.json` in the dapp or contracts repository) add the Taho asset to the wallet

### In the [contracts](https://github.com/tahowallet/contracts):

Instruction based on [the system tests readme](https://github.com/tahowallet/contracts/blob/main/system-tests/README.md)

- Install contracts
- `nvm use`
- `yarn install`
- Provide [`.envrc`](https://github.com/tahowallet/contracts/blob/main/system-tests/.envrc.SAMPLE) variables, make sure you have [Direnv](https://direnv.net/) installed
```bash
export FORKING_URL="https://sepolia-rollup.arbitrum.io/rpc"
export TAHO_DEPLOYER_PRIVATE_KEY="..." # mnemonic or first private key from `testertesting.eth`
export FORKING_BLOCK="..." # historical block; optional - setting this var enables cache and speeds up repatable read operations
```
- Open first terminal and run `yarn run test:fork`

---

After all the steps above you should have:

- the Taho token deployed on the Arbitrum Sepolia forked chain
- the dapp should be able to interact with the token
- the extension should be able to display the token's balance
82 changes: 82 additions & 0 deletions docs/testing-env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Development to Production Flow

### Branches

- `main`
- branch `main` is the base branch for current developement
- every feature branch should be merged into `main` via pull request
- `stage-live`
- base for running the staging environment that is running on the live chain
- stage-live website is building based on the current status of the branch `stage-live`
- changes from `main` should be merged into the `stage-live` in batches using PR
- person QAing stage environment should be the one to accept and merge the PR - merging the PR means the staging environment will rebuild and manual tests can be started
- `stage-fork`
- state of the branch `stage-fork` should be always the same as `stage-live`
- base for building the staging environment that is running on the chain fork
- stage-fork website is building based on the current status of the branch `stage-fork`
- changes on `stage-live` should be auto-merged to the `stage-fork` by the Github Action
- accepting the PR to `stage-live` means stage-fork website will rebuild as well as stage-live website
- `release`
- changes from `stage-live` branch should be opening the PR to `release` branch
- batch of changes from the PR should be tested manually on staging environments and then PR to release should be accepted and merged by QA
- production environment is building based on the current status of the branch `release`

### Environments

- [app](https://app.taho.xyz/) or [release](https://release--taho-development.netlify.app/) - production env based on branch `release`
- [stage fork](https://stage-fork--taho-development.netlify.app/) - staging env based on branch `stage-fork`
- running on Tenderly fork of Arbitrum
- can reset the fork by clicking a few times in the logo
- to be used together with special build of the Taho wallet
- [stage live](https://stage-live--taho-development.netlify.app/) - staging env based on branch `stage-live`
- running on live chain
- to be used with production version of the Taho wallet
- [main](https://main--taho-development.netlify.app/) - development build based on `main`
- no need to do QA here
- running on chain fork
- can be used to preview most recent development

### Hotfix flow

If production needs a quick fix then:

- create a feature branch from `main`
- fix it as usual, merge back to `main`
- cherry-pick the fix to separate branch
- create a separate PR to `stage-live`
- merge it so fix will be added to the current batch of chages from staging env
- QA on staging
- merge PR `stage-live -> release`


```mermaid
---
title: "Dapp Lifecycle"
---
flowchart
609277{"main\nbranch"} -->|"Auto PR"| 140433{"stage-live \nbranch\n"}
style 609277 fill:#8fe465
style 140433 fill:#64e3db
609277 -->|"Hotfix PR"| 140433
linkStyle 1 stroke:#dc2a2a
609277 <-->|"PR"| 788810{"feature\nbranch"}
linkStyle 2 stroke:#f103d0
style 788810 fill:#64e3db
788810 -->|"Auto deploy"| 588961(("PR-preview"))
style 588961 fill:#e3c464
140433 -->|"Auto deploy"| 836305(("stage-fork\n"))
style 836305 fill:#e3c464
809682{"stage-fork\nbranch"} -->|"Auto deploy"| 490721(("stage-live\n"))
style 809682 fill:#64e3db
style 490721 fill:#e36464
804724{"release\nbranch"} -->|"Auto deploy"| 389165(("app.taho.xyz"))
style 804724 fill:#8fe465
style 389165 fill:#e36464
140433 -->|"Auto PR\n"| 804724
140433 -->|"Auto merge"| 809682
%% Mermaid Flow Diagram Link
%% Keep this link to make future edits to your diagram
%% https://www.mermaidflow.app/flowchart#N4IgZgNg9g7iBcoB2UAmBTAzgg2qGAlqgC4AWCAjAAwBsANCKegQOanGUAsAnA0QiBpVuAJgDsYkAwAOUTAWIEoSBKAAeCUQDoKADk4ia3Gof3cAzLxABPBGICsVLUZG7dl+-ZH2KAXwaoAIbEgaogEIEARugQAgC2gQRIADpIkQBOgUgAxuQMmMTWEFi44AQQEPAAxLpg6Jw09iAAugyZSADWmAAimTAqiP4g0oHp6EjEAEpZHQhUAX0AyoXFCGCBEJjoQ4XS6ALppFBxkQCumAByaPv5MejZxOioaxtbC4EsLEksL5voMnIFEokABBSKYKAQU6PMIaeDaPQGIwmGhmSwMWzwBxOFxuDxeHy+fz4IhkSi0BhMVjsLhWfjwEC6KicMQiThSYaAxTKWEITi6Cg6cQ0MRuewOcz2fQYhDmahaLwNHz2bhS8UUGhDIIhMIRaKxBljYqBLapDJZXIcgpFErwHBlCrVWr1RotNozHp9AbAIYjMYTaadObvGDLG2-LY7ax7A5HE7nK4YDmyeTc0HgyHQ-aIEBw-mCijC0W6cX2SXSmyy+WKxoUFVqsQaoZbYoPJ4R-4gVCZT7fDvEkCEEjkeAUaiU5hsDijnx8Z4MiicZnmczJrnA3nwfk0LSSzxUTxicwHkQyrHmXRaAUa1zcXTGAzcLXBUI5vUxAQFD7oAC0EAIABu6AAARmu0uSpFaKy2vaYDlJUVQ0Jw6DmKgkRuiA7RdL0gT9KovqjOMUwzMGXZLNB-YMLs2aYXGZyXNcVp3G287rH87y9kgPzwGxbycqmwJghCUIwjmea6Due6OIex5eGeR6XteJj3veSEiE+A5DmSo5ULoE7UtOdbzCA9KMsIqIiGuAk8mJCA0IuWhiJwDQGK4PCuKelbwJ45hXl4wjMmyJZOc+OpvlEH4Ml+LC-mAUDpB0YEWnkIDWsU2B2g6CFIShaEYVhnq4d6BH+sRQbwMZ3a4WGqw8a82xUdGNGHMc9GJjcqXMY8rH1RxXxcR2ALWemwlZ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bYp7thnTPZFjgkqfVEnPVepZ4y6271uss5eF6Jl7L8AUS+k1Lir8mqv-ZAIDlNkEtPg5IerpxbXDfGaJaZ0lyOCmo85FZ03WOmU490YffHU3neGsd55iE3m-du-8x7ubFk6eu5AHtudB2fyWDrHKIwtAw-sdtRd7nUft2x4e7lxPovxPCGezEErafvuVZ3vLxFcRkkxWVy2bT-ZwaaO0bICvOdmNOEcOYVkbIhAakbG-TETIhSNh1g8CWD8zzQMBqxQDxIVSORsjcBHih5arcAGDFxbRdgEAfCZBxAACyGygQ3QUekKYw9aAgAAKgAEIchgBtITBYHBC1phCKDEAzLdDoEsCYHAQkEKCrBaguzrwdzazgzZDHDn4TACEMBuwmhbACFDDS5qCP7EBKJZAxAADyZm8AP6DALA0AkQGwEKMUJB2aoAqApwGwVWSQ6ABhZCwk-ADABytBBalhNEA24hkI8UAgguj2yuWhUAOhEA7UjhDBUOziVCSYLh0A6Q7hVAUR0RHIOh2QHQbBvSRSAAwq4REQyIYoPAwJEPFBgOkKkeEZEdEVEbEbkckiQaQAQPEWKpgBlF2v+M8GCvgZgEwClkSEAA
```

0 comments on commit 88266ef

Please sign in to comment.