Skip to content

ci: validate miner docs repository #150

ci: validate miner docs repository

ci: validate miner docs repository #150

Workflow file for this run

name: CI
on:
push:
branches:
- "**"
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Compile example Python
run: python -m compileall -q examples top-model
- name: Check documentation hygiene
run: |
python - <<'PY'
from pathlib import Path
markdown = [Path("README.md"), *Path("docs").glob("*.md")]
assert markdown
for path in markdown:
text = path.read_text(encoding="utf-8")
assert "\x00" not in text, path
assert "recipe_version: 2.0.0" not in text, path
assert "**2.1.0**" in Path("README.md").read_text(encoding="utf-8")
PY
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Validate miner example contracts
run: |
python - <<'PY'
import ast
from pathlib import Path
for directory in (Path("examples/baseline"), Path("top-model")):
expected = {
"architecture.py": "build_model",
"training.py": "train",
}
for filename, function in expected.items():
path = directory / filename
tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
functions = {
node.name
for node in ast.walk(tree)
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef))
}
assert function in functions, f"{path} must define {function}()"
PY
distributed-gloo-tests:
# Legacy check id retained for branch protection; this repository no
# longer contains the private distributed evaluator.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Assert public repository surface
run: |
test -f README.md
test -f docs/getting-started.md
test -f examples/baseline/architecture.py
test ! -e crates
test ! -e bins
test ! -e deploy