Skip to content

Commit efac563

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into math-base-special-floornf
2 parents 590d8d0 + 2ff3d13 commit efac563

File tree

5,479 files changed

+113038
-46701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,479 files changed

+113038
-46701
lines changed

.github/workflows/pr_commands_comment.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ on:
2929
description: 'Pull request number'
3030
required: true
3131
type: number
32+
debug:
33+
description: 'Enable debug output'
34+
required: false
35+
default: false
36+
type: boolean
3237

3338
# Define the secrets accessible by the workflow:
3439
secrets:
@@ -43,6 +48,14 @@ on:
4348
description: 'Pull request number'
4449
required: true
4550
type: number
51+
debug:
52+
description: 'Enable debug output'
53+
required: false
54+
default: 'false'
55+
type: choice
56+
options:
57+
- 'true'
58+
- 'false'
4659

4760
# Global permissions:
4861
permissions:
@@ -63,11 +76,23 @@ jobs:
6376

6477
# Define the sequence of job steps...
6578
steps:
79+
# Checkout the repository:
80+
- name: 'Checkout repository'
81+
# Pin action to full length commit SHA
82+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
83+
with:
84+
# Ensure we have access to the scripts directory:
85+
sparse-checkout: |
86+
.github/workflows/scripts
87+
sparse-checkout-cone-mode: false
88+
timeout-minutes: 10
6689

6790
# Leave comment with package make command instructions:
6891
- name: 'Leave comment with package make command instructions'
6992
env:
7093
PR_NUMBER: ${{ inputs.pull_request_number }}
94+
GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN || secrets.STDLIB_BOT_PAT_REPO_WRITE }}
95+
DEBUG: ${{ inputs.debug || 'false' }}
7196
run: |
7297
. "$GITHUB_WORKSPACE/.github/workflows/scripts/package_commands_comment" "$PR_NUMBER"
7398
timeout-minutes: 30

.github/workflows/scripts/package_commands_comment

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# Environment variables:
2828
#
2929
# GITHUB_TOKEN GitHub token for authentication.
30+
# DEBUG Whether to enable verbose debug output. Default: `false`.
3031

3132
# Ensure that the exit status of pipelines is non-zero in the event that at least one of the commands in a pipeline fails:
3233
set -o pipefail
@@ -44,9 +45,22 @@ github_api_url="https://api.github.com"
4445
repo_owner="stdlib-js"
4546
repo_name="stdlib"
4647

48+
# Set debug mode:
49+
debug="${DEBUG:-false}"
50+
4751

4852
# FUNCTIONS #
4953

54+
# Prints debug messages if DEBUG environment variable is set to "true".
55+
#
56+
# $1 - debug message
57+
debug_log() {
58+
# Only print debug messages if DEBUG environment variable is set to "true":
59+
if [ "$debug" = true ]; then
60+
echo "[DEBUG] $1" >&2
61+
fi
62+
}
63+
5064
# Error handler.
5165
#
5266
# $1 - error status
@@ -70,6 +84,8 @@ github_api() {
7084
local endpoint="$2"
7185
local data="$3"
7286

87+
debug_log "Making API request: ${method} ${endpoint}"
88+
7389
# Initialize an array to hold curl headers:
7490
local headers=()
7591

@@ -117,12 +133,20 @@ main() {
117133
on_error 1
118134
fi
119135

136+
debug_log "Processing PR #${pr_number}"
137+
120138
# Fetch changed files in pull request:
121139
response=$(github_api "GET" "/repos/${repo_owner}/${repo_name}/pulls/${pr_number}/files?per_page=100")
122140
files=$(echo "${response}" | jq -r '.[] | .filename')
141+
debug_log "Found $(echo "${files}" | wc -l) changed files"
123142

124143
# Extract files associated with native add-ons:
125-
c_files=$(echo "${files}" | grep -e '/benchmark/c' -e '/examples/c' -e '/binding.gyp' -e '/include.gypi' -e '/src/')
144+
c_files=$(echo "${files}" | grep -e '/benchmark/c' -e '/examples/c' -e '/binding.gyp' -e '/include.gypi' -e '/src/' || true)
145+
if [[ -z "${c_files}" ]]; then
146+
debug_log "No native add-on files found"
147+
else
148+
debug_log "Found native add-on files: $(echo "${c_files}" | wc -l) files"
149+
fi
126150

127151
# Find unique package directories:
128152
directories=$(echo "${files}" | tr ' ' '\n' | \
@@ -133,6 +157,7 @@ main() {
133157

134158
# Extract package names from changed package directories (e.g., @stdlib/math/base/special/sin) by removing the leading 'lib/node_modules/':
135159
packages=$(echo "${directories}" | sed -E 's/^lib\/node_modules\///')
160+
debug_log "Found packages: $(echo "${packages}" | tr '\n' ' ')"
136161

137162
# Documentation links:
138163
docs_links="
@@ -148,9 +173,11 @@ main() {
148173

149174
# Count the number of packages:
150175
package_count=$(echo "${packages}" | wc -l)
176+
debug_log "Package count: ${package_count}"
151177

152178
if [[ $package_count -gt 1 ]]; then
153179
# Multiple packages case:
180+
debug_log "Multiple packages detected, generating multi-package comment"
154181
comment="Hello! 👋
155182
156183
Pro-tip: This PR changes multiple packages. You can use various \`make\` rules with \`*_FILTER\` environment variables to run tests, benchmarks, and examples for specific packages.
@@ -174,7 +201,9 @@ ${docs_links}"
174201

175202
else
176203
# Single package case:
177-
if [[ "${#c_files[@]}" -eq 0 ]]; then
204+
debug_log "Single package detected: ${packages}"
205+
if [[ -z "${c_files}" ]]; then
206+
debug_log "No C files found, generating JS-only comment"
178207
comment="Hello! 👋
179208
180209
Pro-tip: Use the \`make\` commands below during local development to ensure that all tests, examples, and benchmark files in your PR run successfully.
@@ -200,6 +229,7 @@ make examples EXAMPLES_FILTER=\".*/${packages}/.*\"
200229
\`\`\`
201230
${docs_links}"
202231
else
232+
debug_log "C files found, generating native addon comment"
203233
comment="Hello! 👋
204234
205235
Pro-tip: Use the \`make\` below commands during local development to ensure that all tests, examples, and benchmark files in your PR run successfully.
@@ -241,10 +271,12 @@ ${docs_links}"
241271
fi
242272
fi
243273

274+
debug_log "Posting comment on PR #${pr_number}"
244275
if ! github_api "POST" "/repos/${repo_owner}/${repo_name}/issues/${pr_number}/comments" "{\"body\":$(echo "${comment}" | jq -R -s -c .)}"; then
245276
echo "Failed to post comment on PR."
246277
on_error 1
247278
fi
279+
debug_log "Successfully posted comment on PR #${pr_number}"
248280

249281
print_success
250282
exit 0

CONTRIBUTORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ Ruthwik Chikoti <[email protected]>
166166
Ryan Seal <[email protected]>
167167
Rylan Yang <[email protected]>
168168
SAHIL KUMAR <[email protected]>
169+
SAUJANYA MAGARDE <[email protected]>
169170
SHIVAM YADAV <[email protected]>
170171
Sachin Raj <[email protected]>
171172
Sahil Goyal <[email protected]>
@@ -188,6 +189,7 @@ Sivam Das <[email protected]>
188189
Snehil Shah <[email protected]>
189190
Soumajit Chatterjee <[email protected]>
190191
Spandan Barve <[email protected]>
192+
Srinivas Batthula <[email protected]>
191193
Stephannie Jiménez Gacha <[email protected]>
192194
Suhaib Ilahi <[email protected]>
193195
Suraj Kumar <[email protected]>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add constants to `float64` namespace
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add `planck` distribution namespace

lib/node_modules/@stdlib/_tools/benchmarks/browser-build/test/test.validate.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var validate = require( './../lib/validate.js' );
2828

2929
tape( 'main export is a function', function test( t ) {
3030
t.ok( true, __filename );
31-
t.equal( typeof validate, 'function', 'main export is a function' );
31+
t.strictEqual( typeof validate, 'function', 'main export is a function' );
3232
t.end();
3333
});
3434

@@ -51,7 +51,7 @@ tape( 'the function returns an error if not provided an object', function test(
5151

5252
for ( i = 0; i < values.length; i++ ) {
5353
err = validate( {}, values[i] );
54-
t.equal( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
54+
t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
5555
}
5656
t.end();
5757
});
@@ -77,7 +77,7 @@ tape( 'the function returns an error if provided a `pattern` option which is not
7777
err = validate( {}, {
7878
'pattern': values[i]
7979
});
80-
t.equal( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
80+
t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
8181
}
8282
t.end();
8383
});
@@ -103,7 +103,7 @@ tape( 'the function returns an error if provided a `bundle` option which is not
103103
err = validate( {}, {
104104
'bundle': values[i]
105105
});
106-
t.equal( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
106+
t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
107107
}
108108
t.end();
109109
});
@@ -129,7 +129,7 @@ tape( 'the function returns an error if provided a `mount` option which is not a
129129
err = validate( {}, {
130130
'mount': values[i]
131131
});
132-
t.equal( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
132+
t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
133133
}
134134
t.end();
135135
});
@@ -155,7 +155,7 @@ tape( 'the function returns an error if provided an `html` option which is not a
155155
err = validate( {}, {
156156
'html': values[i]
157157
});
158-
t.equal( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
158+
t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
159159
}
160160
t.end();
161161
});
@@ -181,7 +181,7 @@ tape( 'the function returns an error if provided a `title` option which is not a
181181
err = validate( {}, {
182182
'title': values[i]
183183
});
184-
t.equal( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
184+
t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
185185
}
186186
t.end();
187187
});
@@ -201,7 +201,7 @@ tape( 'the function returns `null` if all options are valid', function test( t )
201201
};
202202

203203
err = validate( options, opts );
204-
t.equal( err, null, 'returns null' );
204+
t.strictEqual( err, null, 'returns expected value' );
205205

206206
t.deepEqual( options, opts, 'sets options' );
207207
t.end();
@@ -220,7 +220,7 @@ tape( 'the function ignores unrecognized/unsupported options', function test( t
220220
};
221221

222222
err = validate( options, opts );
223-
t.equal( err, null, 'returns null' );
223+
t.strictEqual( err, null, 'returns expected value' );
224224

225225
t.deepEqual( options, {}, 'does not set unrecognized options' );
226226
t.end();

lib/node_modules/@stdlib/_tools/benchmarks/bundle/test/test.cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ tape( 'the command-line interface generates a bundle', opts, function test( t )
167167
evil( stdout.toString() );
168168
t.fail( 'should throw an error' );
169169
} catch ( err ) {
170-
t.equal( err.message, 'BEEP', 'has expected error message' );
170+
t.strictEqual( err.message, 'BEEP', 'has expected error message' );
171171
}
172172
}
173173
t.end();
@@ -200,7 +200,7 @@ tape( 'the command-line interface supports providing a custom glob pattern', opt
200200
evil( stdout.toString() );
201201
t.fail( 'should throw an error' );
202202
} catch ( err ) {
203-
t.equal( err.message, 'BEEP', 'has expected error message' );
203+
t.strictEqual( err.message, 'BEEP', 'has expected error message' );
204204
}
205205
}
206206
t.end();

lib/node_modules/@stdlib/_tools/benchmarks/bundle/test/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var FIXTURES = join( __dirname, 'fixtures', 'main' );
4141

4242
tape( 'main export is a function', function test( t ) {
4343
t.ok( true, __filename );
44-
t.equal( typeof bundle, 'function', 'main export is a function' );
44+
t.strictEqual( typeof bundle, 'function', 'main export is a function' );
4545
t.end();
4646
});
4747

@@ -113,7 +113,7 @@ tape( 'the function generates a bundle', function test( t ) {
113113
evil( output.toString() );
114114
t.fail( 'should throw an error' );
115115
} catch ( err ) {
116-
t.equal( err.message, 'BEEP', 'has expected error message' );
116+
t.strictEqual( err.message, 'BEEP', 'has expected error message' );
117117
}
118118
}
119119
t.end();
@@ -137,7 +137,7 @@ tape( 'the function generates a bundle (custom glob pattern)', function test( t
137137
evil( output.toString() );
138138
t.fail( 'should throw an error' );
139139
} catch ( err ) {
140-
t.equal( err.message, 'BEEP', 'has expected error message' );
140+
t.strictEqual( err.message, 'BEEP', 'has expected error message' );
141141
}
142142
}
143143
t.end();
@@ -172,7 +172,7 @@ tape( 'the function supports providing an output file path', function test( t )
172172
evil( out.toString() );
173173
t.fail( 'should throw an error' );
174174
} catch ( err ) {
175-
t.equal( err.message, 'BEEP', 'has expected error message' );
175+
t.strictEqual( err.message, 'BEEP', 'has expected error message' );
176176
}
177177

178178
unlink( opath );

lib/node_modules/@stdlib/_tools/benchmarks/bundle/test/test.validate.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var validate = require( './../lib/validate.js' );
2828

2929
tape( 'main export is a function', function test( t ) {
3030
t.ok( true, __filename );
31-
t.equal( typeof validate, 'function', 'main export is a function' );
31+
t.strictEqual( typeof validate, 'function', 'main export is a function' );
3232
t.end();
3333
});
3434

@@ -51,7 +51,7 @@ tape( 'the function returns an error if not provided an object', function test(
5151

5252
for ( i = 0; i < values.length; i++ ) {
5353
err = validate( {}, values[i] );
54-
t.equal( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
54+
t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
5555
}
5656
t.end();
5757
});
@@ -77,7 +77,7 @@ tape( 'the function returns an error if provided an `out` option which is not a
7777
err = validate( {}, {
7878
'out': values[i]
7979
});
80-
t.equal( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
80+
t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
8181
}
8282
t.end();
8383
});
@@ -103,7 +103,7 @@ tape( 'the function returns an error if provided a `pattern` option which is not
103103
err = validate( {}, {
104104
'pattern': values[i]
105105
});
106-
t.equal( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
106+
t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] );
107107
}
108108
t.end();
109109
});
@@ -120,7 +120,7 @@ tape( 'the function returns `null` if all options are valid', function test( t )
120120
};
121121

122122
err = validate( options, opts );
123-
t.equal( err, null, 'returns null' );
123+
t.strictEqual( err, null, 'returns expected value' );
124124

125125
t.deepEqual( options, opts, 'sets options' );
126126
t.end();
@@ -139,7 +139,7 @@ tape( 'the function ignores unrecognized/unsupported options', function test( t
139139
};
140140

141141
err = validate( options, opts );
142-
t.equal( err, null, 'returns null' );
142+
t.strictEqual( err, null, 'returns expected value' );
143143

144144
t.deepEqual( options, {}, 'does not set unrecognized options' );
145145
t.end();

lib/node_modules/@stdlib/_tools/benchmarks/html/test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
// MODULES //
2222

23-
var tape = require( 'tape' );
2423
var join = require( 'path' ).join;
24+
var tape = require( 'tape' );
2525
var unlink = require( '@stdlib/fs/unlink' ).sync;
2626
var readFile = require( '@stdlib/fs/read-file' ).sync;
2727
var noop = require( '@stdlib/utils/noop' );
@@ -37,7 +37,7 @@ var EXPECTED = readFile( join( __dirname, 'fixtures', 'expected.txt' ) );
3737

3838
tape( 'main export is a function', function test( t ) {
3939
t.ok( true, __filename );
40-
t.equal( typeof bundle, 'function', 'main export is a function' );
40+
t.strictEqual( typeof bundle, 'function', 'main export is a function' );
4141
t.end();
4242
});
4343

0 commit comments

Comments
 (0)