Skip to content

Commit 7e994ae

Browse files
committed
add examples
1 parent b81ec60 commit 7e994ae

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/examples.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Run Examples
2+
permissions:
3+
contents: read
4+
5+
on:
6+
push:
7+
branches:
8+
- "**"
9+
pull_request:
10+
workflow_dispatch:
11+
12+
jobs:
13+
run-examples:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Harden the runner (Audit all outbound calls)
17+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
18+
with:
19+
egress-policy: audit
20+
21+
- name: Checkout repository
22+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@1781c6eb42f98d67097986d30130a8ff6879fda2
28+
29+
- name: Install dependencies
30+
run: uv sync
31+
32+
- name: Generate Proto Files
33+
run: uv run python generate_proto.py
34+
35+
- name: Prepare Hiero Solo
36+
id: solo
37+
uses: hiero-ledger/hiero-solo-action@6a1a77601cf3e69661fb6880530a4edf656b40d5 #v0.14.0
38+
with:
39+
installMirrorNode: true
40+
- name: Run Examples
41+
env:
42+
OPERATOR_ID: ${{ steps.solo.outputs.accountId }}
43+
OPERATOR_KEY: ${{ steps.solo.outputs.privateKey }}
44+
CHAIN_ID: 012A
45+
NETWORK: solo
46+
shell: bash
47+
run: |
48+
set -euo pipefail
49+
files=$(ls examples/*.py)
50+
51+
for file in $files;
52+
do
53+
echo -e "\n************ ${file} ************"
54+
55+
module="examples.$(basename "$file" .py)"
56+
57+
# Run the example and capture both stdout and stderr
58+
if ! output=$(uv run -m "$module" 2>&1); then
59+
echo -e "\n❌ Example failed: ${file}"
60+
echo "************ Error Output ************"
61+
echo "$output"
62+
echo "**************************************"
63+
exit 1
64+
fi
65+
66+
echo "$output"
67+
echo "✅ Completed ${file} successfully."
68+
done

0 commit comments

Comments
 (0)