Skip to content

Commit 4a44678

Browse files
committed
refactor: purge Python from CI validation pipeline via yq
1 parent 79dabdf commit 4a44678

1 file changed

Lines changed: 28 additions & 22 deletions

File tree

‎.github/workflows/dogfood-gate.yml‎

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -256,28 +256,34 @@ jobs:
256256
257257
echo "has_manifest=true" >> "$GITHUB_OUTPUT"
258258
259-
# Validate TOML structure using Python 3.11+ tomllib
260-
python3 -c "
261-
import tomllib, sys
262-
with open('eclexiaiser.toml', 'rb') as f:
263-
data = tomllib.load(f)
264-
project = data.get('project', {})
265-
if not project.get('name', '').strip():
266-
print('ERROR: project.name is required', file=sys.stderr)
267-
sys.exit(1)
268-
functions = data.get('functions', [])
269-
if not functions:
270-
print('ERROR: at least one [[functions]] entry is required', file=sys.stderr)
271-
sys.exit(1)
272-
for fn in functions:
273-
if not fn.get('name', '').strip():
274-
print('ERROR: function name cannot be empty', file=sys.stderr)
275-
sys.exit(1)
276-
if not fn.get('source', '').strip():
277-
print(f'ERROR: function {fn[\"name\"]} has no source path', file=sys.stderr)
278-
sys.exit(1)
279-
print(f'Valid: {project[\"name\"]} ({len(functions)} function(s))')
280-
" || {
259+
# Validate TOML structure using pre-installed yq
260+
(
261+
PROJECT_NAME=$(yq -e '.project.name // ""' eclexiaiser.toml)
262+
if [ -z "$PROJECT_NAME" ]; then
263+
echo "ERROR: project.name is required" >&2
264+
exit 1
265+
fi
266+
267+
FUNCTIONS_LEN=$(yq -e '.functions | length' eclexiaiser.toml)
268+
if [ -z "$FUNCTIONS_LEN" ] || [ "$FUNCTIONS_LEN" -eq 0 ]; then
269+
echo "ERROR: at least one [[functions]] entry is required" >&2
270+
exit 1
271+
fi
272+
273+
for i in $(seq 0 $((FUNCTIONS_LEN - 1))); do
274+
FN_NAME=$(yq -e ".functions[$i].name // \"\"" eclexiaiser.toml)
275+
if [ -z "$FN_NAME" ]; then
276+
echo "ERROR: function name cannot be empty" >&2
277+
exit 1
278+
fi
279+
FN_SRC=$(yq -e ".functions[$i].source // \"\"" eclexiaiser.toml)
280+
if [ -z "$FN_SRC" ]; then
281+
echo "ERROR: function $FN_NAME has no source path" >&2
282+
exit 1
283+
fi
284+
done
285+
echo "Valid: $PROJECT_NAME ($FUNCTIONS_LEN function(s))"
286+
) || {
281287
echo "::error file=eclexiaiser.toml::Invalid eclexiaiser.toml — see step output for details"
282288
exit 1
283289
}

0 commit comments

Comments
 (0)