Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
Signed-off-by: Tokesh <[email protected]>
  • Loading branch information
Tokesh committed Dec 29, 2024
1 parent 3f81a59 commit 6fa48e8
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,28 +144,51 @@ jobs:
jq -r -sc '
(map(.stories) | add | unique) as $stories |
(map(.files) | add | unique) as $all |
$all-$stories |
$all - $stories |
.[]
' $(find ./ -name "test-spec-coverage-*.json") test-files.json > ./coverage/files.txt
cat ./coverage/files.txt | sed -e 's/^/::error::/'
test ! -s ./coverage/files.txt || { echo "::error::Unused test files detected."; exit 1; }
- name: Collect and Display Missing Test Paths
run: |
echo "Collecting missing test paths..."
jq -r -sc '
(map(.operations) | add | unique) as $all |
(map(.evaluated_operations) | add | unique) as $evaluated |
($all-$evaluated | map({path: .path, method: .method, evaluated: false})) as $unevaluated |
($evaluated | map({path: .path, method: .method, evaluated: true})) as $evaluated |
$evaluated+$unevaluated |
sort_by(.path) |
map(if .evaluated then "- [x] \(.method) \(.path)" else "- [ ] \(.method) \(.path)" end) |
$all - $evaluated |
.[] |
"\(.method) \(.path)"
' $(find ./ -name "test-spec-coverage-*.json") > ./coverage/missing_paths.txt
cat ./coverage/missing_paths.txt
echo "Finished displaying missing paths"
- name: Verify Uniqueness of Paths and Methods
run: |
echo "Checking uniqueness of paths and methods..."
jq -r -sc '
(map(.operations) | add | map({path: .path, method: .method}) | unique) as $all_operations |
$all_operations |
map("\(.method) \(.path)") |
.[]
' $(find ./ -name "test-spec-coverage-*.json")
' $(find ./ -name "test-spec-coverage-*.json") > ./coverage/unique_operations.txt
cat ./coverage/unique_operations.txt
- name: Output Full Operations List
run: |
echo "Outputting full operations list for debugging..."
jq -r -sc '
(map(.operations) | add) as $all_operations |
$all_operations |
map("\(.method) \(.path)") |
.[]
' $(find ./ -name "test-spec-coverage-*.json") > ./coverage/all_operations.txt
cat ./coverage/all_operations.txt
- name: Combine Test Coverage Data
shell: bash -eo pipefail {0}
run: |
echo "Combining test coverage data..."
jq -sc '
(map(.operations) | add | map({path: .path, method: .method}) | unique) as $all_operations |
(map(.evaluated_operations) | add | map({path: .path, method: .method}) | unique) as $evaluated_operations |
Expand All @@ -181,9 +204,9 @@ jobs:
evaluated_operations_list: $evaluated_operations
}
' $(find ./coverage -name "test-spec-coverage-*.json") > ./coverage/coverage.json
echo "Finished combining data"
cat ./coverage/coverage.json
- name: Construct Comment Data Payload
if: github.event_name == 'pull_request'
shell: bash -eo pipefail {0}
Expand Down

0 comments on commit 6fa48e8

Please sign in to comment.