Skip to content

Add Mintlayer Python SDK (port of go-sdk) #1

Add Mintlayer Python SDK (port of go-sdk)

Add Mintlayer Python SDK (port of go-sdk) #1

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Least privilege: the workflow only reads the repo.
permissions:
contents: read
# Cancel superseded runs on rapid pushes.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint & typecheck
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c7f87aa956e4bb3fa984f422a52ffa2ccc4abd77 # v5.4.2
with:
enable-cache: true
# uv.lock is intentionally gitignored for this library, so key the
# cache on the dependency manifest instead.
cache-dependency-glob: pyproject.toml
- name: Install Python
run: uv python install 3.12
- name: Sync dependencies
run: uv sync --group dev --python 3.12
- name: Ruff lint
run: uv run ruff check .
# Scoped to Python paths: repo-wide format would also reformat the
# illustrative snippets inside docs/*.md and README.md.
- name: Ruff format
run: uv run ruff format --check mintlayer/ tests/ examples/
- name: Mypy
run: uv run mypy mintlayer/
test:
name: Test (Python ${{ matrix.python }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c7f87aa956e4bb3fa984f422a52ffa2ccc4abd77 # v5.4.2
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- name: Install Python ${{ matrix.python }}
run: uv python install ${{ matrix.python }}
- name: Sync dependencies
run: uv sync --group dev --python ${{ matrix.python }}
# WASM init costs ~400 ms per Client; the session-scoped fixture keeps
# the suite to ~2 min. Coverage gate: total must stay above 80%.
- name: Run tests with coverage
run: >
uv run pytest tests/ -q
--cov --cov-report=term-missing
--cov-fail-under=80
build:
name: Build wheel
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c7f87aa956e4bb3fa984f422a52ffa2ccc4abd77 # v5.4.2
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- name: Install Python
run: uv python install 3.12
- name: Build sdist and wheel
run: uv build
- name: Smoke-test wheel contents
run: |
python3 - <<'EOF'
import zipfile, glob
wheel = glob.glob("dist/*.whl")[0]
names = zipfile.ZipFile(wheel).namelist()
assert any(n.endswith("wasm_wrappers_bg.wasm") for n in names), "wasm binary missing"
assert any(n.endswith("wasm_wrappers_bg.wasm.sha256") for n in names), "sha256 pin missing"
assert any(n == "mintlayer/__init__.py" for n in names), "package missing"
print(f"{wheel}: {len(names)} entries OK")
EOF
all-green:
name: All checks passed
runs-on: ubuntu-latest
needs: [lint, test, build]
steps:
- run: echo "All CI jobs green"