Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Nov 21, 2024
1 parent 98bb295 commit a5e7663
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 87 deletions.
1 change: 0 additions & 1 deletion .github/.keepalive

This file was deleted.

105 changes: 105 additions & 0 deletions .github/workflows/test_published_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#/
# @license Apache-2.0
#
# Copyright (c) 2024 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#/

# Workflow name:
name: test_published_package

# Workflow triggers:
on:
# Run workflow on a weekly schedule:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '59 23 * * 4'

# Run workflow upon completion of `publish` workflow run:
workflow_run:
workflows: ["publish"]
types: [completed]

# Allow workflow to be manually run:
workflow_dispatch:

# Workflow jobs:
jobs:
test-published:
# Define a display name:
name: 'Test running examples of published package'

# Define the type of virtual host machine:
runs-on: ubuntu-latest

# Define environment variables:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

# Run workflow job if `publish` workflow run is successful or when the workflow is manually run:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}

# Define the job's steps:
steps:
# Checkout the repository:
- name: 'Checkout repository'
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

# Install Node.js:
- name: 'Install Node.js'
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 20
timeout-minutes: 5

# Create test directory and run examples:
- name: 'Create test directory and run examples'
run: |
cd ..
mkdir test-published
cd test-published
# Copy example file:
cp $GITHUB_WORKSPACE/examples/index.js .
# Create a minimal package.json
echo '{
"name": "test-published",
"version": "1.0.0",
"main": "index.js",
"dependencies": {}
}' > package.json
# Get package name and modify example file:
PACKAGE_NAME=$(jq -r '.name' $GITHUB_WORKSPACE/package.json)
ESCAPED_PACKAGE_NAME=$(echo "$PACKAGE_NAME" | sed 's/[\/&]/\\&/g')
sed -i "s/require( '.\/..\/lib' )/require( '$ESCAPED_PACKAGE_NAME' )/g" index.js
# Extract and install dependencies:
DEPS=$(grep -oP "require\(\s*'([^']+)'\s*\)" index.js | sed "s/require(\s*'//" | sed "s/'\s*)//" | grep -v "^\.")
for dep in $DEPS; do
npm install $dep --save
done
# Run the example:
node index.js
# Send Slack notification if job fails:
- name: 'Send notification to Slack in case of failure'
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
channel: '#npm-ci'
if: failure()
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,40 @@

> Package changelog.
<section class="release" id="unreleased">

## Unreleased (2024-11-21)

<section class="commits">

### Commits

<details>

- [`c660c70`](https://github.com/stdlib-js/stdlib/commit/c660c705bb3478f4fb6cb818c9b1d3429e8a6774) - **chore:** use correct `Makefile` and update benchmarks in `math/base/special/csch` [(#3209)](https://github.com/stdlib-js/stdlib/pull/3209) _(by Gunj Joshi)_

</details>

</section>

<!-- /.commits -->

<section class="contributors">

### Contributors

A total of 1 person contributed to this release. Thank you to this contributor:

- Gunj Joshi

</section>

<!-- /.contributors -->

</section>

<!-- /.release -->

<section class="release" id="v0.3.0">

## 0.3.0 (2024-07-28)
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Mohammad Kaif <98884589+Kaif987@users.noreply.github.com>
Momtchil Momtchev <momtchil@momtchev.com>
Muhammad Haris <harriskhan047@outlook.com>
Naresh Jagadeesan <naresh.naresh000@gmail.com>
Neeraj Pathak <neerajrpathak710@gmail.com>
NightKnight <Ahmedatwa866@yahoo.com>
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
Expand All @@ -69,6 +70,7 @@ Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
Pranav Goswami <goswami.4@iitj.ac.in>
Praneki <97080887+PraneGIT@users.noreply.github.com>
Pratik <97464067+Pratik772846@users.noreply.github.com>
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
Priyansh <88396544+itsspriyansh@users.noreply.github.com>
Pushpendra Chandravanshi <pushpendrachandravanshi4@gmail.com>
RISHAV <115060907+rishav2404@users.noreply.github.com>
Expand All @@ -79,9 +81,11 @@ Ridam Garg <67867319+RidamGarg@users.noreply.github.com>
Robert Gislason <gztown2216@yahoo.com>
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
Rutam <138517416+performant23@users.noreply.github.com>
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
Ryan Seal <splrk@users.noreply.github.com>
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
SarthakPaandey <145528240+SarthakPaandey@users.noreply.github.com>
Saurabh Singh <saurabhsraghuvanshi@gmail.com>
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
Shivam <11shivam00@gmail.com>
Expand Down
7 changes: 4 additions & 3 deletions benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench-harness' );
var randu = require( '@stdlib/random-base-randu' );
var randu = require( '@stdlib/random-array-uniform' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var pkg = require( './../package.json' ).name;
var csch = require( './../lib' );
Expand All @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) {
var y;
var i;

x = randu( 100, -5.0, 5.0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*10.0 ) - 5.0;
y = csch( x );
y = csch( x[ i % x.length ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
7 changes: 4 additions & 3 deletions benchmark/benchmark.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench-harness' );
var randu = require( '@stdlib/random-base-randu' );
var randu = require( '@stdlib/random-array-uniform' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var tryRequire = require( '@stdlib/utils-try-require' );
var pkg = require( './../package.json' ).name;
Expand All @@ -43,10 +43,11 @@ bench( pkg+'::native', opts, function benchmark( b ) {
var y;
var i;

x = randu( 100, -5.0, 5.0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu() * 10.0 ) - 5.0;
y = csch( x );
y = csch( x[ i % x.length ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
9 changes: 6 additions & 3 deletions benchmark/c/native/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,18 @@ static double rand_double( void ) {
*/
static double benchmark( void ) {
double elapsed;
double x;
double x[ 100 ];
double y;
double t;
int i;

for ( i = 0; i < 100; i++ ) {
x[ i ] = ( 10.0 * rand_double() ) - 5.0;
}

t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
x = ( 10.0 * rand_double() ) - 5.0;
y = stdlib_base_csch( x );
y = stdlib_base_csch( x[ i % 100 ] );
if ( y != y ) {
printf( "should not return NaN\n" );
break;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@stdlib/math-base-assert-is-negative-zero": "^0.2.2",
"@stdlib/math-base-assert-is-positive-zero": "^0.2.2",
"@stdlib/math-base-special-abs": "^0.2.2",
"@stdlib/random-array-uniform": "^0.2.1",
"@stdlib/random-base-randu": "^0.2.1",
"@stdlib/utils-try-require": "^0.2.2",
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
Expand Down
64 changes: 1 addition & 63 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#/
# @license Apache-2.0
#
# Copyright (c) 2024 The Stdlib Authors.
Expand Down Expand Up @@ -45,69 +46,6 @@ endif
endif


# RULES #

#/
# Removes generated files for building an add-on.
#
# @example
# make clean-addon
#/
clean-addon:
$(QUIET) -rm -f *.o *.node

.PHONY: clean-addon

#/
# Removes generated files.
#
# @example
# make clean
#/
clean: clean-addon

.PHONY: clean
copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#/

# VARIABLES #

ifndef VERBOSE
QUIET := @
else
QUIET :=
endif

# Determine the OS ([1][1], [2][2]).
#
# [1]: https://en.wikipedia.org/wiki/Uname#Examples
# [2]: http://stackoverflow.com/a/27776822/2225624
OS ?= $(shell uname)
ifneq (, $(findstring MINGW,$(OS)))
OS := WINNT
else
ifneq (, $(findstring MSYS,$(OS)))
OS := WINNT
else
ifneq (, $(findstring CYGWIN,$(OS)))
OS := WINNT
else
ifneq (, $(findstring Windows_NT,$(OS)))
OS := WINNT
endif
endif
endif
endif


# RULES #

#/
Expand Down
14 changes: 7 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,31 +171,31 @@ tape( 'the function computes the hyperbolic cosecant (tiny positive)', function

tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) {
var v = csch( NaN );
t.equal( isnan( v ), true, 'returns NaN' );
t.equal( isnan( v ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `+Infinity` if provided `+0.0`', function test( t ) {
var v = csch( +0.0 );
t.equal( v, PINF, 'returns +Infinity' );
t.equal( v, PINF, 'returns expected value' );
t.end();
});

tape( 'the function returns `-Infinity` if provided `-0.0`', function test( t ) {
var v = csch( -0.0 );
t.equal( v, NINF, 'returns -Infinity' );
t.equal( v, NINF, 'returns expected value' );
t.end();
});

tape( 'the function returns `+0.0` if provided `+Infinity`', function test( t ) {
var v = csch( PINF );
t.equal( isPositiveZero(v), true, 'returns +0.0' );
t.equal( isPositiveZero(v), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `-0.0` if provided `-Infinity`', function test( t ) {
var v = csch( NINF );
t.equal( isNegativeZero(v), true, 'returns -0.0' );
t.equal( isNegativeZero(v), true, 'returns expected value' );
t.end();
});

Expand All @@ -207,7 +207,7 @@ tape( 'the function returns `+0.0` if provided a value greater than `~710.476`',
for ( i = 0; i < 500; i++ ) {
v = ( randu()*1e6 ) + 710.476;
y = csch( v );
t.equal( isPositiveZero( y ), true, 'returns +0.0' );
t.equal( isPositiveZero( y ), true, 'returns expected value' );
}
t.end();
});
Expand All @@ -220,7 +220,7 @@ tape( 'the function returns `-0.0` if provided a value less than `~-709.0896`',
for ( i = 0; i < 500; i++ ) {
v = ( -randu()*1e6 ) - 709.0896;
y = csch( v );
t.equal( isNegativeZero( y ), true, 'returns -0.0' );
t.equal( isNegativeZero( y ), true, 'returns expected value' );
}
t.end();
});
Loading

0 comments on commit a5e7663

Please sign in to comment.