Skip to content

Commit 8779c19

Browse files
Update test.yml
1 parent be4e15a commit 8779c19

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,71 @@ on:
55
- main
66
- dev
77
- demo
8+
pull_request:
9+
types:
10+
- opened
11+
- ready_for_review
12+
- reopened
13+
- synchronize
14+
branches:
15+
- main
16+
- dev
17+
- demo
18+
19+
jobs:
20+
backend_tests:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v3
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: "3.11"
31+
32+
- name: Install Backend Dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -r src/ContentProcessorAPI/requirements.txt
36+
pip install pytest-cov
37+
pip install pytest-asyncio
38+
39+
- name: Set PYTHONPATH
40+
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
41+
42+
- name: Check if Backend Test Files Exist
43+
id: check_backend_tests
44+
run: |
45+
46+
if [ -z "$(find src/ContentProcessorAPI/app/test_s -type f -name 'test_*.py')" ]; then
47+
echo "No backend test files found, skipping backend tests."
48+
echo "skip_backend_tests=true" >> $GITHUB_ENV
49+
else
50+
echo "Backend test files found, running tests."
51+
echo "skip_backend_tests=false" >> $GITHUB_ENV
52+
fi
53+
54+
- name: Run Backend Tests with Coverage
55+
if: env.skip_backend_tests == 'false'
56+
run: |
57+
pytest src/ContentProcessorAPI/app/test_s
58+
pytest --cov=. --cov-report=term-missing --cov-report=xml
59+
60+
- name: Skip Backend Tests
61+
if: env.skip_backend_tests == 'true'
62+
run: |
63+
echo "Skipping backend tests because no test files were found."
64+
65+
frontend_tests:
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v3
71+
72+
- name: Set up Node.js
73+
uses: actions/setup-node@v3
74+
with:
75+
node-version: "20"

0 commit comments

Comments
 (0)