-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (100 loc) · 3.46 KB
/
Copy pathci.yml
File metadata and controls
121 lines (100 loc) · 3.46 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Install Python
run: uv python install 3.12
- name: Sync dependencies (locked)
run: uv sync --locked --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@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Install Python ${{ matrix.python }}
run: uv python install ${{ matrix.python }}
- name: Sync dependencies (locked)
run: uv sync --locked --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@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
enable-cache: true
cache-dependency-glob: uv.lock
- 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
wheels = glob.glob("dist/*.whl")
assert wheels, "no wheel produced by uv build"
wheel = wheels[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"