refactor: move repo/pysdk/pysdk -> repo/pysdk #636
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
name: "E2E 🐍 tests" | |
on: | |
pull_request: | |
branches: ["main", "release/*"] | |
paths: | |
[ | |
"pysdk/**.py", | |
"pysdk/pyproject.toml", | |
"pysdk/poetry.lock", | |
".github/workflows/pytests.yml", | |
] | |
push: | |
branches: ["main", "release/*"] | |
paths: | |
[ | |
"pysdk/**.py", | |
"pysdk/pyproject.toml", | |
"pysdk/poetry.lock", | |
".github/workflows/pytests.yml", | |
] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} | |
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }} | |
jobs: | |
tests: | |
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: 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 # sanity check on the installation. | |
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-3 # 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 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 so that the network has time to start." | |
run: sleep 5 | |
#---------------------------------------------- | |
# 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 |