Skip to content

Commit 992f451

Browse files
tests updated
1 parent 59674f6 commit 992f451

2 files changed

Lines changed: 105 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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

.github/workflows/python-app.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212

1313
jobs:
1414
build:
15-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-22.04
1616

1717
steps:
1818
# 1. Check out your code
@@ -27,9 +27,8 @@ jobs:
2727
# 3. Install System Dependencies (Required for Tkinter/Matplotlib on Linux)
2828
- name: Install Tkinter System Libs
2929
run: |
30-
sudo rm -f /etc/apt/sources.list.d/azure-cli.list
31-
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
32-
sudo apt-get update && sudo apt-get install -y python3-tk
30+
sudo apt-get update
31+
sudo apt-get install -y python3-tk xvfb
3332
3433
# 4. Install Your Python Dependencies
3534
- name: Install dependencies
@@ -54,4 +53,4 @@ jobs:
5453
# but since we mocked them, they should run fast!
5554
- name: automated test
5655
run: |
57-
python -m pytest tests/
56+
xvfb-run --auto-servernum python -m pytest tests/

0 commit comments

Comments
 (0)