Repository navigation
68 lines (65 loc) · 2.32 KB
/
Copy pathci.yml
File metadata and controls
68 lines (65 loc) · 2.32 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the package and test dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
- name: Run the test suite
run: python -m pytest
- name: CLI smoke test
run: |
python - <<'PY'
import pathlib, textwrap, subprocess, sys, tempfile
d = pathlib.Path(tempfile.mkdtemp())
app = d / "app.py"
app.write_text("def load():\n data = {'a': 1}\n return data['missing']\n\nload()\n")
result = subprocess.run(
[sys.executable, "-m", "whyfail", "run", "python", str(app)],
capture_output=True, text=True, timeout=120,
)
assert result.returncode == 1
assert "Likely cause" in result.stdout, result.stdout
print("whyfail run OK")
PY
package:
name: Packaging / build check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tooling
run: python -m pip install --upgrade pip build
- name: Build sdist and wheel
run: python -m build
- name: Install the wheel in a clean venv and smoke-test it
run: |
python -m venv /tmp/whyfail-venv
/tmp/whyfail-venv/bin/python -m pip install dist/*.whl pytest
/tmp/whyfail-venv/bin/whyfail --version
/tmp/whyfail-venv/bin/whyfail --help >/dev/null
cd /tmp && /tmp/whyfail-venv/bin/python - <<'PY'
import subprocess, sys, pathlib, textwrap
app = pathlib.Path("smoke_app.py")
app.write_text("items = []\nprint(items[3])\n")
r = subprocess.run(["whyfail", "run", "python", str(app)], capture_output=True, text=True, timeout=120)
assert r.returncode == 1 and "IndexError" in r.stdout
print("wheel smoke OK")
PY