Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/scripts/run_tests_coverage/run
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,17 @@ main() {
exit 0
fi

mkdir -p artifacts
coverage=''
for package in ${directories}; do
# For each package, extract coverage values from the respective coverage report:
pkg=$(echo "$package" | sed -E 's/^.*stdlib\///')

# Skip packages which do not have a test directory, as `make test-javascript-cov` fails when a `TESTS_FILTER` matches zero files:
if [ ! -d "lib/node_modules/@stdlib/${pkg}/test" ]; then
echo "WARNING: No test directory found for package '${pkg}'. Skipping..." >&2
continue
fi

if [ -f "lib/node_modules/@stdlib/${pkg}/binding.gyp" ]; then
NODE_ADDONS_PATTERN="${pkg}" make install-node-addons
fi
Expand Down Expand Up @@ -195,10 +200,14 @@ main() {
rm -rf reports/coverage/lcov-report/*
done

# Format coverage as Markdown table row:
table_body=$(echo "$coverage" | sed -e 's/,/|/g; s/"/ /g; s/\[/|/g; s/\]/|/g')
table_header="| Package | Statements | Branches | Functions | Lines |\n| --------- | ------------ | ---------- | ----------- | ----- |"
table="${table_header}${table_body}"
# Format coverage as a Markdown table row, unless every changed package was skipped (e.g., no package had a test directory):
if [ -z "$coverage" ]; then
table=''
else
table_body=$(echo "$coverage" | sed -e 's/,/|/g; s/"/ /g; s/\[/|/g; s/\]/|/g')
table_header="| Package | Statements | Branches | Functions | Lines |\n| --------- | ------------ | ---------- | ----------- | ----- |"
table="${table_header}${table_body}"
fi

echo "table=$table" >> "$GITHUB_OUTPUT"

Expand Down
Loading