Repository navigation
77 lines (74 loc) · 2.58 KB
/
Copy pathpython.yml
File metadata and controls
77 lines (74 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Python
on:
push:
branches: [main]
pull_request:
workflow_call:
jobs:
# Path filter: a PR that touches none of these skips the jobs below
# (skipped jobs satisfy required checks); pushes and calls run them all.
changes:
name: changes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.code == 'true' }}
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- 'python/**'
- 'html/**'
- '.github/**'
test-python:
name: test
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install Python SDK
working-directory: python
# Framework extras bring fastapi/flask/django so the solana_pay_kit shim tests
# import and pyright can resolve them; dev brings ruff, pyright, pytest.
# The kms extras bring solana-keychain's AWS/GCP backends so the native
# kms factory tests run here instead of skipping.
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,fastapi,flask,django,aws-kms,gcp-kms]"
- name: Lint with ruff
working-directory: python
run: ruff check src tests
- name: Type check with pyright
working-directory: python
# Point pyright at the interpreter the extras were installed into; it
# does not reliably auto-detect the active env on the runner.
run: pyright --pythonpath "$(python -c 'import sys; print(sys.executable)')"
- name: Run tests with coverage
working-directory: python
# Coverage gate: line coverage at 90% over solana_pay_kit (the MPP wire layer
# now lives under solana_pay_kit/protocols/mpp). preflight.py is omitted in
# pyproject (live-RPC paths). Branch coverage gate is follow-up work,
# tracked in #108.
run: |
pytest \
--cov=solana_pay_kit \
--cov-report=term-missing \
--cov-report=json:coverage.json \
--cov-fail-under=90 \
--ignore=tests/test_server_html.py
- name: Upload Python coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: python-coverage
path: python/coverage.json