Skip to content

Commit c4f9748

Browse files
committed
Auto-generated commit
1 parent e0b6235 commit c4f9748

File tree

4 files changed

+173
-22
lines changed

4 files changed

+173
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2024 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Workflow name:
20+
name: test_published_package
21+
22+
# Workflow triggers:
23+
on:
24+
# Run workflow on a weekly schedule:
25+
schedule:
26+
# * is a special character in YAML so you have to quote this string
27+
- cron: '33 9 * * 2'
28+
29+
# Run workflow upon completion of `publish` workflow run:
30+
workflow_run:
31+
workflows: ["publish"]
32+
types: [completed]
33+
34+
# Allow workflow to be manually run:
35+
workflow_dispatch:
36+
37+
# Workflow jobs:
38+
jobs:
39+
test-published:
40+
# Define a display name:
41+
name: 'Test running examples of published package'
42+
43+
# Define the type of virtual host machine:
44+
runs-on: ubuntu-latest
45+
46+
# Define environment variables:
47+
env:
48+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
49+
50+
# Run workflow job if `publish` workflow run is successful or when the workflow is manually run:
51+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
52+
53+
# Define the job's steps:
54+
steps:
55+
# Checkout the repository:
56+
- name: 'Checkout repository'
57+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
58+
59+
# Install Node.js:
60+
- name: 'Install Node.js'
61+
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
62+
with:
63+
node-version: 20
64+
timeout-minutes: 5
65+
66+
# Create test directory and run examples:
67+
- name: 'Create test directory and run examples'
68+
run: |
69+
cd ..
70+
mkdir test-published
71+
cd test-published
72+
73+
# Copy example file:
74+
cp $GITHUB_WORKSPACE/examples/index.js .
75+
76+
# Create a minimal package.json
77+
echo '{
78+
"name": "test-published",
79+
"version": "1.0.0",
80+
"main": "index.js",
81+
"dependencies": {}
82+
}' > package.json
83+
84+
# Get package name and modify example file:
85+
PACKAGE_NAME=$(jq -r '.name' $GITHUB_WORKSPACE/package.json)
86+
ESCAPED_PACKAGE_NAME=$(echo "$PACKAGE_NAME" | sed 's/[\/&]/\\&/g')
87+
88+
sed -i "s/require( '.\/..\/lib' )/require( '$ESCAPED_PACKAGE_NAME' )/g" index.js
89+
90+
# Extract and install dependencies:
91+
DEPS=$(grep -oP "require\(\s*'([^']+)'\s*\)" index.js | sed "s/require(\s*'//" | sed "s/'\s*)//" | grep -v "^\.")
92+
for dep in $DEPS; do
93+
npm install $dep --save
94+
done
95+
96+
# Run the example:
97+
node index.js
98+
99+
# Send Slack notification if job fails:
100+
- name: 'Send notification to Slack in case of failure'
101+
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
102+
with:
103+
status: ${{ job.status }}
104+
channel: '#npm-ci'
105+
if: failure()

CHANGELOG.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-11-10)
7+
## Unreleased (2024-11-24)
88

99
<section class="commits">
1010

1111
### Commits
1212

1313
<details>
1414

15+
- [`ac4992b`](https://github.com/stdlib-js/stdlib/commit/ac4992b3eeccbfcceea795f86cf669b2481d8250) - **chore:** update to modern benchmark Makefile _(by Philipp Burckhardt)_
1516
- [`e093a4d`](https://github.com/stdlib-js/stdlib/commit/e093a4d6a41d7686cc780fd1935bd925ccbbe155) - **refactor:** use external constant and update license in `math/base/special/pow` [(#3082)](https://github.com/stdlib-js/stdlib/pull/3082) _(by Gunj Joshi)_
1617
- [`177f16c`](https://github.com/stdlib-js/stdlib/commit/177f16cd80b9072714e7b4e976487e5e6dd19761) - **chore:** update package meta data [(#2933)](https://github.com/stdlib-js/stdlib/pull/2933) _(by stdlib-bot, Athan Reines)_
1718
- [`f51140f`](https://github.com/stdlib-js/stdlib/commit/f51140ffe79720148d77a5ea56e92911787a3175) - **chore:** add structured package data for `math/base/special/pow` [(#2912)](https://github.com/stdlib-js/stdlib/pull/2912) _(by Gunj Joshi)_
@@ -26,10 +27,11 @@
2627

2728
### Contributors
2829

29-
A total of 2 people contributed to this release. Thank you to the following contributors:
30+
A total of 3 people contributed to this release. Thank you to the following contributors:
3031

3132
- Athan Reines
3233
- Gunj Joshi
34+
- Philipp Burckhardt
3335

3436
</section>
3537

CONTRIBUTORS

+5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Mohammad Kaif <[email protected]>
5959
Momtchil Momtchev <[email protected]>
6060
Muhammad Haris <[email protected]>
6161
Naresh Jagadeesan <[email protected]>
62+
Neeraj Pathak <[email protected]>
6263
NightKnight <[email protected]>
6364
Nithin Katta <[email protected]>
6465
Nourhan Hasan <[email protected]>
@@ -69,6 +70,7 @@ Prajwal Kulkarni <[email protected]>
6970
Pranav Goswami <[email protected]>
7071
7172
73+
Pratyush Kumar Chouhan <[email protected]>
7274
7375
Pushpendra Chandravanshi <[email protected]>
7476
@@ -79,9 +81,12 @@ Ridam Garg <[email protected]>
7981
Robert Gislason <[email protected]>
8082
Roman Stetsyk <[email protected]>
8183
84+
Ruthwik Chikoti <[email protected]>
8285
Ryan Seal <[email protected]>
86+
Rylan Yang <[email protected]>
8387
Sai Srikar Dumpeti <[email protected]>
8488
SarthakPaandey <[email protected]>
89+
Saurabh Singh <[email protected]>
8590
Seyyed Parsa Neshaei <[email protected]>
8691
Shashank Shekhar Singh <[email protected]>
8792

benchmark/c/Makefile

+59-20
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
# limitations under the License.
1717
#/
1818

19-
2019
# VARIABLES #
2120

2221
ifndef VERBOSE
2322
QUIET := @
23+
else
24+
QUIET :=
2425
endif
2526

26-
# Determine the OS:
27+
# Determine the OS ([1][1], [2][2]).
2728
#
2829
# [1]: https://en.wikipedia.org/wiki/Uname#Examples
2930
# [2]: http://stackoverflow.com/a/27776822/2225624
@@ -36,6 +37,10 @@ ifneq (, $(findstring MSYS,$(OS)))
3637
else
3738
ifneq (, $(findstring CYGWIN,$(OS)))
3839
OS := WINNT
40+
else
41+
ifneq (, $(findstring Windows_NT,$(OS)))
42+
OS := WINNT
43+
endif
3944
endif
4045
endif
4146
endif
@@ -54,7 +59,7 @@ CFLAGS ?= \
5459
-Wall \
5560
-pedantic
5661

57-
# Determine whether to generate [position independent code][1]:
62+
# Determine whether to generate position independent code ([1][1], [2][2]).
5863
#
5964
# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
6065
# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option
@@ -64,43 +69,77 @@ else
6469
fPIC ?= -fPIC
6570
endif
6671

72+
# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
73+
INCLUDE ?=
74+
75+
# List of source files:
76+
SOURCE_FILES ?=
77+
78+
# List of libraries (e.g., `-lopenblas -lpthread`):
79+
LIBRARIES ?=
80+
81+
# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
82+
LIBPATH ?=
83+
6784
# List of C targets:
6885
c_targets := benchmark.out
6986

7087

71-
# TARGETS #
88+
# RULES #
7289

73-
# Default target.
90+
#/
91+
# Compiles source files.
7492
#
75-
# This target is the default target.
76-
93+
# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
94+
# @param {string} [CFLAGS] - C compiler options
95+
# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
96+
# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`)
97+
# @param {string} [SOURCE_FILES] - list of source files
98+
# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
99+
# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`)
100+
#
101+
# @example
102+
# make
103+
#
104+
# @example
105+
# make all
106+
#/
77107
all: $(c_targets)
78108

79109
.PHONY: all
80110

81-
82-
# Compile C source.
111+
#/
112+
# Compiles C source files.
83113
#
84-
# This target compiles C source files.
85-
114+
# @private
115+
# @param {string} CC - C compiler (e.g., `gcc`)
116+
# @param {string} CFLAGS - C compiler options
117+
# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
118+
# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`)
119+
# @param {string} SOURCE_FILES - list of source files
120+
# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`)
121+
# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`)
122+
#/
86123
$(c_targets): %.out: %.c
87-
$(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm
88-
124+
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
89125

90-
# Run a benchmark.
126+
#/
127+
# Runs compiled benchmarks.
91128
#
92-
# This target runs a benchmark.
93-
129+
# @example
130+
# make run
131+
#/
94132
run: $(c_targets)
95133
$(QUIET) ./$<
96134

97135
.PHONY: run
98136

99-
100-
# Perform clean-up.
137+
#/
138+
# Removes generated files.
101139
#
102-
# This target removes generated files.
103-
140+
# @example
141+
# make clean
142+
#/
104143
clean:
105144
$(QUIET) -rm -f *.o *.out
106145

0 commit comments

Comments
 (0)