-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
epic: migration for v0.21 with passing tests #wip (#238)
* Fixing imports for v0.21, need gogoproto for release Please enter the commit message for your changes. Lines starting * Broken epochs from nibiru_proto * #wip: no import errors on test runs * saved #wip * fixed tx service halts #wip * Pass spot tests if pool dne * Fix stablecoin test w with '#' will be ignored, and an empty message aborts the commit. * all passing tests on v0.21 * Ran pre-commit auto update * Add tx query to include missing fields from grpc resp * save #wip: fixing InactiveRpcError * fix!: improvements to broadcast fn * fix,docs(tx.py)!: 1. Make sequence errors near-impossible. 2. Use more type hints. 3. Improve wallet.Address initialization robustness. * fix,ci(scripts): (1) Add --no-build flag for localnet.sh, (2) CI test the script, and (3) fix version on e2e action * ci(scripts.yml): trigger run * ci: fix typo * ci: lower the sleep time since the network starts pretty quickly * ci(scripts.yml): run localnet.sh in the background * appease linter * ci(lint.yml): make linter more specific * run black and flake8 * fix: both isort and black should be poetry 'dev' dependencies * ci(lint.yml): wrong job name * ci(lint.yml): clean up workflow even more + concurrency restart * ci(lint.yml): invalid run/uses syntax for job:lint-py --------- Co-authored-by: Unique-Divine <[email protected]>
- Loading branch information
1 parent
13e6238
commit 498263e
Showing
45 changed files
with
1,474 additions
and
830 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,69 @@ | ||
name: Linting | ||
name: "Linting" | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
branches: ["master"] | ||
push: | ||
branches: ["master"] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} | ||
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }} | ||
|
||
jobs: | ||
test: | ||
lint-py: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
timeout-minutes: 2 | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
- name: "Setup Python" | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9.13" | ||
|
||
#---------------------------------------------- | ||
# load pip cache if cache exists | ||
#---------------------------------------------- | ||
- uses: actions/cache@v2 | ||
- name: "Load pip cache if cache exists" | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip | ||
restore-keys: ${{ runner.os }}-pip | ||
#---------------------------------------------- | ||
# install and run linters | ||
#---------------------------------------------- | ||
- run: python -m pip install black flake8 isort | ||
- run: | | ||
flake8 . | ||
black . --check | ||
isort . | ||
- name: "Install and run flake8" | ||
run: | | ||
python -m pip install flake8 | ||
flake8 nibiru | ||
flake8 tests | ||
flake8 examples | ||
# ---------------------------------------------- | ||
# Try to load a cached poetry binary | ||
# See https://github.com/snok/install-poetry#caching-the-poetry-installation for the source | ||
# ---------------------------------------------- | ||
- name: "Load cached Poetry installation" | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.local | ||
key: poetry-0 # increment to reset cache | ||
|
||
- name: "Install poetry" | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
version: latest | ||
- name: "Load cached venv" | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: "Install dependencies with poetry (using cache)" | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
- name: Run checks for black and isort | ||
run: | | ||
poetry run black . --check | ||
poetry run isort . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: E2E 🐍 tests | ||
name: "E2E 🐍 tests" | ||
|
||
on: | ||
pull_request: | ||
|
@@ -29,12 +29,6 @@ jobs: | |
runs-on: ubuntu-latest | ||
env: | ||
# https://www.notion.so/nibiru/Resources-and-Repo-Configs-b31aa8074a2b419d80b0c946ed5efab0 | ||
LCD_ENDPOINT: "http://localhost:1317" | ||
GRPC_ENDPOINT: "localhost:9090" | ||
TENDERMINT_RPC_ENDPOINT: "http://localhost:26657" | ||
USE_LOCALNET: true | ||
WEBSOCKET_ENDPOINT: "ws://localhost:26657/websocket" | ||
CHAIN_ID: "nibiru-localnet-0" | ||
VALIDATOR_MNEMONIC: "guard cream sadness conduct invite crumble clock pudding hole grit liar hotel maid produce squeeze return argue turtle know drive eight casino maze host" | ||
DEVNET_NUMBER: ${{ secrets.DEVNET_NUMBER }} | ||
steps: | ||
|
@@ -54,7 +48,7 @@ jobs: | |
# 3.8.16 is the highest 3.8 version available on pyenv | ||
# See `grep '3.8' <<< $(pyenv install -l)` to view the available list. | ||
|
||
- name: Run python | ||
- name: Run python # sanity check on the installation. | ||
run: python --version && python -c "print('hello')" | ||
|
||
# ---------------------------------------------- | ||
|
@@ -99,16 +93,21 @@ jobs: | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
- name: Run chaosnet | ||
uses: NibiruChain/[email protected] | ||
id: chaosnet | ||
with: | ||
services: nibiru pricefeeder | ||
ghtoken: ${{ secrets.GITHUB_TOKEN }} | ||
ghactor: ${{ github.actor }} | ||
- name: Run localnet.sh in the background. | ||
run: | | ||
curl -s https://get.nibiru.fi/@v0.21.5! | bash | ||
bash scripts/localnet.sh --no-build & | ||
# - name: Run chaosnet | ||
# uses: NibiruChain/[email protected] | ||
# id: chaosnet | ||
# with: | ||
# services: nibiru pricefeeder | ||
# ghtoken: ${{ secrets.GITHUB_TOKEN }} | ||
# ghactor: ${{ github.actor }} | ||
|
||
- name: sleep 30 seconds | ||
run: sleep 30 | ||
- name: "Sleep so that the network has time to start." | ||
run: sleep 5 | ||
#---------------------------------------------- | ||
# run tests | ||
#---------------------------------------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: "py-sdk/scripts" | ||
|
||
on: | ||
pull_request: | ||
branches: ["master"] | ||
paths: | ||
[ | ||
"scripts", | ||
"**.py", | ||
"pyproject.toml", | ||
"poetry.lock", | ||
".github/workflows/pytests.yml", | ||
] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} | ||
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }} | ||
|
||
jobs: | ||
localnet: | ||
# The localnet job verifies that the repo's script for starting a local Nibiru | ||
# chain runs without errors. | ||
runs-on: ubuntu-latest | ||
env: | ||
# https://www.notion.so/nibiru/Resources-and-Repo-Configs-b31aa8074a2b419d80b0c946ed5efab0 | ||
VALIDATOR_MNEMONIC: "guard cream sadness conduct invite crumble clock pudding hole grit liar hotel maid produce squeeze return argue turtle know drive eight casino maze host" | ||
DEVNET_NUMBER: ${{ secrets.DEVNET_NUMBER }} | ||
steps: | ||
# ---------------------------------------------- | ||
# check-out repo and set-up python | ||
# ---------------------------------------------- | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run localnet.sh in the background. | ||
run: | | ||
curl -s https://get.nibiru.fi/@v0.21.5! | bash | ||
bash scripts/localnet.sh --no-build & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.DS_Store | ||
coverage.txt | ||
examples/trading_bot.py | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.