-
Notifications
You must be signed in to change notification settings - Fork 120
197 lines (193 loc) · 5.88 KB
/
lint-test.yml
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Linting and testing
on:
push:
branches:
- dev
- main
pull_request:
branches:
- dev
- main
workflow_dispatch:
env:
PYRIGHT_PYTHON_FORCE_VERSION: 1.1.268
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install wheel setuptools
- name: Build packages
run: |
for pkg in vibe_core vibe_common vibe_agent vibe_server vibe_dev; do cd src/$pkg && python setup.py bdist_wheel --dist-dir ../../dist; cd ../../; done
- name: Save packages
uses: actions/upload-artifact@v4
with:
name: packages
path: dist
test:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
package-to-test: [vibe_core, vibe_common, vibe_server, vibe_agent]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Retrieve packages
uses: actions/download-artifact@v4
with:
name: packages
path: dist
- name: Install dependencies
run: |
pip install pyright ruff
- name: Install package
run: |
pip install ${{ matrix.package-to-test }}[test] --find-links dist
- name: Lint with ruff
run: |
ruff check ./src/${{ matrix.package-to-test }} --config ./.ruff.toml
- name: Type checking with pyright
run: |
pyright ./src/${{ matrix.package-to-test }}
- name: Test with pytest
run: |
pip install vibe_dev --find-links dist
pytest ./src/${{ matrix.package-to-test}} -v --junitxml=junit/test-results.xml --cov=. --cov-report=xml
ops-test:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/farmai/terravibes/worker-base:12380
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install pyright ruff
- name: Setup op resources
run: |
mkdir -p /opt/terravibes/ops
ln -sf $(pwd)/op_resources /opt/terravibes/ops/resources
mkdir /app
ln -sf $(pwd)/ops /app/ops
ln -sf $(pwd)/workflows /app/workflows
- name: Install packages
run: |
pip install ./src/vibe_core
pip install ./src/vibe_common
pip install ./src/vibe_agent
pip install ./src/vibe_server
pip install ./src/vibe_lib
pip install ./src/vibe_dev
- name: Linting ops
run: |
ruff check ./ops --config ./.ruff.toml
- name: Type checking ops
run: |
pyright ./ops
- name: Get SAM model
run: |
pip install git+https://github.com/facebookresearch/segment-anything.git
mkdir -p /mnt/onnx_resources
python -c "from scripts.export_sam_models import dev; dev()"
- name: Run integration tests
run: |
pytest ./src/vibe_lib ./ops ./src/tests -v --durations=0 --full-trace --junitxml=test-output.xml
check-docstrings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install ruff
run: |
pip install ruff
- name: "Check docstrings for vibe_core"
run: |
ruff check --select D,D401 --ignore D105 --force-exclude --exclude src/vibe_core/vibe_core/farmvibes_ai_hello_world.py --config "lint.pydocstyle.convention = 'google'" src/vibe_core/vibe_core/*.py
- name: "Check docstrings for vibe_core/data"
run: |
ruff check --select D,D401 --ignore D105 --config "lint.pydocstyle.convention = 'google'" src/vibe_core/vibe_core/data/*.py
local-integration-tests:
runs-on: ubuntu-latest
steps:
- name: Free space before cleanup
shell: bash
run: |
echo "Memory and swap:"
free -h
echo
echo "Available storage:"
df -h
echo
- name: Remove unused software
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -fr /usr/local/lib/android
sudo rm -fr /opt/ghc
- name: Free space after cleanup
shell: bash
run: |
echo "Memory and swap:"
free -h
echo
echo "Available storage:"
df -h
echo
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install packages
run: |
pip install ./src/vibe_core
pip install ./src/vibe_common
pip install ./src/vibe_agent
pip install ./src/vibe_server
pip install ./src/vibe_lib
pip install ./src/vibe_dev
- name: Actually build cluster
run: farmvibes-ai local setup --auto-confirm
- name: Cluster status before building local images
run: |
bash ./scripts/local-k8s-diagnostics.sh
- name: Build images
run: |
WAIT_AT_THE_END=1 make local
- name: Cluster status after building local images
run: |
bash ./scripts/local-k8s-diagnostics.sh
- name: Free space after cluster creation
run: |
echo "Memory and swap:"
free -h
echo
echo "Available storage:"
df -h
echo
- name: Run integration tests
run: |
pytest ./src/tests_local_cluster/ -v --junitxml=junit/test-results.xml
- name: Cluster status after running tests
if: always()
run: |
bash ./scripts/local-k8s-diagnostics.sh