Skip to content

Commit 45efb35

Browse files
shibaeffPavel Shibaev
authored andcommitted
(feat) Add a Github workflow to test pip and conda installation
1 parent 9f7b8e3 commit 45efb35

File tree

1 file changed

+94
-1
lines changed

1 file changed

+94
-1
lines changed

.github/workflows/release.yml

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Python 🐍 distribution 📦 to PyPI
1+
name: Publish Python 🐍 distribution 📦 to PyPI; test package installation by running a basic example
22

33
on:
44
release:
@@ -21,3 +21,96 @@ jobs:
2121
run: |
2222
poetry config pypi-token.pypi $PYPI_TOKEN
2323
poetry publish --build
24+
25+
test-conda:
26+
runs-on: ubuntu-latest
27+
strategy:
28+
matrix:
29+
platform: [linux/amd64]
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v3
34+
35+
- name: Set up Miniconda
36+
uses: conda-incubator/setup-miniconda@v2
37+
with:
38+
auto-activate-base: false
39+
python-version: 3.11
40+
miniconda-version: "latest"
41+
architecture: x86_64
42+
activate-environment: test-env
43+
44+
- name: Create conda environment and install injective-py
45+
shell: bash -l {0}
46+
run: |
47+
conda create -n test-env -y
48+
conda activate test-env
49+
conda install -c conda-forge injective-py -y
50+
51+
- name: Write a Python script
52+
run: |
53+
echo "
54+
import asyncio
55+
56+
from pyinjective.async_client import AsyncClient
57+
from pyinjective.core.network import Network
58+
59+
60+
async def main() -> None:
61+
network = Network.testnet()
62+
client = AsyncClient(network)
63+
latest = await client.fetch_latest_block()
64+
print(latest)
65+
66+
asyncio.get_event_loop().run_until_complete(main())
67+
68+
" > script.py
69+
70+
- name: Run Python script
71+
shell: bash -l {0}
72+
run: |
73+
conda activate test-env
74+
python3 script.py
75+
76+
test-pip:
77+
runs-on: ubuntu-latest
78+
strategy:
79+
matrix:
80+
platform: [linux/amd64]
81+
82+
steps:
83+
- name: Checkout code
84+
uses: actions/checkout@v3
85+
86+
- name: Set up Python
87+
uses: actions/setup-python@v4
88+
with:
89+
python-version: 3.11
90+
91+
- name: Install injective-py with pip
92+
run: |
93+
pip3 install injective-py
94+
95+
- name: Write a Python script
96+
run: |
97+
echo "
98+
import asyncio
99+
100+
from pyinjective.async_client import AsyncClient
101+
from pyinjective.core.network import Network
102+
103+
104+
async def main() -> None:
105+
network = Network.testnet()
106+
client = AsyncClient(network)
107+
latest = await client.fetch_latest_block()
108+
print(latest)
109+
110+
asyncio.get_event_loop().run_until_complete(main())
111+
112+
" > script.py
113+
114+
- name: Run Python script
115+
run: |
116+
python3 script.py

0 commit comments

Comments
 (0)