Skip to content

epic: migration for v0.21 with passing tests #wip #582

epic: migration for v0.21 with passing tests #wip

epic: migration for v0.21 with passing tests #wip #582

Workflow file for this run

name: E2E 🐍 tests
on:
pull_request:
branches: ["master"]
paths:
[
"**.py",
"pyproject.toml",
"poetry.lock",
".github/workflows/pytests.yml",
]
push:
branches: ["master"]
paths:
[
"**.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:
tests:
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:
# ----------------------------------------------
# check-out repo and set-up python
# ----------------------------------------------
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Python (3.8)
id: setup-python
uses: actions/setup-python@v2
with:
python-version: 3.8.16
# 3.8.16 is the highest version available for this GitHub action.
# For the full list of supported Python versions, see:
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
# 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
run: python --version && python -c "print('hello')"
# ----------------------------------------------
# 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
# ----------------------------------------------
# Install ping for early tests
# ----------------------------------------------
- name: Install ping
run: sudo apt-get install -y iputils-ping
# ----------------------------------------------
# Install & configure poetry
# ----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: latest
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- 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') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Run chaosnet
uses: NibiruChain/localnet-action@v1.1
id: chaosnet
with:
services: nibiru pricefeeder
ghtoken: ${{ secrets.GITHUB_TOKEN }}
ghactor: ${{ github.actor }}
- name: sleep 30 seconds
run: sleep 30
#----------------------------------------------
# run tests
#----------------------------------------------
- name: Install unbuffer command for run step
run: sudo apt-get install -y expect-dev
- name: Run Python SDK tests
run: unbuffer poetry run pytest -s tests --cov=nibiru --log-cli-level=DEBUG 2>&1 | tee coverage.txt; exit "${PIPESTATUS[0]}"
# piping to tee lets us see stdout and write to a file simultaneously.
# unbuffer retains the colored text from pytest through the pipe to tee
# -s makes the output verbose to make logs more descriptive.
# --cov toggles on the coverage report at the specified path
#----------------------------------------------
# Upload test output and coverage report as a GitHub artifact
#----------------------------------------------
- uses: actions/upload-artifact@v3
with:
name: test-coverage
path: coverage.txt