diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dcc39426..23be36fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: @@ -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