From 45efb35ffc9669be169bed2e956d3f17c6c38319 Mon Sep 17 00:00:00 2001 From: Pavel Shibaev Date: Sat, 28 Sep 2024 10:35:42 +0200 Subject: [PATCH 1/3] (feat) Add a Github workflow to test pip and conda installation --- .github/workflows/release.yml | 95 ++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dcc39426..1e9664f1 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 From d5160e354e9d2639a5509efa54945d7cc368d0e9 Mon Sep 17 00:00:00 2001 From: Pavel Shibaev Date: Wed, 2 Oct 2024 22:11:01 +0200 Subject: [PATCH 2/3] (feat) Add workflow to test local pip installation --- .github/workflows/test-pip.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/test-pip.yml diff --git a/.github/workflows/test-pip.yml b/.github/workflows/test-pip.yml new file mode 100644 index 00000000..7fd9d45e --- /dev/null +++ b/.github/workflows/test-pip.yml @@ -0,0 +1,33 @@ +name: Test package installation by running a basic example + +on: + pull_request: + +jobs: + 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: Clone sdk-python repository + run: | + git clone https://github.com/InjectiveLabs/sdk-python + cd sdk-python + + - name: Install injective-py from local copy + run: | + pip install . + + - name: Run Python script + run: | + python3 examples/chain_client/tendermint/query/3_GetLatestBlock.py From 2f93221062b780d50a8ec16e82ee20c339df0909 Mon Sep 17 00:00:00 2001 From: Pavel Shibaev Date: Wed, 2 Oct 2024 22:12:36 +0200 Subject: [PATCH 3/3] Revert "(feat) Add a Github workflow to test pip and conda installation" This reverts commit 45efb35ffc9669be169bed2e956d3f17c6c38319. --- .github/workflows/release.yml | 95 +---------------------------------- 1 file changed, 1 insertion(+), 94 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e9664f1..dcc39426 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Publish Python 🐍 distribution 📦 to PyPI; test package installation by running a basic example +name: Publish Python 🐍 distribution 📦 to PyPI on: release: @@ -21,96 +21,3 @@ 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