From a6109ad1590a310cb31dbb4caef92b161b33a18c Mon Sep 17 00:00:00 2001 From: Pranav Gaikwad Date: Fri, 20 Oct 2023 15:17:32 -0400 Subject: [PATCH] :ghost: improve CI (#94) * :sparkles: improve CI Signed-off-by: Pranav Gaikwad * :sparkles: update Signed-off-by: Pranav Gaikwad * sort tags Signed-off-by: Pranav Gaikwad --------- Signed-off-by: Pranav Gaikwad --- .github/workflows/testing.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index e84e54b..01cadf3 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -26,9 +26,15 @@ jobs: run: | expected_file=./test-data/analysis-output.yaml actual_file=./output/output.yaml - sed 's/^[ \t-]*//' $expected_file | sort -s > /tmp/expected_file - sed 's/^[ \t-]*//' $actual_file | sort -s > /tmp/actual_file - diff /tmp/expected_file /tmp/actual_file || diff $expected_file $actual_file + function filter_and_sort() { + yq e 'del(.[].skipped) | del(.[].unmatched)' $1 \ + | yq e '.[]?.violations |= (. | to_entries | sort_by(.key) | from_entries)' \ + | yq e '.[]?.violations[]?.incidents |= sort_by(.uri)' \ + | yq e '.[] | (.tags // []) |= sort' + } + filter_and_sort $expected_file > $expected_file + filter_and_sort $actual_file > $actual_file + diff $expected_file $actual_file - name: Fail if dependencies output does not match expected run: |