-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 2.66 KB
/
Copy pathai-platform-ci.yml
File metadata and controls
87 lines (73 loc) · 2.66 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
name: AI Platform CI
on:
workflow_dispatch:
permissions:
contents: read
jobs:
lint-python:
name: Lint Python (AI Platform)
runs-on: ubuntu-latest
env:
AI_PLATFORM_BACKEND_DIR: legacy/disha-agi-brain/backend
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install ruff
run: pip install ruff
- name: Lint with ruff
run: |
if [ -d "${AI_PLATFORM_BACKEND_DIR}/app" ]; then
ruff check "${AI_PLATFORM_BACKEND_DIR}/app/" --output-format=github
else
echo "No AI platform app directory at ${AI_PLATFORM_BACKEND_DIR}/app; skipping lint."
fi
- name: Format check with ruff
run: |
if [ -d "${AI_PLATFORM_BACKEND_DIR}/app" ]; then
ruff format "${AI_PLATFORM_BACKEND_DIR}/app/" --check
else
echo "No AI platform app directory at ${AI_PLATFORM_BACKEND_DIR}/app; skipping format check."
fi
test-python:
name: Test Python (AI Platform)
runs-on: ubuntu-latest
env:
PYTHONPATH: ${{ github.workspace }}
DISHA_MODEL_PROVIDER: mock
AI_PLATFORM_BACKEND_DIR: legacy/disha-agi-brain/backend
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
- name: Install CPU-only PyTorch
run: |
pip install --upgrade pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
- name: Install project dependencies
run: |
pip install -r "${AI_PLATFORM_BACKEND_DIR}/requirements.txt"
pip install -r disha/ai/core/decision_engine/requirements.txt
- name: Run tests
run: |
if [ -d "${AI_PLATFORM_BACKEND_DIR}/tests" ]; then
python -m pytest "${AI_PLATFORM_BACKEND_DIR}/tests/" \
-v --tb=short -p no:cacheprovider \
--ignore="${AI_PLATFORM_BACKEND_DIR}/tests/test_trained_models.py"
else
echo "No AI platform tests directory at ${AI_PLATFORM_BACKEND_DIR}/tests; skipping test run."
fi
- name: Run trained-model tests (checkpoint-dependent)
run: |
if [ -f "${AI_PLATFORM_BACKEND_DIR}/tests/test_trained_models.py" ]; then
python -m pytest \
"${AI_PLATFORM_BACKEND_DIR}/tests/test_trained_models.py" \
-v --tb=short -p no:cacheprovider
else
echo "No trained-model test file found; skipping checkpoint-dependent tests."
fi