Skip to content

Commit

Permalink
(feat) Add a Github workflow to test pip and conda installation
Browse files Browse the repository at this point in the history
  • Loading branch information
shibaeff authored and Pavel Shibaev committed Sep 29, 2024
1 parent 9f7b8e3 commit 0dfbd9f
Showing 1 changed file with 94 additions and 1 deletion.
95 changes: 94 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Python 🐍 distribution 📦 to PyPI
name: Publish Python 🐍 distribution 📦 to PyPI; test package installation by running a basic example

on:
release:
Expand All @@ -21,3 +21,96 @@ jobs:
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
test-conda:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: false
python-version: 3.11
miniconda-version: "latest"
architecture: x86_64
activate-environment: test-env

- name: Create conda environment and install injective-py
shell: bash -l {0}
run: |
conda create -n test-env -y
conda activate test-env
conda install -c conda-forge injective-py -y
- name: Write a Python script
run: |
echo "
import asyncio
from pyinjective.async_client import AsyncClient
from pyinjective.core.network import Network


async def main() -> None:
network = Network.testnet()
client = AsyncClient(network)
latest = await client.fetch_latest_block()
print(latest)

asyncio.get_event_loop().run_until_complete(main())

" > script.py
- name: Run Python script
shell: bash -l {0}
run: |
conda activate test-env
python3 script.py
test-pip:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install injective-py with pip
run: |
pip3 install injective-py
- name: Write a Python script
run: |
echo "
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.core.network import Network


async def main() -> None:
network = Network.testnet()
client = AsyncClient(network)
latest = await client.fetch_latest_block()
print(latest)

asyncio.get_event_loop().run_until_complete(main())

" > script.py
- name: Run Python script
run: |
python3 script.py

0 comments on commit 0dfbd9f

Please sign in to comment.