Update ci.yml #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| PYTEST_DISABLE_PLUGIN_AUTOLOAD: "1" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest==8.3.3 z3-solver==4.13.0.0 gradio==4.44.0 | |
| - name: Show repo state | |
| run: | | |
| python -V | |
| pip list | |
| echo "root files:" | |
| ls -la | |
| echo "tests dir:" | |
| ls -la tests || true | |
| echo "pytest.ini (may be absent):" | |
| cat pytest.ini || true | |
| - name: Import sanity outside pytest | |
| run: | | |
| python - <<'PY' | |
| import importlib, sys | |
| print("import gradio_demo:", importlib.util.find_spec("gradio_demo") is not None) | |
| import gradio_demo as gd | |
| print("audit first line:", gd.audit("penguin on ice").splitlines()[0]) | |
| from z3 import Solver, Bool, sat | |
| s = Solver(); x = Bool("x"); s.add(x == True) | |
| print("z3 sat check:", s.check() == sat) | |
| PY | |
| - name: Collect tests verbosely | |
| run: | | |
| set -x | |
| pytest --collect-only -vv tests || true | |
| echo "collect exit code: $?" | |
| - name: Run tests one by one to expose the first failing import | |
| run: | | |
| set -x | |
| for f in tests/*.py; do | |
| echo "==== running $f ====" | |
| pytest -vv "$f" || true | |
| echo "exit code for $f: $?" | |
| done | |
| # force a failure at the end if any test failed | |
| python - <<'PY' | |
| import sys, pathlib, subprocess | |
| failed = False | |
| for p in pathlib.Path("tests").glob("*.py"): | |
| r = subprocess.run(["pytest","-q",str(p)]) | |
| failed = failed or r.returncode != 0 | |
| sys.exit(1 if failed else 0) | |
| PY |