-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (83 loc) · 2.59 KB
/
ci.yml
File metadata and controls
96 lines (83 loc) · 2.59 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
# CI for capabilities repo — lint and validate manifests.
#
# Runs on PRs and pushes to main. Covers:
# - ruff lint for critical Python errors across the repo
# - YAML validation for capability.yaml files and skill frontmatter
#
# Capability internal tests (pytest, etc.) are author-owned and run
# locally — CI doesn't wire up per-capability test deps.
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
version: "latest"
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install ruff
run: uv pip install ruff --system
- name: Ruff check (critical errors only)
run: ruff check --select E9,F63,F7,F82 .
- name: Ruff check AIRT scripts (full)
run: ruff check --select E,F,W capabilities/ai-red-teaming/scripts/ capabilities/ai-red-teaming/tools/ capabilities/ai-red-teaming/tests/ || true
yaml-check:
name: Validate YAML
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check capability.yaml files
run: |
pip install pyyaml
python -c "
import yaml, sys
from pathlib import Path
errors = 0
for f in Path('.').rglob('capability.yaml'):
try:
yaml.safe_load(f.read_text())
print(f'OK: {f}')
except Exception as e:
print(f'FAIL: {f}: {e}')
errors += 1
sys.exit(errors)
"
- name: Check skill frontmatter
run: |
python -c "
import yaml, sys
from pathlib import Path
errors = 0
skill_files = sorted(
list(Path('.').rglob('SKILL.md')) + list(Path('.').rglob('skill.md'))
)
for f in skill_files:
text = f.read_text()
if not text.startswith('---\n'):
continue
end = text.find('\n---', 4)
if end == -1:
print(f'FAIL: {f}: missing closing frontmatter delimiter')
errors += 1
continue
try:
yaml.safe_load(text[4:end])
print(f'OK: {f}')
except Exception as e:
print(f'FAIL: {f}: {e}')
errors += 1
sys.exit(errors)
"