Skip to content

ci: make parser smoke test resilient (warn if ESC07.sop missing) #6

ci: make parser smoke test resilient (warn if ESC07.sop missing)

ci: make parser smoke test resilient (warn if ESC07.sop missing) #6

Workflow file for this run

name: CI: Python workflow (imports + parser smoke test)

Check failure on line 1 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build.yml

Invalid workflow file

You have an error in your yaml syntax
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Import smoke test
run: |
python - <<'PY'
import sys
import matplotlib
try:
import networkx
print("OK networkx", networkx.__version__)
except Exception as e:
print("networkx not installed:", e)
print("OK matplotlib", matplotlib.__version__)
PY
- name: Parser smoke test (ESC07.sop)
run: |
python - <<'PY'
import os, sys
from instance_parser import parse_sop_file
p = os.path.join("sop_instances", "ESC07.sop")
if not os.path.exists(p):
print("::warning :: Missing sop_instances/ESC07.sop — skipping parser test (will not fail CI).")
sys.exit(0)
try:
nodes, matrix, precedence = parse_sop_file(p)
assert len(nodes) == len(matrix), "nodes and matrix size mismatch"
except Exception as e:
print(f"::error :: Parser failed: {e}")
sys.exit(1)
print(f"OK parser: {len(nodes)} nodes, {len(precedence)} precedence rules")
PY