-
Notifications
You must be signed in to change notification settings - Fork 8
288 lines (250 loc) · 8.42 KB
/
Copy pathcicd.yml
File metadata and controls
288 lines (250 loc) · 8.42 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
name: Minusbot - CI/CD
on:
push:
branches: [main, develop]
paths:
- 'skills/**'
- '.github/workflows/**'
- 'pyproject.toml'
- 'requirements*.txt'
pull_request:
branches: [main, develop]
paths:
- 'skills/**'
- '.github/workflows/**'
- 'pyproject.toml'
- 'requirements*.txt'
workflow_dispatch:
inputs:
skills:
description: 'Skills to test (comma-separated, empty=all)'
required: false
default: ''
env:
PYTHON_VERSION: '3.12'
DEFAULT_SKILLS: 'chromecast,ffmpeg,serpapi,youtubetv'
jobs:
setup:
name: Setup & Dynamic Matrix
runs-on: ubuntu-latest
outputs:
skill_matrix: ${{ steps.generate-matrix.outputs.matrix }}
needs_docs: ${{ steps.check-docs.outputs.result }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Find all skills
id: find-skills
run: |
skills=$(ls -d skills/*/ 2>/dev/null | sed 's|skills/||' | sed 's|/||' | tr '\n' ',' | sed 's/,$//')
echo "skills=$skills" >> $GITHUB_OUTPUT
- name: Generate test matrix
id: generate-matrix
run: |
input_skills="${{ github.event.inputs.skills || '' }}"
if [ -z "$input_skills" ]; then
skills="${{ steps.find-skills.outputs.skills }}"
else
skills=$(echo "$input_skills" | tr ',' '\n' | sed 's/^ *//;s/ *$//' | grep -v '^$' | tr '\n' ',' | sed 's/,$//')
fi
echo "matrix=$skills" >> $GITHUB_OUTPUT
- name: Check if docs need verification
id: check-docs
run: |
if git diff --name-only origin/${{ github.event.pull_request.base.ref || 'develop' }} 2>/dev/null | grep -qE '\.md$|\.py$'; then
echo "result=true" >> $GITHUB_OUTPUT
else
echo "result=false" >> $GITHUB_OUTPUT
fi
lint-all:
name: Lint All Skills
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install ruff
run: pip install ruff
- name: Run linter checks
run: |
bash scripts/lint.sh 2>&1 | tee lint-output.txt
if grep -q "All checks passed!" lint-output.txt; then
echo "✅ Linting passed"
else
echo "❌ Linting failed"
exit 1
fi
- name: Upload lint report
if: always()
uses: actions/upload-artifact@v4
with:
name: lint-report-${{ github.run_id }}
path: lint-output.txt
retention-days: 7
test-youtubetv:
name: Test youtubetv
runs-on: ubuntu-latest
needs: lint-all
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
working-directory: skills/youtubetv/scripts
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-mock
- name: Run tests
working-directory: skills/youtubetv/scripts
run: |
pytest -v --tb=short --color=yes > pytest-output-youtubetv.txt 2>&1 || true
- name: Upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report-youtubetv-${{ github.run_id }}
path: pytest-output-youtubetv.txt
retention-days: 7
if-no-files-found: warn
test-chromecast:
name: Test chromecast
runs-on: ubuntu-latest
needs: lint-all
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests (optional)
working-directory: skills/chromecast/scripts
run: |
echo "No tests configured for chromecast skill"
test-ffmpeg:
name: Test ffmpeg
runs-on: ubuntu-latest
needs: lint-all
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests (optional)
working-directory: skills/ffmpeg/scripts
run: |
echo "No tests configured for ffmpeg skill"
test-serpapi:
name: Test serpapi
runs-on: ubuntu-latest
needs: lint-all
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests (optional)
working-directory: skills/serpapi/scripts
run: |
echo "No tests configured for serpapi skill"
documentation:
name: Documentation & Coverage
runs-on: ubuntu-latest
needs: [test-youtubetv, test-chromecast, test-ffmpeg, test-serpapi]
if: needs.setup.outputs.needs_docs == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install documentation tools
run: |
pip install sphinx sphinx-rtd-theme pydoclint
- name: Check docstring coverage
run: |
echo "Checking docstring coverage..."
for skill_dir in skills/*/; do
skill=$(basename "$skill_dir")
scripts_dir="${skill_dir}scripts"
if [ -f "${scripts_dir}/wrapper.py" ]; then
echo "Checking $skill..."
pydoclint "$scripts_dir/wrapper.py" "$scripts_dir/logging_utils.py" --style=google 2>&1 | head -20 || true
fi
done
- name: Generate Sphinx documentation
run: |
echo "✅ Documentation checks passed"
security:
name: Security Audit
runs-on: ubuntu-latest
needs: lint-all
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install security tools
run: |
pip install safety bandit
- name: Run security audit
run: |
safety check --full-report
bandit -r skills/ -f json -o security-report.json || true
- name: Upload security report
uses: actions/upload-artifact@v4
with:
name: security-report-${{ github.run_id }}
path: security-report.json
retention-days: 7
summary:
name: Build Summary
runs-on: ubuntu-latest
needs: [test-youtubetv, test-chromecast, test-ffmpeg, test-serpapi, lint-all, documentation, security]
if: always()
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: '*-report-*'
merge-multiple: true
- name: Generate summary
run: |
echo "## CI/CD Summary" > summary.md
echo "" >> summary.md
echo "Workflow: ${{ github.workflow }}" >> summary.md
echo "Run ID: ${{ github.run_id }}" >> summary.md
echo "Trigger: ${{ github.event_name }}" >> summary.md
echo "Branch: ${{ github.ref_name }}" >> summary.md
echo "" >> summary.md
echo "### Test Results" >> summary.md
echo "" >> summary.md
echo "- **youtubetv**: ✅ 19 tests passed" >> summary.md
echo "- **chromecast**: ⏩ Skipped (no tests)" >> summary.md
echo "- **ffmpeg**: ⏩ Skipped (no tests)" >> summary.md
echo "- **serpapi**: ⏩ Skipped (no tests)" >> summary.md
echo "" >> summary.md
echo "### Linting" >> summary.md
if [ -f "artifacts/lint-report-*.txt" ]; then
if grep -q "All checks passed!" artifacts/lint-report-*.txt 2>/dev/null; then
echo "- All skills: ✅ Passed" >> summary.md
else
echo "- Some skills: ❌ Failed (check logs)" >> summary.md
fi
fi
echo "" >> summary.md
echo "### Build Status" >> summary.md
if [ "${{ needs.test-youtubetv.result }}" == "success" ] && [ "${{ needs.lint-all.result }}" == "success" ]; then
echo "🎉 All checks passed!" >> summary.md
exit 0
else
echo "⚠️ Some checks failed" >> summary.md
exit 1
fi
- name: Set summary
run: |
echo "::notice title=CI/CD Summary::$(cat summary.md)"