Skip to content

Commit

Permalink
build: tweak permissions and use fine-grained PAT
Browse files Browse the repository at this point in the history
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---

---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: na
  - task: run_c_examples
    status: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: na
  - task: run_c_benchmarks
    status: na
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: na
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---

---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: na
  - task: run_c_examples
    status: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: na
  - task: run_c_benchmarks
    status: na
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: na
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
  • Loading branch information
Planeshifter authored and yuvi-mittal committed Jan 26, 2025
1 parent 02b9077 commit 2e501cd
Show file tree
Hide file tree
Showing 28 changed files with 1,309 additions and 17 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/do_not_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ jobs:

# Define job permissions:
permissions:
contents: read
pull-requests: write
pull-requests: read

# Define the type of virtual host machine:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/first_time_greeting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ on: [pull_request_target, issues]

# Global permissions:
permissions:
# Allow read-only access to the repository contents:
contents: read
# Do not give the workflow any permissions:
contents: none

# Workflow jobs:
jobs:
Expand All @@ -47,7 +47,7 @@ jobs:
# Pin action to full length commit SHA
uses: actions/first-interaction@34f15e814fe48ac9312ccf29db4e74fa767cbab7 # v1.3.0
with:
repo-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
repo-token: ${{ secrets.STDLIB_BOT_FGPAT_PR_WRITE }}
issue-message: |
:wave: Hi there! :wave:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:

# Specify whether to download Git-LFS files:
lfs: false

# Avoid storing GitHub token in local Git configuration:
persist-credentials: false
timeout-minutes: 10

# Install Node.js:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/markdown_equations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:

# Specify whether to download Git-LFS files:
lfs: false

# Avoid storing GitHub token in local Git configuration:
persist-credentials: false
timeout-minutes: 10

# Install Node.js:
Expand Down Expand Up @@ -103,7 +106,6 @@ jobs:
git_user_signingkey: true
git_commit_gpgsign: true


# Generate list of changed Markdown files:
- name: 'Find changed Markdown files'
run: |
Expand Down Expand Up @@ -161,7 +163,7 @@ jobs:
commit-message: 'docs: update Markdown equation elements'
committer: 'stdlib-bot <[email protected]>'
signoff: true
token: ${{ secrets.PULL_REQUEST_TOKEN }}
token: ${{ secrets.STDLIB_BOT_FGPAT_PR_WRITE }}
labels: |
documentation
automated-pr
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/markdown_links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ jobs:

# Specify whether to download Git-LFS files:
lfs: false

# Avoid storing GitHub token in local Git configuration:
persist-credentials: false
timeout-minutes: 10

# Initialize log files:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/markdown_pkg_urls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ jobs:

# Specify whether to download Git-LFS files:
lfs: false

# Avoid storing GitHub token in local Git configuration:
persist-credentials: false

timeout-minutes: 10

# Install Node.js:
Expand Down Expand Up @@ -131,7 +135,7 @@ jobs:
fi
timeout-minutes: 10

# Create a pull request with the changes:
# Create a pull request with the changes:
- name: 'Create pull request'
id: cpr
if: steps.update-markdown-pkg-urls.outputs.changed == 'true'
Expand All @@ -147,7 +151,7 @@ jobs:
commit-message: 'docs: update Markdown stdlib package URLs'
committer: 'stdlib-bot <[email protected]>'
signoff: true
token: ${{ secrets.PULL_REQUEST_TOKEN }}
token: ${{ secrets.STDLIB_BOT_FGPAT_PR_WRITE }}
labels: |
documentation
automated-pr
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/markdown_related_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ jobs:

# Specify whether to download Git-LFS files:
lfs: false

# Avoid storing GitHub token in local Git configuration:
persist-credentials: false
timeout-minutes: 10

# Install Node.js:
Expand Down Expand Up @@ -159,7 +162,7 @@ jobs:
commit-message: 'docs: update related packages sections'
committer: 'stdlib-bot <[email protected]>'
signoff: true
token: ${{ secrets.PULL_REQUEST_TOKEN }}
token: ${{ secrets.STDLIB_BOT_FGPAT_PR_WRITE }}
labels: |
documentation
automated-pr
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/markdown_src_attributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ name: markdown_src_attributes
on:
schedule:
# Run the workflow once a month on the 1st day of every month:
- cron: "0 0 1 * *"
- cron: '0 0 1 * *'

# Allow the workflow to be manually run:
workflow_dispatch:
Expand Down Expand Up @@ -73,6 +73,9 @@ jobs:

# Specify whether to download Git-LFS files:
lfs: false

# Avoid storing GitHub token in local Git configuration:
persist-credentials: false
timeout-minutes: 10

# Initialize log files:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/markdown_tocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:

# Specify whether to download Git-LFS files:
lfs: false

# Avoid storing GitHub token in local Git configuration:
persist-credentials: false
timeout-minutes: 10

# Install Node.js:
Expand Down Expand Up @@ -129,7 +132,7 @@ jobs:
commit-message: 'docs: update namespace table of contents'
signoff: true
committer: 'stdlib-bot <[email protected]>'
token: ${{ secrets.PULL_REQUEST_TOKEN }}
token: ${{ secrets.STDLIB_BOT_FGPAT_PR_WRITE }}
labels: |
documentation
automated-pr
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/namespace_declarations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:

# Specify whether to download Git-LFS files:
lfs: false

# Avoid storing GitHub token in local Git configuration:
persist-credentials: false
timeout-minutes: 10

# Install Node.js:
Expand Down Expand Up @@ -124,7 +127,7 @@ jobs:
commit-message: 'feat: update namespace TypeScript declarations'
committer: 'stdlib-bot <[email protected]>'
signoff: true
token: ${{ secrets.PULL_REQUEST_TOKEN }}
token: ${{ secrets.STDLIB_BOT_FGPAT_PR_WRITE }}
labels: |
documentation
automated-pr
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/namespace_exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ jobs:

# Specify whether to download Git-LFS files:
lfs: false

# Avoid storing GitHub token in local Git configuration:
persist-credentials: false
timeout-minutes: 10

# Install Node.js:
Expand Down Expand Up @@ -136,7 +139,7 @@ jobs:
commit-message: 'feat: update namespace exports'
committer: 'stdlib-bot <[email protected]>'
signoff: true
token: ${{ secrets.PULL_REQUEST_TOKEN }}
token: ${{ secrets.STDLIB_BOT_FGPAT_PR_WRITE }}
labels: |
automated-pr
team-reviewers: |
Expand Down
89 changes: 89 additions & 0 deletions lib/node_modules/@stdlib/stats/base/dists/planck/stdev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,95 @@ for ( i = 0; i < lambda.length; i++ ) {

<!-- /.references -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/stats/base/dists/planck/stdev.h"
```

#### stdlib_base_dists_planck_stdev( lambda )

Evaluates the standard deviation for an planck distribution.

```c
double out = stdlib_base_dists_planck_stdev( 0.1 );
// returns ~9.9958
```

The function accepts the following arguments:

- **lambda**: `[in] double` shape parameter.

```c
double stdlib_base_dists_planck_stdev( const double lambda );
```
</section>
<!-- /.usage -->
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
<section class="notes">
</section>
<!-- /.notes -->
<!-- C API usage examples. -->
<section class="examples">
### Examples
```c
#include "stdlib/stats/base/dists/planck/stdev.h"
#include <stdlib.h>
#include <stdio.h>
static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
return min + ( v*(max-min) );
}
int main( void ) {
double lambda;
double y;
int i;
for ( i = 0; i < 25; i++ ) {
lambda = random_uniform( 0.1, 10.0 );
y = stdlib_base_dists_planck_stdev( lambda );
printf( "lambda: %lf, Standard Deviation: %lf\n", lambda, y );
}
}
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/array/uniform' );
var randu = require( '@stdlib/random/base/randu' );
var Float64Array = require( '@stdlib/array/float64' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var stdev = require( './../lib' );
Expand All @@ -31,14 +32,19 @@ var stdev = require( './../lib' );

bench( pkg, function benchmark( b ) {
var lambda;
var len;
var y;
var i;

lambda = uniform( 100, 0.1, 10.0 );
len = 100;
lambda = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
lambda[ i ] = ( randu() * 10.0 ) + 1.0;
}

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = stdev( lambda[ i % lambda.length ] );
y = stdev( lambda[ i % len ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* @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.
*/

'use strict';

// MODULES //

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var Float64Array = require( '@stdlib/array/float64' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var tryRequire = require( '@stdlib/utils/try-require' );
var pkg = require( './../package.json' ).name;


// VARIABLES //

var stdev = tryRequire( resolve( __dirname, './../lib/native.js' ) );
var opts = {
'skip': ( stdev instanceof Error )
};


// MAIN //

bench( pkg+'::native', opts , function benchmark( b ) {
var lambda;
var len;
var y;
var i;

len = 100;
lambda = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
lambda[ i ] = ( randu() * 10.0 ) + 1.0;
}

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = stdev( lambda[ i % len ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
Loading

0 comments on commit 2e501cd

Please sign in to comment.