Skip to content

Commit 421c257

Browse files
Merge pull request #150 from JohnsonChin1009/feat/setup-github-actions
feat: created workflow files and updated .gitignore
2 parents 9501049 + 3fd266f commit 421c257

File tree

4 files changed

+98
-1
lines changed

4 files changed

+98
-1
lines changed

.github/workflows/ci-test.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: "ci"
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: run sdk tests
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
python-version: ["3.10", "3.11", "3.12"]
17+
18+
steps:
19+
- name: checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: setup python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: install poetry
28+
uses: snok/install-poetry@v1
29+
with:
30+
version: latest
31+
virtualenvs-create: true
32+
virtualenvs-in-project: true
33+
34+
- name: load cached venv
35+
id: cached-poetry-dependencies
36+
uses: actions/cache@v4
37+
with:
38+
path: .venv
39+
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
40+
41+
- name: install dependencies
42+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
43+
run: poetry install --no-interaction --no-root
44+
45+
- name: install project
46+
run: poetry install --no-interaction
47+
48+
- name: create test .env file (on push)
49+
if: github.event_name == 'push'
50+
run: |
51+
cat > tests/.env << EOF
52+
WHITELISTED_WALLET_PRIVATE_KEY=${{ secrets.WHITELISTED_WALLET_PRIVATE_KEY }}
53+
SELLER_ENTITY_ID=${{ secrets.SELLER_ENTITY_ID }}
54+
SELLER_AGENT_WALLET_ADDRESS=${{ secrets.SELLER_AGENT_WALLET_ADDRESS }}
55+
BUYER_ENTITY_ID=${{ secrets.BUYER_ENTITY_ID }}
56+
BUYER_AGENT_WALLET_ADDRESS=${{ secrets.BUYER_AGENT_WALLET_ADDRESS }}
57+
EOF
58+
59+
- name: run unit tests (on pr)
60+
if: github.event_name == 'pull_request'
61+
run: poetry run pytest tests/unit -v --junitxml=junit.xml
62+
63+
- name: run all tests (on push)
64+
if: github.event_name == 'push'
65+
run: poetry run pytest -v --junitxml=junit.xml
66+
67+
- name: upload test results
68+
uses: actions/upload-artifact@v4
69+
if: ${{ !cancelled() }}
70+
with:
71+
name: test-results-${{ matrix.python-version }}
72+
path: junit.xml

.github/workflows/test-report.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "test report"
2+
on:
3+
workflow_run:
4+
workflows: ["ci"]
5+
types:
6+
- completed
7+
8+
permissions:
9+
contents: read
10+
actions: read
11+
checks: write
12+
13+
jobs:
14+
report:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: ["3.10", "3.11", "3.12"]
19+
steps:
20+
- uses: dorny/test-reporter@v2
21+
with:
22+
artifact: test-results-${{ matrix.python-version }}
23+
name: Pytest Tests (Python ${{ matrix.python-version }})
24+
path: "*.xml"
25+
reporter: java-junit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Build artifacts
22
dist/
3+
junit.xml
34

45
# Virtual environments
56
venv/

tests/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# General Variables
2-
WHITELISTED_WALLET_ADDRESS=<YOUR_WHITELISTED_WALLET_ADDRESS>
32
WHITELISTED_WALLET_PRIVATE_KEY=<YOUR_WHITELISTED_PRIVATE_KEY>
43

54
# Seller Agent Variables

0 commit comments

Comments
 (0)