-
Notifications
You must be signed in to change notification settings - Fork 184
89 lines (79 loc) · 2.25 KB
/
test.yml
File metadata and controls
89 lines (79 loc) · 2.25 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Test Workflow
on:
push:
branches:
- main
- dev
- demo
paths:
- 'src/**/*.py'
- 'tests/**/*.py'
- 'src/**/requirements.txt'
- 'src/**/pyproject.toml'
- 'src/**/pytest.ini'
- 'src/**/conftest.py'
- '.github/workflows/test.yml'
pull_request:
types:
- opened
- ready_for_review
- reopened
- synchronize
branches:
- main
- dev
- demo
- dependabotchanges
paths:
- 'src/**/*.py'
- 'tests/**/*.py'
- 'src/**/requirements.txt'
- 'src/**/pyproject.toml'
- 'src/**/pytest.ini'
- 'src/**/conftest.py'
- '.github/workflows/test.yml'
jobs:
backend_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install Backend Dependencies
run: |
python -m pip install --upgrade pip
pip install -r src/ContentProcessor/requirements.txt
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
- name: Check if Backend Test Files Exist
id: check_backend_tests
run: |
if [ -z "$(find src/ContentProcessor/src/tests -type f -name 'test_*.py')" ]; then
echo "No backend test files found, skipping backend tests."
echo "skip_backend_tests=true" >> $GITHUB_ENV
else
echo "Backend test files found, running tests."
echo "skip_backend_tests=false" >> $GITHUB_ENV
fi
- name: Run Backend Tests with Coverage
if: env.skip_backend_tests == 'false'
run: |
cd src/ContentProcessor
python -m pytest -vv --cov=. --cov-report=xml --cov-report=term-missing --cov-fail-under=80
- name: Skip Backend Tests
if: env.skip_backend_tests == 'true'
run: echo "Skipping backend tests because no test files were found."
# frontend_tests:
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v5
#
# - name: Set up Node.js
# uses: actions/setup-node@v3
# with:
# node-version: "20"