Skip to content

Commit

Permalink
Merge branch 'stdlib-js:develop' into feat/gammainc
Browse files Browse the repository at this point in the history
  • Loading branch information
DhruvArvindSingh authored Jan 25, 2025
2 parents d282ab0 + 194c6f9 commit 5937ce5
Show file tree
Hide file tree
Showing 1,499 changed files with 74,738 additions and 10,761 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/good_first_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
BODY: |
# :rotating_light: Important: PLEASE READ :rotating_light:
# :wave: Important: PLEASE READ :wave:
This issue has been labeled as a **good first issue** and is available for anyone to work on.
Expand Down
41 changes: 25 additions & 16 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,27 @@ jobs:

# Add "First-time Contributor" label if PR is from a first-time contributor:
- name: 'Add "First-time Contributor" label if PR is from a first-time contributor'
if: ${{ ( github.event.action == 'opened' || github.event.action == 'reopened' ) && github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' }}
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' }}
# Pin action to full-length commit SHA
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
script: |
const labels = context.payload.pull_request.labels.map( label => label.name );
if ( !labels.includes( 'First-time Contributor' ) ) {
await github.rest.issues.addLabels({
'owner': context.repo.owner,
'repo': context.repo.repo,
'issue_number': context.payload.pull_request.number,
'labels': [ 'First-time Contributor' ]
});
const { data: pr } = await github.rest.pulls.get({
'owner': context.repo.owner,
'repo': context.repo.repo,
'pull_number': context.payload.pull_request.number
});
if ( pr.author_association === 'FIRST_TIME_CONTRIBUTOR' ) {
const labels = context.payload.pull_request.labels.map( label => label.name );
if ( !labels.includes( 'First-time Contributor' ) ) {
await github.rest.issues.addLabels({
'owner': context.repo.owner,
'repo': context.repo.repo,
'issue_number': context.payload.pull_request.number,
'labels': [ 'First-time Contributor' ]
});
}
}
# Add "Needs Review" label when PR is opened and not a draft:
Expand Down Expand Up @@ -153,23 +160,25 @@ jobs:
}
}
# Remove "First-time Contributor" label from other open PRs if PR is merged:
- name: 'Remove "First-time Contributor" label from other open PRs if PR is merged'
# Remove "First-time Contributor" label from other open PRs of same author if PR is merged:
- name: 'Remove "First-time Contributor" label from other open PRs of same author if PR is merged'
if: ${{ github.event.action == 'closed' && github.event.pull_request.merged == true }}
# Pin action to full length commit SHA
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
script: |
const prAuthor = context.payload.pull_request.user.login;
const { owner, repo } = context.repo;
const { data: pullRequests } = await github.rest.pulls.list({
'owner': context.repo.owner,
'repo': context.repo.repo,
'state': 'open'
// Search for all open PRs from the PR author:
const query = `repo:${owner}/${repo} type:pr state:open author:${prAuthor}`;
const response = await github.rest.search.issuesAndPullRequests({
'q': query,
'per_page': 100
});
// Remove "First-time Contributor" label from any other open PRs by the same author:
const pullRequests = response.data.items;
for ( const pull of pullRequests ) {
if ( pull.user.login === prAuthor ) {
try {
Expand Down
44 changes: 25 additions & 19 deletions .github/workflows/run_affected_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ on:
# List paths for which changes should trigger this workflow:
- 'lib/**/benchmark/**'

workflow_dispatch:
inputs:
directories:
description: 'List of changed directories for which to run affected benchmarks (space-separated)'

# Global permissions:
permissions:
# Allow read-only access to the repository contents:
Expand Down Expand Up @@ -103,9 +108,10 @@ jobs:
make init
timeout-minutes: 5

# Get list of changed files:
- name: 'Get list of changed files'
id: changed-files
# Get list of changed directories from PR and push events:
- name: 'Get list of changed directories'
if: github.event_name != 'workflow_dispatch'
id: changed-directories
continue-on-error: true
run: |
if [ -n "${{ github.event.pull_request.number }}" ]; then
Expand All @@ -120,24 +126,24 @@ jobs:
files=$(git diff --diff-filter=AM --name-only ${{ github.event.before }} ${{ github.event.after }})
fi
fi
# Keep only benchmark files:
files=$(echo "$files" | grep -E 'benchmark/' | tr '\n' ' ' | sed 's/ $//')
echo "files=${files}" >> $GITHUB_OUTPUT
directories=$(for file in $files; do dirname $file; done | uniq | tr '\n' ' ' | sed 's/ $//')
echo "directories=${directories}" >> $GITHUB_OUTPUT
# Run JavaScript benchmarks:
- name: 'Run JavaScript benchmarks'
# Get list of changed directories from workflow dispatch event:
- name: 'Get list of changed directories (from user input)'
if: github.event_name == 'workflow_dispatch'
id: changed-directories-user-input
run: |
files=$(echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | grep -E '\.js$' | tr '\n' ' ' | sed 's/ $//')
if [ -n "$files" ]; then
make benchmark-javascript-files FILES="${files}"
fi
timeout-minutes: 30
echo "directories=${{ github.event.inputs.directories }}" >> $GITHUB_OUTPUT
timeout-minutes: 5

# Run C benchmarks:
- name: 'Run C benchmarks'
# Run affected benchmarks:
- name: 'Run affected benchmarks'
run: |
files=$(echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | grep -E '\.c$' | sed "s|^|${GITHUB_WORKSPACE}/|" | tr '\n' ' ' | sed 's/ $//')
if [ -n "$files" ]; then
make benchmark-c-files FILES="${files}"
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
directories="${{ steps.changed-directories-user-input.outputs.directories }}"
else
directories="${{ steps.changed-directories.outputs.directories }}"
fi
timeout-minutes: 15
. "$GITHUB_WORKSPACE/.github/workflows/scripts/run_affected_benchmarks" "$directories"
timeout-minutes: 30
163 changes: 163 additions & 0 deletions .github/workflows/scripts/run_affected_benchmarks
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#!/usr/bin/env bash
#
# @license Apache-2.0
#
# Copyright (c) 2025 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.

# Script to run affected benchmarks for a given list of changed paths.
#
# Usage: run_affected_benchmarks path1 [path2 path3 ...]
#
# Arguments:
#
# path1 File name or directory path.
# path2 File name or directory path.
# path3 File name or directory path.
#
#
# Environment variables:
#
# LOG_FILE Log file.
#

# shellcheck disable=SC2034,SC2153,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


# VARIABLES #

# Get the list of changed files:
changed="$*"

# 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'

# Declare a variable for storing the heartbeat process id:
heartbeat_pid=""


# FUNCTIONS #

# Error handler.
#
# $1 - error status
on_error() {
echo 'ERROR: An error was encountered during execution.' >&2
cleanup
exit "$1"
}

# Runs clean-up tasks.
cleanup() {
stop_heartbeat
}

# Starts a heartbeat.
#
# $1 - heartbeat interval
start_heartbeat() {
echo 'Starting heartbeat...' >&2

# Create a heartbeat and send to background:
heartbeat "$1" &

# Capture the heartbeat pid:
heartbeat_pid=$!
echo "Heartbeat pid: ${heartbeat_pid}" >&2
}

# Runs an infinite print loop.
#
# $1 - heartbeat interval
heartbeat() {
while true; do
echo "$(date) - heartbeat..." >&2
sleep "$1"
done
}

# Stops the heartbeat print loop.
stop_heartbeat() {
echo 'Stopping heartbeat...' >&2
kill "${heartbeat_pid}"
}

# Prints a success message.
print_success() {
echo 'Success!' >&2
}

# Main execution sequence.
main() {
start_heartbeat "${heartbeat_interval}"

# Only keep files which reside in package directories:
changed=$(echo "${changed}" | tr ' ' '\n' | grep '^lib/node_modules/@stdlib') || true

# Find unique package directories:
directories=$(echo "${changed}" | tr ' ' '\n' | sed -E 's/\/(bin|data|etc|include|lib|src|test)\/?$//' | uniq)

if [ -z "${directories}" ]; then
echo 'No packages to run benchmarks for.' >&2
cleanup
print_success
exit 0
fi

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

# Build native add-ons for packages (if applicable):
for pkg in ${packages}; do
if [ -f "lib/node_modules/${pkg}/binding.gyp" ]; then
NODE_ADDONS_PATTERN="${pkg}" make install-node-addons
fi
done

# Find all benchmark files in package directories:
js_bench_files=$(find "${directories}" -maxdepth 3 -wholename '**/benchmark/benchmark*.js' | grep -v '/fixtures/' | sort -u | tr '\n' ' ') || true

# Run JS benchmarks:
if [ -n "${js_bench_files}" ]; then
make benchmark-javascript-files FILES="${js_bench_files}"
else
echo 'No JavaScript benchmarks to run.' >&2
fi

# Run C benchmarks:
echo "Finding C benchmark files in ${directories}..."
c_bench_files=$(find "${directories}" -maxdepth 4 -wholename '**/benchmark/c/benchmark*.c' -exec realpath {} \; | grep -v '/fixtures/' | sort -u | tr '\n' ' ') || true

if [ -n "${c_bench_files}" ]; then
make benchmark-c-files FILES="${c_bench_files}"
else
echo 'No C benchmarks to run.' >&2
fi

cleanup
print_success
exit 0
}

# Set an error handler to print captured output and perform any clean-up tasks:
trap 'on_error' ERR

# Run main:
main
48 changes: 27 additions & 21 deletions .github/workflows/slash_commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,33 @@ jobs:
# Add initial reaction to comment with slash command:
- name: 'Add initial reaction'
run: |
COMMENT="${{ github.event.comment.body }}"
if [[ $COMMENT == "/stdlib help" || \
$COMMENT == "/stdlib check-files" || \
$COMMENT == "/stdlib update-copyright-years" || \
$COMMENT == "/stdlib lint-autofix" || \
$COMMENT == "/stdlib merge" || \
$COMMENT == "/stdlib rebase"
]]; then
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions" \
-d '{"content":"eyes"}'
else
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments" \
-d '{"body":"@${{ github.event.comment.user.login }}, slash command not recognized. Please use `/stdlib help` to view available commands."}'
fi
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}
script: |
const commentBody = github.event.comment.body.trim();
const RE_COMMANDS = /^\/stdlib\s+(help|check-files|update-copyright-years|lint-autofix|merge|rebase)$/i;
const isRecognizedCommand = RE_COMMANDS.test( commentBody );
if ( isRecognizedCommand ) {
await github.rest.reactions.createForIssueComment({
'owner': context.repo.owner,
'repo': context.repo.repo,
'comment_id': github.event.comment.id,
'content': 'eyes'
});
} else {
// Include the full user comment as a Markdown quote block in response:
const lines = commentBody.split( '\n' );
const quote = lines.map( line => `> ${line}` ).join( '\n' );
await github.rest.issues.createComment({
'owner': context.repo.owner,
'repo': context.repo.repo,
'issue_number': github.event.issue.number,
'body': `${quote}\n\n@${github.event.comment.user.login}, slash command not recognized. Please use \`/stdlib help\` to view available commands.`
});
}
# Define a job for checking for required files:
check_files:
Expand Down
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# A

Aayush Khanna <[email protected]> <[email protected]>
Aayush Khanna <[email protected]> <[email protected]>
Aayush Khanna <[email protected]> aayush0325

Abhijit Raut <[email protected]> <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Daniel Killenberger <[email protected]>
Daniel Yu <[email protected]>
Debashis Maharana <[email protected]>
Desh Deepak Kant <[email protected]>
Dev Goel <[email protected]>
Dhruv Arvind Singh <[email protected]>
Divyansh Seth <[email protected]>
Dominic Lim <[email protected]>
Expand Down
14 changes: 14 additions & 0 deletions docs/git-notes/02cbff35d876dcea7efd41794f414c7df5eddca4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
type: amend-message
---
refactor!: update `blas/ext/base/dapx` to follow current project conventions

BREAKING CHANGE:

- `c_dapx()` renamed to `stdlib_strided_dapx()`
- `c_dapx_ndarray()` renamed to `stdlib_strided_dapx_ndarray()`

All downstream usage of the old `c_dapx*` symbols must be updated to use the new symbols.

PR-URL: https://github.com/stdlib-js/stdlib/pull/4737
Reviewed-by: Philipp Burckhardt <[email protected]>
Loading

0 comments on commit 5937ce5

Please sign in to comment.