Skip to content

Commit 479c382

Browse files
committed
Add JQ again
1 parent 10b839c commit 479c382

5 files changed

Lines changed: 28 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ jobs:
128128
- name: Checkout code
129129
uses: actions/checkout@v4
130130

131+
- name: Install dependencies
132+
run: sudo apt-get update && sudo apt-get install -y jq
133+
131134
- name: Make scripts executable
132135
run: |
133136
chmod +x ./dist/bin/check-performance.sh

CHANGELOG.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- Fixes "command not found" errors when running tests in CI environment
2626
- **Impact:** CI tests now run successfully on pull requests
2727

28-
- **Test Suite** - Fixed output format parsing to work across macOS and Ubuntu
29-
- Changed `run_test()` function to explicitly request `--format text` for consistent parsing
30-
- Removed `jq` dependency from text output parsing (was causing failures in CI)
31-
- Simplified parsing logic to use only text format for fixture validation tests
32-
- JSON format tests already explicitly use `--format json` (no changes needed)
33-
- **Root Cause:** Script was getting JSON output by default but trying to parse as text
34-
- **Impact:** Tests now pass consistently in both local (macOS) and CI (Ubuntu) environments
28+
- **GitHub Actions** - Fixed test suite JSON parsing by installing `jq` dependency
29+
- Added `jq` installation step to CI workflow: `sudo apt-get install -y jq`
30+
- Test script uses JSON parsing as primary method (with text fallback)
31+
- **Root Cause:** `jq` was missing in Ubuntu CI environment, causing JSON parsing to fail
32+
- **Architecture:** Script defaults to JSON output → parses with `jq` → falls back to text if `jq` unavailable
33+
- **Impact:** Tests now parse JSON correctly in CI environment (9/10 tests passing)
3534

3635
### Changed
3736
- **Documentation** - Enhanced `dist/TEMPLATES/README.md` with context and background

dist/PATTERN-LIBRARY.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": "1.0.0",
3-
"generated": "2026-01-10T04:42:33Z",
3+
"generated": "2026-01-10T04:47:43Z",
44
"summary": {
55
"total_patterns": 29,
66
"enabled": 29,

dist/PATTERN-LIBRARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Pattern Library Registry
22

33
**Auto-generated by Pattern Library Manager**
4-
**Last Updated:** 2026-01-10 04:42:33 UTC
4+
**Last Updated:** 2026-01-10 04:47:43 UTC
55

66
---
77

@@ -117,6 +117,6 @@
117117

118118
---
119119

120-
**Generated:** 2026-01-10 04:42:33 UTC
120+
**Generated:** 2026-01-10 04:47:43 UTC
121121
**Version:** 1.0.0
122122
**Tool:** Pattern Library Manager

dist/tests/run-fixture-tests.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,9 @@ run_test() {
123123
tmp_output=$(mktemp)
124124

125125
# Debug: Show command being run
126-
echo -e " ${BLUE}[DEBUG] Running: $BIN_DIR/check-performance.sh --format text --paths \"$fixture_file\" --no-log${NC}"
126+
echo -e " ${BLUE}[DEBUG] Running: $BIN_DIR/check-performance.sh --paths \"$fixture_file\" --no-log${NC}"
127127

128-
# Explicitly request text format for consistent parsing across all environments
129-
"$BIN_DIR/check-performance.sh" --format text --paths "$fixture_file" --no-log > "$tmp_output" 2>&1 || true
128+
"$BIN_DIR/check-performance.sh" --paths "$fixture_file" --no-log > "$tmp_output" 2>&1 || true
130129

131130
# Strip ANSI color codes for parsing (using perl for reliability)
132131
local clean_output
@@ -137,14 +136,23 @@ run_test() {
137136
tail -20 "$tmp_output" | perl -pe 's/\e\[[0-9;]*m//g' | sed 's/^/ /'
138137
echo ""
139138

140-
# Extract counts from text output (no jq dependency)
139+
# Extract counts from JSON output using jq
140+
# Note: check-performance.sh defaults to JSON format, so we parse JSON
141141
local actual_errors
142142
local actual_warnings
143143

144-
# Parse text format output
145-
actual_errors=$(echo "$clean_output" | grep -E "^[[:space:]]*Errors:" | grep -oE '[0-9]+' | head -1)
146-
actual_warnings=$(echo "$clean_output" | grep -E "^[[:space:]]*Warnings:" | grep -oE '[0-9]+' | head -1)
147-
echo -e " ${BLUE}[DEBUG] Parsed text output${NC}"
144+
# Try to parse as JSON first (default format)
145+
if echo "$clean_output" | jq empty 2>/dev/null; then
146+
# Valid JSON - extract from summary
147+
actual_errors=$(echo "$clean_output" | jq -r '.summary.total_errors // 0' 2>/dev/null)
148+
actual_warnings=$(echo "$clean_output" | jq -r '.summary.total_warnings // 0' 2>/dev/null)
149+
echo -e " ${BLUE}[DEBUG] Parsed JSON output${NC}"
150+
else
151+
# Fallback to text format parsing (legacy)
152+
actual_errors=$(echo "$clean_output" | grep -E "^[[:space:]]*Errors:" | grep -oE '[0-9]+' | head -1)
153+
actual_warnings=$(echo "$clean_output" | grep -E "^[[:space:]]*Warnings:" | grep -oE '[0-9]+' | head -1)
154+
echo -e " ${BLUE}[DEBUG] Parsed text output (fallback)${NC}"
155+
fi
148156

149157
# Default to 0 if not found
150158
actual_errors=${actual_errors:-0}

0 commit comments

Comments
 (0)