feat: add C implementation for stats/base/dists/geometric/entropy
#7220
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/ | |
# @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: slash_commands | |
# Workflow triggers: | |
on: | |
issue_comment: | |
types: | |
- created | |
- edited | |
# Workflow jobs: | |
jobs: | |
# Define a job for adding an initial reaction: | |
add_initial_reaction: | |
# Define a display name: | |
name: 'Add initial reaction' | |
# Define the type of virtual host machine: | |
runs-on: ubuntu-latest | |
# Define the conditions under which the job should run: | |
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/stdlib') | |
# Define the job's steps: | |
steps: | |
# Add "bot: In progress" label to the issue / PR: | |
- name: 'Add in-progress label' | |
# Pin action to full length commit SHA | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
github-token: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.addLabels({ | |
'owner': context.repo.owner, | |
'repo': context.repo.repo, | |
'issue_number': context.issue.number, | |
'labels': ['bot: In Progress'] | |
}) | |
# 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 | |
# Define a job for checking for required files: | |
check_files: | |
# Define a display name: | |
name: 'Check for required files' | |
# Ensure initial reaction job has completed before running this job: | |
needs: [ add_initial_reaction ] | |
# Define the conditions under which the job should run: | |
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/stdlib check-files') | |
# Run reusable workflow: | |
uses: ./.github/workflows/check_required_files.yml | |
with: | |
pull_request_number: ${{ github.event.issue.number }} | |
user: ${{ github.event.comment.user.login }} | |
secrets: | |
STDLIB_BOT_GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} | |
# Define a job for updating copyright header years: | |
update_copyright_years: | |
# Define a display name: | |
name: 'Update copyright header years' | |
# Define the conditions under which the job should run: | |
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/stdlib update-copyright-years') | |
# Run reusable workflow: | |
uses: ./.github/workflows/update_pr_copyright_years.yml | |
with: | |
pull_request_number: ${{ github.event.issue.number }} | |
secrets: | |
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} | |
STDLIB_BOT_GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} | |
STDLIB_BOT_GPG_PRIVATE_KEY: ${{ secrets.STDLIB_BOT_GPG_PRIVATE_KEY }} | |
STDLIB_BOT_GPG_PASSPHRASE: ${{ secrets.STDLIB_BOT_GPG_PASSPHRASE }} | |
# Define a job for auto-fixing lint errors: | |
fix_lint_errors: | |
# Define a display name: | |
name: 'Auto-fix lint errors' | |
# Ensure initial reaction job has completed before running this job: | |
needs: [ add_initial_reaction ] | |
# Define the conditions under which the job should run: | |
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/stdlib lint-autofix') | |
# Run reusable workflow: | |
uses: ./.github/workflows/lint_autofix.yml | |
with: | |
pull_request_number: ${{ github.event.issue.number }} | |
secrets: | |
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} | |
STDLIB_BOT_GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} | |
STDLIB_BOT_GPG_PRIVATE_KEY: ${{ secrets.STDLIB_BOT_GPG_PRIVATE_KEY }} | |
STDLIB_BOT_GPG_PASSPHRASE: ${{ secrets.STDLIB_BOT_GPG_PASSPHRASE }} | |
# Define a job for merging develop branch: | |
merge_develop: | |
# Define a display name: | |
name: 'Merge changes from develop branch into this PR' | |
# Ensure initial reaction job has completed before running this job: | |
needs: [ add_initial_reaction ] | |
# Define the conditions under which the job should run: | |
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/stdlib merge') | |
# Run reusable workflow: | |
uses: ./.github/workflows/pr_merge_develop.yml | |
with: | |
pull_request_number: ${{ github.event.issue.number }} | |
secrets: | |
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} | |
STDLIB_BOT_GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} | |
STDLIB_BOT_GPG_PRIVATE_KEY: ${{ secrets.STDLIB_BOT_GPG_PRIVATE_KEY }} | |
STDLIB_BOT_GPG_PASSPHRASE: ${{ secrets.STDLIB_BOT_GPG_PASSPHRASE }} | |
# Define a job for rebasing on develop branch: | |
rebase_develop: | |
# Define a display name: | |
name: 'Rebase this PR on top of develop branch' | |
# Ensure initial reaction job has completed before running this job: | |
needs: [ add_initial_reaction ] | |
# Define the conditions under which the job should run: | |
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/stdlib rebase') | |
# Run reusable workflow: | |
uses: ./.github/workflows/pr_rebase_develop.yml | |
with: | |
pull_request_number: ${{ github.event.issue.number }} | |
secrets: | |
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} | |
STDLIB_BOT_GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} | |
STDLIB_BOT_GPG_PRIVATE_KEY: ${{ secrets.STDLIB_BOT_GPG_PRIVATE_KEY }} | |
STDLIB_BOT_GPG_PASSPHRASE: ${{ secrets.STDLIB_BOT_GPG_PASSPHRASE }} | |
# Define a job for printing a list of available slash commands: | |
help: | |
# Define a display name: | |
name: 'Print a list of available slash commands' | |
# Define the type of virtual host machine: | |
runs-on: ubuntu-latest | |
# Ensure initial reaction job has completed before running this job: | |
needs: [ add_initial_reaction ] | |
# Define the conditions under which the job should run: | |
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/stdlib help') | |
# Define the job's steps: | |
steps: | |
# Create a comment on the pull request informing the user of available slash commands: | |
- name: 'Create a comment on the pull request informing the user of available slash commands' | |
# Pin action to full length commit SHA | |
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 | |
with: | |
# Specify the issue or pull request number: | |
issue-number: ${{ github.event.issue.number }} | |
# Specify the comment body: | |
body: | | |
@${{ github.event.comment.user.login }}, available slash commands include: | |
- `/stdlib check-files` - Check for required files. | |
- `/stdlib update-copyright-years` - Update copyright header years. | |
- `/stdlib lint-autofix` - Auto-fix lint errors. | |
- `/stdlib merge` - Merge changes from develop branch into this PR. | |
- `/stdlib rebase` - Rebase this PR on top of develop branch. | |
# GitHub token: | |
token: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} | |
# Define a job for removing the in-progress label: | |
remove_progress_label: | |
# Define a display name: | |
name: 'Remove in-progress label' | |
# Define the type of virtual host machine: | |
runs-on: ubuntu-latest | |
# Ensure all previous jobs have completed before running this job: | |
needs: [ add_initial_reaction, check_files, update_copyright_years, fix_lint_errors, merge_develop, rebase_develop, help ] | |
# Define the conditions under which the job should run: | |
if: | | |
always() && | |
github.event.issue.pull_request && | |
startsWith(github.event.comment.body, '/stdlib') | |
# Define the job's steps: | |
steps: | |
- name: Remove in-progress label | |
# Run the step regardless of the outcome of previous steps: | |
if: always() | |
# Pin action to full length commit SHA | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
github-token: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} | |
script: | | |
try { | |
await github.rest.issues.removeLabel({ | |
'owner': context.repo.owner, | |
'repo': context.repo.repo, | |
'issue_number': context.issue.number, | |
'name': 'bot: In Progress' | |
}) | |
} catch ( error ) { | |
console.log( 'Error removing label: %s', error.message ); | |
} |