Skip to content

Commit 58c83d7

Browse files
authored
feat: Added workflow to run example script (#374)
Signed-off-by: Manish Dait <[email protected]>
1 parent a3cfa1a commit 58c83d7

File tree

73 files changed

+128
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+128
-81
lines changed

.github/workflows/examples.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Run Examples
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
run-examples:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@1781c6eb42f98d67097986d30130a8ff6879fda2
21+
22+
- name: Install dependencies
23+
run: uv sync
24+
25+
- name: Generate Proto Files
26+
run: uv run python generate_proto.py
27+
28+
- name: Prepare Hiero Solo
29+
id: solo
30+
uses: hiero-ledger/hiero-solo-action@6a1a77601cf3e69661fb6880530a4edf656b40d5 #v0.14.0
31+
with:
32+
installMirrorNode: true
33+
34+
- name: Run Examples
35+
env:
36+
OPERATOR_ID: ${{ steps.solo.outputs.accountId }}
37+
OPERATOR_KEY: ${{ steps.solo.outputs.privateKey }}
38+
CHAIN_ID: 012A
39+
NETWORK: solo
40+
run: |
41+
files=$(ls examples/*.py)
42+
for file in $files;
43+
do
44+
echo -e "\n************ ${file} ************"
45+
uv run -m examples.$(basename "$file" .py)
46+
done

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
2424
- docs: Add Google-style docstrings to `TokenRelationship` class and its methods in `token_relationship.py`.
2525
- feat: add initial testing guide structure
2626
- Added `checksum` filed for TopicId, FileId, ContractId, ScheduleId class
27+
- Added workflow for running example scripts.
2728

2829
### Changed
2930

examples/account_allowance_hbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
def setup_client():
2222
"""Initialize and set up the client with operator account"""
23-
network = Network(network="testnet")
23+
network = Network(os.getenv('NETWORK'))
2424
client = Client(network)
2525

2626
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID"))

examples/account_allowance_nft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
def setup_client():
3232
"""Initialize and set up the client with operator account"""
33-
network = Network(network="testnet")
33+
network = Network(os.getenv('NETWORK'))
3434
client = Client(network)
3535

3636
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID"))

examples/account_create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def setup_client() -> Tuple[Client, PrivateKey]:
5959
OPERATOR_ID (str): The account ID of the operator (format: "0.0.xxxxx")
6060
OPERATOR_KEY (str): The private key of the operator account
6161
"""
62-
network = Network(network='testnet')
62+
network = Network(os.getenv('NETWORK'))
6363
client = Client(network)
6464

6565
operator_id = AccountId.from_string(os.getenv('OPERATOR_ID'))

examples/account_delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
def setup_client():
2222
"""Initialize and set up the client with operator account"""
23-
network = Network(network="testnet")
23+
network = Network(os.getenv('NETWORK'))
2424
client = Client(network)
2525

2626
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID"))

examples/account_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
def setup_client():
2525
"""Initialize and set up the client with operator account"""
26-
network = Network(network="testnet")
26+
network = Network(os.getenv('NETWORK'))
2727
client = Client(network)
2828

2929
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID"))

examples/contract_create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
def setup_client():
3838
"""Initialize and set up the client with operator account"""
39-
network = Network(network="testnet")
39+
network = Network(os.getenv('NETWORK'))
4040
client = Client(network)
4141

4242
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID"))

examples/contract_create_constructor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
def setup_client():
4242
"""Initialize and set up the client with operator account"""
43-
network = Network(network="testnet")
43+
network = Network(os.getenv('NETWORK'))
4444
client = Client(network)
4545

4646
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID"))

examples/contract_create_with_bytecode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
def setup_client():
3737
"""Initialize and set up the client with operator account"""
38-
network = Network(network="testnet")
38+
network = Network(os.getenv('NETWORK'))
3939
client = Client(network)
4040

4141
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID"))

0 commit comments

Comments
 (0)