-
Notifications
You must be signed in to change notification settings - Fork 0
248 lines (215 loc) · 8 KB
/
Copy pathevaluate.yml
File metadata and controls
248 lines (215 loc) · 8 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
name: Validate Workflows
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 6 * * 1' # Weekly on Monday 06:00 UTC
jobs:
validate-cwl:
name: Validate CWL
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install cwltool
run: pip install cwltool
- name: Validate all CWL files
run: |
status=0
while IFS= read -r -d '' cwl_file; do
if cwltool --validate "${cwl_file}" 2>&1; then
echo "OK: ${cwl_file}"
else
echo "FAIL: ${cwl_file}"
status=1
fi
done < <(find workflows/ tools/ -name "*.cwl" -print0)
exit $status
validate-agent-yaml:
name: Validate agent.yaml
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install jsonschema pyyaml
- name: Validate agent.yaml files
run: |
python3 << 'PYEOF'
import yaml, jsonschema, glob, sys
with open('schemas/agent-spec.schema.yaml') as f:
schema = yaml.safe_load(f)
agent_files = sorted(glob.glob('workflows/*/agent.yaml'))
if not agent_files:
print("ERROR: No agent.yaml files found")
sys.exit(1)
errors = []
for agent_file in agent_files:
with open(agent_file) as f:
doc = yaml.safe_load(f)
try:
jsonschema.validate(doc, schema)
print(f'OK: {agent_file}')
except jsonschema.ValidationError as e:
errors.append(f'FAIL: {agent_file}: {e.message}')
print(f'FAIL: {agent_file}: {e.message}')
print(f'\n{len(agent_files)} agent.yaml files validated, {len(errors)} errors')
if errors:
sys.exit(1)
PYEOF
check-structure:
name: Check workflow structure
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify each workflow has required files
run: |
status=0
for dir in workflows/*/; do
name=$(basename "$dir")
missing=""
[ ! -f "${dir}main.cwl" ] && missing="${missing} main.cwl"
[ ! -f "${dir}agent.yaml" ] && missing="${missing} agent.yaml"
[ ! -d "${dir}examples" ] && missing="${missing} examples/"
[ ! -d "${dir}tests" ] && missing="${missing} tests/"
if [ -n "$missing" ]; then
echo "FAIL: ${name} — missing:${missing}"
status=1
else
echo "OK: ${name}"
fi
done
exit $status
validate-ro-crate:
name: Validate RO-Crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install rocrate
- name: Validate Workflow Run RO-Crates
run: |
python3 << 'PYEOF'
import glob, json, sys
crate_files = sorted(
glob.glob('workflows/*/tests/ro-crate/ro-crate-metadata.json') +
glob.glob('workflows/*/tests/ro-crate/*/ro-crate-metadata.json')
)
if not crate_files:
print("ERROR: No RO-Crate files found")
sys.exit(1)
errors = []
for path in crate_files:
parts = path.split('/')
pipeline = parts[1]
# Include test name for per-test subdirectories
if len(parts) > 5:
pipeline = f"{parts[1]}/{parts[4]}"
try:
with open(path) as f:
data = json.load(f)
graph = data.get('@graph', [])
if not graph:
errors.append(f'FAIL: {pipeline}: empty @graph')
continue
types = {e.get('@type') if isinstance(e.get('@type'), str) else str(e.get('@type', '?')) for e in graph}
has_dataset = any('Dataset' in str(e.get('@type', '')) for e in graph)
has_workflow = any('ComputationalWorkflow' in str(e.get('@type', '')) for e in graph)
has_action = any('CreateAction' in str(e.get('@type', '')) for e in graph)
if not has_dataset:
errors.append(f'FAIL: {pipeline}: missing Dataset entity')
elif not has_workflow:
errors.append(f'FAIL: {pipeline}: missing ComputationalWorkflow entity')
elif not has_action:
errors.append(f'FAIL: {pipeline}: missing CreateAction entity')
else:
print(f'OK: {pipeline} ({len(graph)} entities)')
except Exception as e:
errors.append(f'FAIL: {pipeline}: {e}')
print(f'\n{len(crate_files)} RO-Crate files validated, {len(errors)} errors')
for e in errors:
print(e)
if errors:
sys.exit(1)
PYEOF
validate-references:
name: Validate reference URLs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install pyyaml
- name: Check Ensembl URLs
run: |
python3 << 'PYEOF'
import yaml, subprocess, sys
with open('references/genomes.yaml') as f:
genomes = yaml.safe_load(f)
errors = []
for g in genomes:
name = f"{g['organism']} ({g['assembly']})"
for key in ['fasta', 'gtf']:
url = g.get('sources', {}).get('ensembl', {}).get(key)
if not url:
continue
result = subprocess.run(
['curl', '-skI', '-o', '/dev/null', '-w', '%{http_code}', '--max-time', '30', url],
capture_output=True, text=True, timeout=60
)
code = result.stdout.strip()
if code in ('200', '226', '301', '302'):
print(f'OK: {name} {key} ({code})')
else:
errors.append(f'FAIL: {name} {key} -> HTTP {code}')
print(f'FAIL: {name} {key} -> HTTP {code}')
print(f'\n{len(genomes)} genomes checked, {len(errors)} errors')
if errors:
for e in errors:
print(e)
sys.exit(1)
PYEOF
- name: Check iGenomes S3 paths
run: |
python3 << 'PYEOF'
import yaml, subprocess, sys
with open('references/genomes.yaml') as f:
genomes = yaml.safe_load(f)
errors = []
for g in genomes:
name = f"{g['organism']} ({g['assembly']})"
igenomes = g.get('sources', {}).get('igenomes', {})
base = igenomes.get('base')
if not base:
continue
result = subprocess.run(
['aws', 's3', 'ls', '--no-sign-request', base],
capture_output=True, text=True, timeout=30
)
if result.returncode == 0:
print(f'OK: {name} iGenomes base')
else:
errors.append(f'FAIL: {name} iGenomes base not accessible')
print(f'FAIL: {name} iGenomes base not accessible')
if errors:
for e in errors:
print(e)
sys.exit(1)
else:
print(f'\nAll iGenomes paths verified')
PYEOF