Skip to content

Commit aebd257

Browse files
workflow updated
1 parent 81ade21 commit aebd257

2 files changed

Lines changed: 63 additions & 15 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "CodeQL Security Scan"
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
pull_request:
7+
branches: [ "main", "master" ]
8+
schedule:
9+
- cron: '30 1 * * 0'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ 'python' ]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v2
31+
with:
32+
languages: ${{ matrix.language }}
33+
34+
- name: Autobuild
35+
uses: github/codeql-action/autobuild@v2
36+
37+
- name: Perform CodeQL Analysis
38+
uses: github/codeql-action/analyze@v2
39+
with:
40+
category: "/language:${{ matrix.language }}"

.github/workflows/joss_tests.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)