-
Notifications
You must be signed in to change notification settings - Fork 186
176 lines (151 loc) · 6.16 KB
/
test.yml
File metadata and controls
176 lines (151 loc) · 6.16 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Test Workflow
on:
push:
branches:
- main
- dev
- demo
- psl-unit-test-cps-v2
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'
permissions:
contents: read
actions: read
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.12"
- 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/tests/ContentProcessor -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/tests/ContentProcessor
python -m pytest . --ignore=libs/test_models_and_entities.py --ignore=libs/test_utils_coverage_boost.py --ignore=libs/test_final_push_80.py --cov-config=.coveragerc --cov=../../ContentProcessor/src --cov-report=xml --cov-report=term --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."
api_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.12"
- name: Install API Dependencies
run: |
python -m pip install --upgrade pip
pip install -r src/ContentProcessorAPI/requirements.txt
pip install pytest==9.0.2 pytest-cov==7.0.0 pytest-mock==3.15.1 pytest-asyncio==1.3.0
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
- name: Check if API Test Files Exist
id: check_api_tests
run: |
if [ -z "$(find src/tests/ContentProcessorAPI -type f -name 'test_*.py')" ]; then
echo "No API test files found, skipping API tests."
echo "skip_api_tests=true" >> $GITHUB_ENV
else
echo "API test files found, running tests."
echo "skip_api_tests=false" >> $GITHUB_ENV
fi
- name: Run API Tests with Coverage
if: env.skip_api_tests == 'false'
run: |
cd src/tests/ContentProcessorAPI
python -m pytest --cov-config=.coveragerc --cov=../../ContentProcessorAPI/app --cov-report=xml --cov-report=term --cov-fail-under=80
- name: Skip API Tests
if: env.skip_api_tests == 'true'
run: echo "Skipping API tests because no test files were found."
workflow_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.12"
- name: Install Workflow Dependencies
run: |
python -m pip install --upgrade pip
pip install -e src/ContentProcessorWorkflow
pip install pytest==9.0.2 pytest-cov==7.0.0 pytest-mock==3.15.1 pytest-asyncio==1.3.0
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
- name: Check if Workflow Test Files Exist
id: check_workflow_tests
run: |
if [ -z "$(find src/tests/ContentProcessorWorkflow -type f -name 'test_*.py')" ]; then
echo "No workflow test files found, skipping workflow tests."
echo "skip_workflow_tests=true" >> $GITHUB_ENV
else
echo "Workflow test files found, running tests."
echo "skip_workflow_tests=false" >> $GITHUB_ENV
fi
- name: Run Workflow Tests with Coverage
if: env.skip_workflow_tests == 'false'
run: |
cd src/tests/ContentProcessorWorkflow
python -m pytest utils/ libs/application/ libs/azure/ libs/base/ services/ -k "not test_service_scope_get_service_not_registered and not test_app_context_scoped_service_different_in_different_scopes and not test_get_azure_credential_with_all_env_vars and not test_app_context_create_instance_with_dependencies and not test_log_error_minimal_params and not test_get_async_bearer_token_provider and not test_prompt_template_rendering and not test_application_base_with_explicit_env_path and not test_app_context_async_scope_lifecycle and not test_app_context_async_singleton_lifecycle and not test_configure_logging_with_file_handler and not test_log_error_with_context_and_extra_data and not test_join_url_variations and not test_parse_retry_after_numeric and not test_parse_retry_after_invalid" --ignore=libs/agent_framework --cov-config=.coveragerc --cov=../../ContentProcessorWorkflow/src --cov-report=xml --cov-report=term --cov-fail-under=80
- name: Skip Workflow Tests
if: env.skip_workflow_tests == 'true'
run: echo "Skipping workflow 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"