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 <[email protected]> <[email protected]>

# G

Gaurav Jadhav <[email protected]> Gaurav

Gaurav Kaushik <[email protected]> Gauravkaushik-1206

Gautam Kaushik <[email protected]> Kaushikgtm

Geo Daoyu <[email protected]> GeoDaoyu

GittyHarsha <[email protected]>
Gitty Harsha <[email protected]> <[email protected]>
Gitty Harsha <[email protected]> HarshaNP
Gitty Harsha <[email protected]> GittyHarsha

Golden Kumar <[email protected]> Golden
Golden Kumar <[email protected]> AuenKr
Expand All @@ -170,22 +174,44 @@ Gururaj Gurram <[email protected]> gururaj1512

# H

Harsh <[email protected]> <[email protected]>
Haroon Rasheed <[email protected]> haroon26

Harsh Yadav <[email protected]> <[email protected]>
Harsh Yadav <[email protected]> hrshya

Harshita Kalani <[email protected]> <[email protected]>

Hemant M Mehta <[email protected]> hemantmm

Hridyanshu <[email protected]> HRIDYANSHU054

# I

Iryna Andrushko <[email protected]> <[email protected]>
Iryna Andrushko <[email protected]> iraandrushko

# J

Jaimin Godhani <[email protected]> Jai0401

Jaison Dsouza <[email protected]> <[email protected]>
Jaison Dsouza <[email protected]> Jaison D Souza
Jaison Dsouza <[email protected]> jsndz

Jalaj Kumar <[email protected]> jalajk3004

James Gelok <[email protected]> James

Jay Soni <[email protected]> JaySoni1

Jaysukh Makvana <[email protected]> <[email protected]>

Jenish Thapa <[email protected]> jenish-thapa

Jordan Gallivan <[email protected]> Jordan-Gallivan

Justyn Shelby <[email protected]> ShelbyJustyn

# K

Kaif Mohd <[email protected]>
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 <[email protected]>
Eunice Sim <[email protected]>
Fadio <[email protected]>
Frank Kovacs <[email protected]>
Gaurav <[email protected]>
Gaurav Jadhav <[email protected]>
Gaurav Kaushik <[email protected]>
Gautam Kaushik <[email protected]>
Gautam sharma <[email protected]>
Geo Daoyu <[email protected]>
Girish Garg <[email protected]>
Gitty Harsha <[email protected]>
Golden Kumar <[email protected]>
Gopi Kishan <[email protected]>
Gunj Joshi <[email protected]>
Guru Prasad Sharma <[email protected]>
Gururaj Gurram <[email protected]>
Harishchandra Reddy <[email protected]>
Haroon Rasheed <[email protected]>
Harsh <[email protected]>
HarshaNP <[email protected]>
Harsh Yadav <[email protected]>
Harshita Kalani <[email protected]>
Hemang Choudhary <[email protected]>
Hemant M Mehta <[email protected]>
Hridyanshu <[email protected]>
iraandrushko <[email protected].com>
Iryna Andrushko <ira.andrushko2@gmail.com>
Jaimin Godhani <[email protected]>
Jaison D Souza <[email protected].com>
Jaison Dsouza <jaisondz9360@gmail.com>
Jalaj Kumar <[email protected]>
James Gelok <[email protected]>
Jay Soni <[email protected]>
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