1+ name : PICA Continuous Integration
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+ test-and-analyze :
13+ name : Test, Analyze & Build Paper
14+ runs-on : ubuntu-22.04
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+ # ------------------------------------------------------------------------
27+ # PHASE 1: SETUP
28+ # ------------------------------------------------------------------------
29+ - name : Checkout repository
30+ uses : actions/checkout@v4
31+
32+ - name : Set up Python 3.10
33+ uses : actions/setup-python@v5
34+ with :
35+ python-version : " 3.10"
36+
37+ - name : Install System Dependencies (Tkinter/XVFB)
38+ run : |
39+ sudo apt-get update
40+ sudo apt-get install -y python3-tk xvfb
41+
42+ - name : Install Python Dependencies
43+ run : |
44+ python -m pip install --upgrade pip
45+ pip install pytest flake8 pytest-cov
46+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
47+ pip install -e .
48+
49+ # ------------------------------------------------------------------------
50+ # PHASE 2: LINT & STYLE CHECKS
51+ # ------------------------------------------------------------------------
52+ - name : Run Style & Syntax Check (Flake8)
53+ run : |
54+ echo "STEP 1: Checking for critical syntax errors..."
55+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
56+
57+ echo "STEP 2: Checking for code style warnings..."
58+ flake8 . --count --exit-zero --max-complexity=18 --max-line-length=127 --statistics
59+
60+ # ------------------------------------------------------------------------
61+ # PHASE 3: SECURITY SCAN (CodeQL)
62+ # ------------------------------------------------------------------------
63+ - name : Initialize CodeQL
64+ uses : github/codeql-action/init@v3
65+ with :
66+ languages : ${{ matrix.language }}
67+
68+ - name : Perform CodeQL Analysis
69+ uses : github/codeql-action/analyze@v3
70+ with :
71+ category : " /language:${{ matrix.language }}"
72+
73+ # ------------------------------------------------------------------------
74+ # PHASE 4: AUTOMATED TESTING & COVERAGE
75+ # ------------------------------------------------------------------------
76+ - name : Run All Tests and Generate Reports
77+ run : |
78+ echo "Running tests within a virtual display..."
79+ xvfb-run --auto-servernum pytest --cov=. --cov-report=xml --junitxml=junit.xml -o junit_family=legacy tests/
80+
81+ - name : Upload Coverage Report to Codecov
82+ uses : codecov/codecov-action@v4
83+ with :
84+ token : ${{ secrets.CODECOV_TOKEN }}
85+ files : ./coverage.xml
86+ fail_ci_if_error : true
87+
88+ # ------------------------------------------------------------------------
89+ # PHASE 5: BUILD JOSS PAPER DRAFT
90+ # ------------------------------------------------------------------------
91+ - name : Build JOSS Paper Draft PDF
92+ uses : openjournals/openjournals-draft-action@master
93+ with :
94+ journal : joss
95+ paper-path : paper/paper.md
96+
97+ - name : Upload JOSS Paper Artifact
98+ uses : actions/upload-artifact@v4
99+ with :
100+ name : paper
101+ path : paper/paper.pdf
0 commit comments