-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (49 loc) · 1.55 KB
/
test.yml
File metadata and controls
58 lines (49 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Automated Testing
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
test:
name: Test & Get Coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Cache pip dependencies
id: cache-pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install System Dependencies (Tkinter/XVFB)
run: |
sudo apt-get update
sudo apt-get install -y python3-tk xvfb
- name: Install Python and Project Dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Run All Tests and Generate Reports
run: |
echo "Running tests with coverage within a virtual display..."
xvfb-run --auto-servernum pytest --cov=. --cov-report=xml --junitxml=junit.xml -o junit_family=legacy tests/
- name: Upload Coverage Report to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true