Skip to content

Commit 2506996

Browse files
committed
[PLUTO-1411] debug
1 parent 1cb85b6 commit 2506996

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

.github/workflows/it-test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest, macos-latest, windows-latest]
15+
fail-fast: false # Don't stop all jobs if one fails
1516
steps:
1617
- name: Checkout code
1718
uses: actions/checkout@v4
@@ -45,7 +46,7 @@ jobs:
4546
if: matrix.os != 'windows-latest'
4647
run: chmod +x cli-v2
4748

48-
- name: Run plugin tests
49+
- name: Run tool tests
4950
id: run_tests
5051
continue-on-error: true
5152
shell: bash
@@ -62,7 +63,10 @@ jobs:
6263
tool_name=$(basename "$tool_dir")
6364
if [ -d "$tool_dir/test/src" ]; then
6465
echo "Running tests for $tool_name..."
65-
./run-tool-tests.sh "$tool_name"
66+
./run-tool-tests.sh "$tool_name" || {
67+
echo "❌ Test failed for $tool_name"
68+
echo "$tool_name" >> /tmp/failed_tools.txt
69+
}
6670
fi
6771
done
6872

run-tool-tests.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,32 @@ elif [[ "$OSTYPE" == "msys"* ]] || [[ "$OSTYPE" == "cygwin"* ]]; then
4646
sed -i 's|/C:/Users/runner/work/codacy-cli-v2/codacy-cli-v2/|/|g' actual.sarif
4747
# Convert Windows paths to forward slashes
4848
sed -i 's|\\|/|g' actual.sarif
49+
50+
# Windows-specific: Ensure the SARIF file is properly terminated
51+
# Remove any trailing commas and ensure proper JSON structure
52+
sed -i 's/,\s*$//' actual.sarif
53+
# Ensure the file ends with proper JSON closing brackets
54+
if ! grep -q '^}$' actual.sarif; then
55+
echo "}" >> actual.sarif
56+
fi
4957
else
5058
# Linux
5159
sed -i 's|file:///home/runner/work/codacy-cli-v2/codacy-cli-v2/|file:///|g' actual.sarif
5260
sed -i 's|/home/runner/work/codacy-cli-v2/codacy-cli-v2/|/|g' actual.sarif
5361
fi
5462

55-
5663
# Sort all fields in both files, handling null rules array
57-
echo "📊 Sorting SARIF outputs..."
58-
jq --sort-keys 'if .runs[0].tool.driver.rules == null then . else .runs[0].tool.driver.rules |= sort_by(.id) end' "$EXPECTED_SARIF" > expected.sorted.json || { echo "Failed to sort expected SARIF"; exit 1; }
59-
jq --sort-keys 'if .runs[0].tool.driver.rules == null then . else .runs[0].tool.driver.rules |= sort_by(.id) end' actual.sarif > actual.sorted.json || { echo "Failed to sort actual SARIF"; exit 1; }
64+
if [[ "$OSTYPE" == "msys"* ]] || [[ "$OSTYPE" == "cygwin"* ]]; then
65+
# Windows-specific: Validate JSON before processing
66+
if ! jq '.' actual.sarif > /dev/null 2>&1; then
67+
echo "Error: Invalid JSON in actual.sarif"
68+
cat actual.sarif
69+
exit 1
70+
fi
71+
fi
72+
73+
jq --sort-keys 'if .runs[0].tool.driver.rules == null then . else .runs[0].tool.driver.rules |= sort_by(.id) end' "$EXPECTED_SARIF" > expected.sorted.json
74+
jq --sort-keys 'if .runs[0].tool.driver.rules == null then . else .runs[0].tool.driver.rules |= sort_by(.id) end' actual.sarif > actual.sorted.json
6075

6176
# Normalize paths in both files
6277
if [[ "$OSTYPE" == "darwin"* ]]; then

0 commit comments

Comments
 (0)