@@ -25,51 +25,59 @@ jobs:
2525 - name : Install Dependencies
2626 run : |
2727 python -m pip install --upgrade pip
28- # Install PICA in editable mode so tests can find your source code
28+ # Install PICA in editable mode
2929 pip install -e .
30- # Install Testing & Linting tools
31- pip install pytest flake8
30+ # Install Testing, Linting, and Coverage tools
31+ pip install pytest flake8 pytest-cov
3232
3333 # ------------------------------------------------------------------------
3434 # PHASE 2: READYMADE TESTS (Standard Industry Checks)
3535 # ------------------------------------------------------------------------
3636 - name : Run Style & Syntax Check (Flake8)
3737 run : |
3838 echo "STEP 1: Checking for critical syntax errors..."
39- # This stops the build if there are actual Python syntax errors (E9, F63, etc.)
4039 flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
4140
4241 echo "STEP 2: Checking for code style warnings..."
43- # This just warns you about messy code (long lines, unused imports) but won't fail the build
44- # 'exit-zero' ensures your test passes even if your style isn't perfect
4542 flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
4643
4744 # ------------------------------------------------------------------------
48- # PHASE 3: YOUR CUSTOM TESTS (The "Three Pillars")
45+ # PHASE 3: CUSTOM TESTS (The "Three Pillars")
4946 # ------------------------------------------------------------------------
47+ # We keep these separate so the logs are easy for humans to read
5048
51- # Test 1: Does the code exist and import correctly?
5249 - name : Run Test 1 - Auto-Discovery (Smoke Test)
5350 run : |
5451 echo "--------------------------------------"
5552 echo "GOAL: Verify all GUI modules load without crashing."
56- echo "--------------------------------------"
5753 python -m unittest tests/test_auto_discovery.py
5854
59- # Test 2: Does the physics logic work?
6055 - name : Run Test 2 - Deep Simulation (Behavior Test)
6156 run : |
62- echo ""
6357 echo "--------------------------------------"
6458 echo "GOAL: Verify SCPI commands and hardware protocols."
65- echo "--------------------------------------"
6659 python -m unittest tests/test_deep_simulation.py
6760
68- # Test 3: Do the buttons connect to the scripts?
6961 - name : Run Test 3 - Full Stack Simulation (Integration Test)
7062 run : |
71- echo ""
7263 echo "--------------------------------------"
7364 echo "GOAL: Verify Launcher buttons and GUI-Backend handoff."
74- echo "--------------------------------------"
7565 python -m unittest tests/test_full_stack_simulation.py
66+
67+ # ------------------------------------------------------------------------
68+ # PHASE 4: COVERAGE & PROOF (For JOSS Reviewers)
69+ # ------------------------------------------------------------------------
70+ - name : Generate Coverage Report
71+ run : |
72+ echo "--------------------------------------"
73+ echo "GOAL: Calculate Test Coverage %"
74+ # We run pytest to generate the XML report needed by Codecov
75+ # This re-runs the tests, but captures which lines were hit.
76+ pytest --cov=. --cov-report=xml tests/
77+
78+ - name : Upload Coverage to Codecov
79+ uses : codecov/codecov-action@v3
80+ with :
81+ token : ${{ secrets.CODECOV_TOKEN }} # Optional for public repos, but good to have
82+ files : ./coverage.xml
83+ fail_ci_if_error : false
0 commit comments