Skip to content

Commit dd848b6

Browse files
authored
Merge pull request #40 from nova-rey/codex/rewrite-workflows-to-warn-only-mode
2 parents 6ed6fb5 + cf2416f commit dd848b6

4 files changed

Lines changed: 43 additions & 51 deletions

File tree

.github/workflows/ci-diagnose.yml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,46 @@
11
name: CI Diagnose
2-
on:
3-
workflow_dispatch: {}
4-
push:
5-
branches: [ ci-debug/** ]
6-
permissions:
7-
contents: read
2+
on: { workflow_dispatch: {}, push: { branches: [ ci-debug/** ] }, pull_request: {} }
3+
permissions: { contents: read }
84

95
jobs:
106
diagnose:
117
runs-on: ubuntu-latest
128
steps:
139
- uses: actions/checkout@v4
10+
1411
- name: Dump GitHub context
1512
run: |
1613
echo "event: ${{ github.event_name }}"
1714
echo "ref: ${{ github.ref }}"
1815
echo "sha: ${{ github.sha }}"
16+
1917
- uses: actions/setup-python@v5
2018
with: { python-version: '3.12' }
19+
2120
- name: Python env
2221
run: |
2322
python --version
2423
which python
24+
2525
- name: Tree + key files
2626
run: |
2727
ls -la
28-
echo "--- pyproject.toml ---"; [ -f pyproject.toml ] && sed -n '1,120p' pyproject.toml || echo "missing"
29-
echo "--- setup.cfg ---"; [ -f setup.cfg ] && sed -n '1,120p' setup.cfg || echo "missing"
28+
echo "--- pyproject.toml ---"; [ -f pyproject.toml ] && sed -n '1,200p' pyproject.toml || echo "missing"
29+
echo "--- setup.cfg ---"; [ -f setup.cfg ] && sed -n '1,200p' setup.cfg || echo "missing"
3030
echo "--- requirements*.txt ---"; ls -1 requirements*.txt 2>/dev/null || echo "none"
31+
3132
- name: Test discovery
3233
run: |
33-
echo "tests tree:"
3434
find tests -maxdepth 2 -type f -name "*.py" 2>/dev/null || echo "no tests dir"
35+
3536
- name: Import sanity
3637
env: { PYTHONPATH: ${{ github.workspace }} }
3738
run: |
38-
python - <<'PY'
39-
try:
40-
import crapssim as m
41-
print("import crapssim OK:", getattr(m,'__file__',None))
42-
except Exception as e:
43-
print("import crapssim FAILED:", e)
44-
try:
45-
import crapssim_api as m
46-
print("import crapssim_api OK:", getattr(m,'__file__',None))
47-
except Exception as e:
48-
print("import crapssim_api FAILED:", e)
39+
python - <<'PY' || true
40+
mods = ["crapssim","crapssim_api"]
41+
for m in mods:
42+
try:
43+
__import__(m); print("OK import:", m)
44+
except Exception as e:
45+
print("FAIL import:", m, "->", e)
4946
PY

.github/workflows/coverage.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,20 @@ jobs:
2525
[ -d "crapssim_api" ] && COV_MODS="$COV_MODS --cov=crapssim_api"
2626
echo "mods=$COV_MODS" >> $GITHUB_OUTPUT
2727
28-
- name: Run pytest with coverage (quiet)
29-
id: run_cov
28+
- name: Run pytest with coverage (warn-only)
3029
env: { PYTHONPATH: ${{ github.workspace }}, PYTHONHASHSEED: '0' }
31-
shell: bash
3230
run: |
3331
mkdir -p reports
34-
set +e
3532
if ls tests/**/*.py tests/*.py >/dev/null 2>&1; then
36-
pytest -q ${{ steps.cov.outputs.mods }} --cov-report=xml:coverage.xml -m "not stress" > reports/coverage_quiet.log 2>&1
37-
echo "rc=$?" >> $GITHUB_OUTPUT
33+
pytest -q ${{ steps.cov.outputs.mods }} --cov-report=xml:coverage.xml -m "not stress" \
34+
> reports/coverage_quiet.log 2>&1 || true
35+
if [ ! -f coverage.xml ]; then
36+
echo '<coverage version="0"/>' > coverage.xml
37+
fi
3838
else
3939
echo '<coverage version="0"/>' > coverage.xml
4040
echo "No tests found." > reports/coverage_quiet.log
41-
echo "rc=0" >> $GITHUB_OUTPUT
4241
fi
43-
exit 0
44-
45-
- name: If failed, rerun first failing test verbosely
46-
if: steps.run_cov.outputs.rc != '0'
47-
env: { PYTHONPATH: ${{ github.workspace }}, PYTHONHASHSEED: '0' }
48-
run: |
49-
pytest -vv -x --maxfail=1 --lf -ra --durations=25 | tee reports/coverage_verbose.log
5042
5143
- uses: actions/upload-artifact@v4
5244
if: always()
@@ -55,4 +47,3 @@ jobs:
5547
path: |
5648
coverage.xml
5749
reports/coverage_quiet.log
58-
reports/coverage_verbose.log
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Examples Smoke
22
on: { push: {}, pull_request: {}, workflow_dispatch: {} }
33
permissions: { contents: read }
4+
45
jobs:
56
examples:
67
runs-on: ubuntu-latest
@@ -9,12 +10,20 @@ jobs:
910
- uses: actions/checkout@v4
1011
- uses: actions/setup-python@v5
1112
with: { python-version: '3.11' }
12-
- name: Run examples if present
13+
14+
- name: Run examples if present (warn-only)
1315
env: { PYTHONPATH: ${{ github.workspace }} }
14-
shell: bash
1516
run: |
1617
if [ -f examples/run_examples.py ]; then
17-
python examples/run_examples.py
18+
mkdir -p reports
19+
python examples/run_examples.py 2>&1 | tee reports/examples.log || true
1820
else
1921
echo "No examples/run_examples.py; skipping."
2022
fi
23+
24+
- uses: actions/upload-artifact@v4
25+
if: always()
26+
with:
27+
name: examples-logs
28+
path: reports/examples.log
29+
if-no-files-found: ignore

.github/workflows/import-smoke.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,22 @@ jobs:
1111
- uses: actions/setup-python@v5
1212
with: { python-version: '3.11' }
1313

14-
- name: Import modules from source tree
15-
id: imp
14+
- name: Import modules from source (warn-only)
1615
env: { PYTHONPATH: ${{ github.workspace }} }
17-
shell: bash
1816
run: |
19-
set +e
2017
mkdir -p reports
21-
python - <<'PY' | tee reports/import-smoke.log
22-
import importlib, sys
18+
python - <<'PY' | tee reports/import-smoke.log || true
2319
mods = [("crapssim","core"), ("crapssim_api","api")]
24-
failed = False
20+
bad = []
2521
for mod, label in mods:
2622
try:
27-
m = importlib.import_module(mod)
28-
print(f"OK: import {mod} ->", getattr(m,"__file__",None))
23+
m = __import__(mod); print("OK:", mod, "->", getattr(m,"__file__",None))
2924
except Exception as e:
30-
failed = True
31-
print(f"FAIL: import {mod}: {e}")
32-
if failed:
33-
sys.exit(2)
25+
print("WARN:", mod, "import failed ->", e)
26+
bad.append(mod)
27+
print("Import result:", "OK" if len(bad) < len(mods) else "PARTIAL/MISSING")
3428
PY
29+
3530
- uses: actions/upload-artifact@v4
3631
if: always()
3732
with:

0 commit comments

Comments
 (0)