Skip to content
Closed
Show file tree
Hide file tree
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
52 changes: 12 additions & 40 deletions .github/workflows/scripts/run_tests_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,8 @@
# file2 File name.
# file3 File name.
#
#
# Environment variables:
#
# GITHUB_REPO GitHub repository.
# GITHUB_REF GitHub branch or tag.
# LOG_FILE Log file.
#

# shellcheck disable=SC2181,SC2153,SC2129
# shellcheck disable=SC2181,SC2153,SC2129,SC2207,SC2317

# Ensure that the exit status of pipelines is non-zero in the event that at least one of the commands in a pipeline fails:
set -o pipefail
Expand All @@ -48,15 +41,6 @@ coverage_base_url="${COVERAGE_BASE_URL:-https://coverage.stdlib.io}"
# Get the list of changed files:
changed="$*"

# Get the GitHub repository:
github_repo="${GITHUB_REPO}"

# Get the GitHub branch or tag:
github_ref="${GITHUB_REF}"

# Get the path to a log file as the third argument to the build script:
log_file="${LOG_FILE}"

# Define a heartbeat interval to periodically print messages in order to prevent CI from prematurely ending a build due to long running commands:
heartbeat_interval='30s'

Expand Down Expand Up @@ -125,18 +109,18 @@ compare_cov() {

if [ "$old_cov_value" == 0 ]; then
new_cov_percentage=$(awk "BEGIN {printf \"%.2f\", $new_cov_value*100}")
echo "\$\\\\\\\\color{green}+$new_cov_percentage\\\\\\\\\\\\\\\\%\$"
printf "\$\\\\\\\\color{green}+%s\\\\\\\\\\\\\\\\%%\$\n" "$new_cov_percentage"
else
percentage_change=$(awk "BEGIN {printf \"%.2f\", (($new_cov_value - $old_cov_value) / $old_cov_value) * 100}")
color="green"
sign=""
if [ $(awk "BEGIN {if ($percentage_change >= 0) print 1; else print 0}") -eq 1 ]; then
if [ "$(awk "BEGIN {if ($percentage_change >= 0) print 1; else print 0}")" -eq 1 ]; then
sign="+"
elif [ $(awk "BEGIN {if ($percentage_change < 0) print 1; else print 0}") -eq 1 ]; then
elif [ "$(awk "BEGIN {if ($percentage_change < 0) print 1; else print 0}")" -eq 1 ]; then
sign="-"
color="red"
fi
echo "\$\\\\\\\\color{$color}$sign$percentage_change\\\\\\\\\\\\\\\\%\$"
printf "\$\\\\\\\\color{%s}%s%s\\\\\\\\\\\\\\\\%%\$\n" "$color" "$sign" "$percentage_change"
fi
}

Expand All @@ -163,23 +147,15 @@ main() {
coverage=''
for package in ${directories}; do
# For each package, extract coverage values from the respective coverage report:
pkg=`echo $package | sed -E 's/^.*stdlib\///'`
pkg=$(echo "$package" | sed -E 's/^.*stdlib\///')

if [ -f "lib/node_modules/@stdlib/${pkg}/binding.gyp" ]; then
NODE_ADDONS_PATTERN="${pkg}" make install-node-addons
fi

make test-javascript-cov TESTS_FILTER=".*/${pkg}/test/.*"
make test-javascript-cov TESTS_FILTER=".*/${pkg}/test/.*" C8_FLAGS="-n 'lib/node_modules/@stdlib/${pkg}/**'"

if [ ! -f reports/coverage/lcov-report/${pkg}/lib/index.html ]; then
# Reports for packages with no dependencies are stored in the `lcov-report` directory
coverage_path="reports/coverage/lcov-report/index.html"
top_level_report=true
else
# Reports for packages with dependencies are stored in `lcov-report/<pkg>/lib`:
coverage_path="reports/coverage/lcov-report/${pkg}/lib/index.html"
top_level_report=false
fi
coverage_path="reports/coverage/lcov-report/index.html"
pkg_cov_values=($(cat $coverage_path | grep "fraction" | grep -oP '\d+/\d+' | awk -F'/' '{if ($2 != 0) print $1/$2; else print 1}'))
pkg_statements_cov=${pkg_cov_values[0]}
pkg_branches_cov=${pkg_cov_values[1]}
Expand Down Expand Up @@ -214,26 +190,22 @@ main() {
pkg_cov="| $pkg_statements_cov_fraction <br> $cov_change_statements | $pkg_branches_cov_fraction <br> $cov_change_branches | $pkg_functions_cov_fraction <br> $cov_change_functions | $pkg_lines_cov_fraction <br> $cov_change_lines |"

pkg_url="${coverage_base_url}/${pkg}/index.html"
pkg_link="<a href=\"$pkg_url\">$pkg</a>"
pkg_link="<a href=\"${pkg_url}\">${pkg}</a>"
coverage="$coverage\n| $pkg_link $pkg_cov"

# Copy coverage report of the package to artifacts directory:
if [ "$top_level_report" = true ]; then
mkdir -p "artifacts/${pkg}" && cp -r "reports/coverage/lcov-report"/* "artifacts/${pkg}/"
else
mkdir -p "artifacts/${pkg}/lib/" && cp -r "reports/coverage/lcov-report/${pkg}/lib"/* "artifacts/${pkg}/"
fi
mkdir -p "artifacts/${pkg}" && cp -r "reports/coverage/lcov-report"/* "artifacts/${pkg}/"

# Cleanup coverage reports for next package:
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_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}"

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

cleanup
print_success
Expand Down
30 changes: 28 additions & 2 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,17 @@ Frank Kovacs <fran70kk@gmail.com> <fkovacs@andrew.cmu.edu>

# G

Gaurav Jadhav <gaurav70380@gmail.com> Gaurav

Gaurav Kaushik <144526331+Gauravkaushik-1206@users.noreply.github.com> Gauravkaushik-1206

Gautam Kaushik <162317291+Kaushikgtm@users.noreply.github.com> Kaushikgtm

Geo Daoyu <geodaoyu@foxmail.com> GeoDaoyu

GittyHarsha <hnarayana788@gmail.com>
Gitty Harsha <hnarayana788@gmail.com> <96897754+GittyHarsha@users.noreply.github.com>
Gitty Harsha <hnarayana788@gmail.com> HarshaNP
Gitty Harsha <hnarayana788@gmail.com> GittyHarsha

Golden Kumar <103646877+AuenKr@users.noreply.github.com> Golden
Golden Kumar <103646877+AuenKr@users.noreply.github.com> AuenKr
Expand All @@ -170,22 +174,44 @@ Gururaj Gurram <gururajgurram1512@gmail.com> gururaj1512

# H

Harsh <harshyadav6078@gmail.com> <149176984+hrshya@users.noreply.github.com>
Haroon Rasheed <51189276+haroon26@users.noreply.github.com> haroon26

Harsh Yadav <harshyadav6078@gmail.com> <149176984+hrshya@users.noreply.github.com>
Harsh Yadav <harshyadav6078@gmail.com> hrshya

Harshita Kalani <harshitakalani02@gmail.com> <95532771+HarshitaKalani@users.noreply.github.com>

Hemant M Mehta <92446645+hemantmm@users.noreply.github.com> hemantmm

Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com> HRIDYANSHU054

# I

Iryna Andrushko <ira.andrushko2@gmail.com> <71790513+iraandrushko@users.noreply.github.com>
Iryna Andrushko <ira.andrushko2@gmail.com> iraandrushko

# J

Jaimin Godhani <112328542+Jai0401@users.noreply.github.com> Jai0401

Jaison Dsouza <jaisondz9360@gmail.com> <123267719+jsndz@users.noreply.github.com>
Jaison Dsouza <jaisondz9360@gmail.com> Jaison D Souza
Jaison Dsouza <jaisondz9360@gmail.com> jsndz

Jalaj Kumar <142599224+jalajk3004@users.noreply.github.com> jalajk3004

James Gelok <jdgelok@gmail.com> James

Jay Soni <jaygsoni14@gmail.com> JaySoni1

Jaysukh Makvana <jaysukhmakvana2004@gmail.com> <111515433+Jaysukh-409@users.noreply.github.com>

Jenish Thapa <141203631+jenish-thapa@users.noreply.github.com> jenish-thapa

Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> Jordan-Gallivan

Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com> ShelbyJustyn

# K

Kaif Mohd <mdkaifprofession@gmail.com>
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,28 @@ Ekampreet Singh Bains <bainsinbusiness@gmail.com>
Eunice Sim <77243938+EuniceSim142@users.noreply.github.com>
Fadio <48636283+fadiothman22@users.noreply.github.com>
Frank Kovacs <fran70kk@gmail.com>
Gaurav <gaurav70380@gmail.com>
Gaurav Jadhav <gaurav70380@gmail.com>
Gaurav Kaushik <144526331+Gauravkaushik-1206@users.noreply.github.com>
Gautam Kaushik <162317291+Kaushikgtm@users.noreply.github.com>
Gautam sharma <gautamkrishnasharma1@gmail.com>
Geo Daoyu <geodaoyu@foxmail.com>
Girish Garg <garggirish2020@gmail.com>
Gitty Harsha <hnarayana788@gmail.com>
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
Gopi Kishan <gkishan1kyt@gmail.com>
Gunj Joshi <gunjjoshi8372@gmail.com>
Guru Prasad Sharma <168292003+GURUPRASADSHARMA@users.noreply.github.com>
Gururaj Gurram <gururajgurram1512@gmail.com>
Harishchandra Reddy <harish.7000@gmail.com>
Haroon Rasheed <51189276+haroon26@users.noreply.github.com>
Harsh <harshyadav6078@gmail.com>
HarshaNP <96897754+GittyHarsha@users.noreply.github.com>
Harsh Yadav <harshyadav6078@gmail.com>
Harshita Kalani <harshitakalani02@gmail.com>
Hemang Choudhary <coehemang@gmail.com>
Hemant M Mehta <92446645+hemantmm@users.noreply.github.com>
Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com>
iraandrushko <71790513+iraandrushko@users.noreply.github.com>
Iryna Andrushko <ira.andrushko2@gmail.com>
Jaimin Godhani <112328542+Jai0401@users.noreply.github.com>
Jaison D Souza <123267719+jsndz@users.noreply.github.com>
Jaison Dsouza <jaisondz9360@gmail.com>
Jalaj Kumar <142599224+jalajk3004@users.noreply.github.com>
James Gelok <jdgelok@gmail.com>
Jay Soni <jaygsoni14@gmail.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

var resolve = require( 'path' ).resolve;
var exec = require( 'child_process' ).exec;
var execFile = require( 'child_process' ).execFile;
var tape = require( 'tape' );
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
Expand Down Expand Up @@ -62,7 +63,7 @@ tape( 'when invoked with a `--help` flag, the command-line interface prints the
'--help'
];

exec( cmd.join( ' ' ), done );
execFile( cmd[ 0 ], cmd.slice( 1 ), done );

function done( error, stdout, stderr ) {
if ( error ) {
Expand All @@ -88,7 +89,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
'-h'
];

exec( cmd.join( ' ' ), done );
execFile( cmd[ 0 ], cmd.slice( 1 ), done );

function done( error, stdout, stderr ) {
if ( error ) {
Expand All @@ -108,7 +109,7 @@ tape( 'when invoked with a `--version` flag, the command-line interface prints t
'--version'
];

exec( cmd.join( ' ' ), done );
execFile( cmd[ 0 ], cmd.slice( 1 ), done );

function done( error, stdout, stderr ) {
if ( error ) {
Expand All @@ -128,7 +129,7 @@ tape( 'when invoked with a `-V` flag, the command-line interface prints the vers
'-V'
];

exec( cmd.join( ' ' ), done );
execFile( cmd[ 0 ], cmd.slice( 1 ), done );

function done( error, stdout, stderr ) {
if ( error ) {
Expand Down
20 changes: 17 additions & 3 deletions lib/node_modules/@stdlib/_tools/bib/citation-reference/lib/sync.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
Expand Down Expand Up @@ -110,8 +110,22 @@ function toReference( id, options ) {
'cwd': cwd()
};
debug( 'Converting temporary input file...' );
data = exec( cmd, eopts );
debug( 'Successfully converted temporary input file.' );
try {
data = exec( cmd, eopts );
debug( 'Successfully converted temporary input file.' );
} catch ( e ) {
// If the conversion command fails (e.g., pandoc not installed),
// create an empty output file so downstream processing can continue
// and produce a deterministic (empty) result for doctest/lint runs.
debug( 'Conversion command failed: %s', e.message );
try {
writeFile( outFile, '' );
debug( 'Wrote empty temporary output file due to conversion failure.' );
} catch ( e2 ) {
// If we cannot create an output file, rethrow the original error.
throw e;
}
}

rm( inFile );

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* @license Apache-2.0
*
* Copyright (c) 2022 The Stdlib Authors.
Expand All @@ -21,6 +21,7 @@
// MODULES //

var execSync = require( 'child_process' ).execSync;
var execFileSync = require( 'child_process' ).execFileSync;
var replace = require( '@stdlib/string/replace' );


Expand Down Expand Up @@ -82,31 +83,32 @@ function main( context ) {
* @private
*/
function validate() {
var comments;
var expected;
var comment;
var match;
var year;

comments = source.getAllComments();
if ( comments.length === 0 ) {
var allComments;
var expected;
var comment;
var match;
var year;

allComments = source.getAllComments();
if ( allComments.length === 0 ) {
return;
}
comment = comments[ 0 ];
comment = allComments[ 0 ];
match = RE_COPYRIGHT.exec( comment.value );
if ( match ) {
year = match[ 1 ];

// Use `git` to determine the year the file was created...
try {
expected = execSync( 'git log --diff-filter=A --follow --format=%ad --date=short -- '+filename, {
// Use execFileSync with argument array to avoid shell word-splitting for paths
expected = execFileSync( 'git', [ 'log', '--diff-filter=A', '--follow', '--format=%ad', '--date=short', '--', filename ], {
'encoding': 'utf8'
});
expected = expected.split( '-' )[ 0 ];
if ( year !== expected ) {
report( 'Expected year to be '+expected+' and not '+year, comment, expected );
}
} catch ( err ) {
} catch ( _err ) {
// Do nothing if unable to determine the year the file was created (e.g., if the file is not tracked yet by `git`).
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ function copy1( arr ) {

len = arr.length;
if ( len > MAX_FAST_ELEMENTS_HEURISTIC ) {
out = new Array( MAX_FAST_ELEMENTS_HEURISTIC );
out = [];
for ( i = 0; i < MAX_FAST_ELEMENTS_HEURISTIC; i++ ) {
out[ i ] = arr[ i ];
}
for ( i = MAX_FAST_ELEMENTS_HEURISTIC; i < len; i++ ) {
out.push( arr[ i ] );
}
} else {
out = new Array( len );
out = [];
for ( i = 0; i < len; i++ ) {
out[ i ] = arr[ i ];
}
Expand All @@ -89,7 +89,7 @@ function copy2( arr ) {
var i;

len = arr.length;
out = new Array( len );
out = [];
for ( i = 0; i < len; i++ ) {
out[ i ] = arr[ i ];
}
Expand Down
2 changes: 0 additions & 2 deletions lib/node_modules/@stdlib/assert/is-even/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* limitations under the License.
*/

/* eslint-disable no-new-wrappers */

'use strict';

var Number = require( '@stdlib/number/ctor' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* limitations under the License.
*/

/* eslint-disable no-new-wrappers */

'use strict';

var Number = require( '@stdlib/number/ctor' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

/* eslint-disable no-new-wrappers, stdlib/no-redeclare */
/* eslint-disable stdlib/no-redeclare */

'use strict';

Expand Down
Loading