Skip to content

Commit cf58c6f

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents c6f4c45 + ca1c155 commit cf58c6f

28 files changed

Lines changed: 1676 additions & 105 deletions

.github/workflows/lint_random_files.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ jobs:
394394
- name: 'Create pull request'
395395
if: ${{ github.event.inputs.fix == 'true' }} && ( success() || failure() )
396396
id: cpr
397-
uses: peter-evans/create-pull-request@v4
397+
uses: peter-evans/create-pull-request@v5
398398
with:
399399
title: 'Fix lint errors'
400400
add-paths: ${{ steps.random-files.outputs.files }}
@@ -409,6 +409,6 @@ jobs:
409409
labels: |
410410
automated-pr
411411
team-reviewers: |
412-
stdlib-reviewers
412+
reviewers
413413
branch: 'fix-lint-errors'
414414
delete-branch: true

.github/workflows/markdown_equations.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
- name: 'Create pull request'
134134
id: cpr
135135
if: steps.svg-equations.outputs.changed == 'true' || steps.equation-elements.outputs.changed == 'true'
136-
uses: peter-evans/create-pull-request@v4
136+
uses: peter-evans/create-pull-request@v5
137137
with:
138138
title: 'Update Markdown equation elements'
139139
body: |
@@ -148,7 +148,7 @@ jobs:
148148
documentation
149149
automated-pr
150150
team-reviewers: |
151-
stdlib-reviewers
151+
reviewers
152152
branch: markdown-insert-equations
153153
delete-branch: true
154154

.github/workflows/markdown_tocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
# Create a pull request with the updated tables of contents:
103103
- name: 'Create pull request'
104104
id: cpr
105-
uses: peter-evans/create-pull-request@v4
105+
uses: peter-evans/create-pull-request@v5
106106
with:
107107
title: 'Update namespace table of contents'
108108
body: |
@@ -117,7 +117,7 @@ jobs:
117117
documentation
118118
automated-pr
119119
team-reviewers: |
120-
stdlib-reviewers
120+
reviewers
121121
branch: update-namespace-tocs
122122
delete-branch: true
123123

.github/workflows/namespace_declarations.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
# Create a pull request with the updated declarations:
9292
- name: 'Create pull request'
9393
id: cpr
94-
uses: peter-evans/create-pull-request@v4
94+
uses: peter-evans/create-pull-request@v5
9595
with:
9696
title: 'Update namespace TypeScript declarations'
9797
body: |
@@ -106,7 +106,7 @@ jobs:
106106
documentation
107107
automated-pr
108108
team-reviewers: |
109-
stdlib-reviewers
109+
reviewers
110110
branch: update-namespace-declarations
111111
delete-branch: true
112112

.github/workflows/namespace_exports.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
# Create a pull request with the updated namespace exports:
114114
- name: 'Create pull request'
115115
id: cpr
116-
uses: peter-evans/create-pull-request@v4
116+
uses: peter-evans/create-pull-request@v5
117117
with:
118118
title: 'Update namespace exports'
119119
body: |
@@ -127,6 +127,6 @@ jobs:
127127
labels: |
128128
automated-pr
129129
team-reviewers: |
130-
stdlib-reviewers
130+
reviewers
131131
branch: update-namespace-exports
132132
delete-branch: true

.github/workflows/run_tests_coverage.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
# Workflow triggers:
2323
on:
2424
push:
25+
branches:
26+
- develop
2527
paths:
2628
# List paths for which changes should trigger this workflow:
2729
- 'lib/**/bin/**'
@@ -238,9 +240,18 @@
238240
USER_NAME: stdlib-bot
239241
run: |
240242
cd ./www-test-code-coverage
243+
244+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
245+
BRANCH_NAME="pr-${{ github.event.pull_request.number }}"
246+
git fetch origin $BRANCH_NAME || true
247+
git checkout $BRANCH_NAME || git checkout -b $BRANCH_NAME
248+
else
249+
BRANCH_NAME="main"
250+
fi
251+
241252
git add .
242253
git config --local user.email "noreply@stdlib.io"
243254
git config --local user.name "stdlib-bot"
244255
git commit -m "Update artifacts"
245-
git push "https://$USER_NAME:$REPO_GITHUB_TOKEN@github.com/stdlib-js/www-test-code-coverage.git" main
256+
git push "https://$USER_NAME:$REPO_GITHUB_TOKEN@github.com/stdlib-js/www-test-code-coverage.git" $BRANCH_NAME
246257

.github/workflows/scaffold_pkg_via_issue_comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
# Create a pull request:
6060
- name: 'Create pull request'
6161
if: ${{ contains(github.event.comment.body, 'scaffold') }}
62-
uses: peter-evans/create-pull-request@v4
62+
uses: peter-evans/create-pull-request@v5
6363
with:
6464
token: ${{ secrets.PULL_REQUEST_TOKEN }}
6565
commit-message: 'feat: add `${{ steps.scaffold.outputs.alias }}`'

.github/workflows/scripts/run_tests_coverage

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ main() {
145145
changed=$(echo "${changed}" | tr ' ' '\n' | grep '^lib/node_modules/@stdlib') || true
146146

147147
# Find unique package directories:
148-
directories=$(echo "${changed}" | tr ' ' '\n' | sed -E 's/\/(benchmark|bin|data|docs|etc|examples|include|lib|src|test)\/?$//' | uniq)
148+
directories=$(echo "${changed}" | tr ' ' '\n' | sed -E 's/\/(benchmark|bin|data|docs|etc|examples|include|lib|scripts|src|test)(\/.*)?\/?$//' | uniq)
149149

150150
if [ -z "${directories}" ]; then
151151
echo 'No packages to test.' >&2
@@ -162,7 +162,7 @@ main() {
162162

163163
make test-javascript-cov TESTS_FILTER=".*/${pkg}/.*"
164164

165-
if [ -f reports/coverage/lcov-report/index.html ]; then
165+
if [ ! -f reports/coverage/lcov-report/${pkg}/lib/index.html ]; then
166166
# Reports for packages with no dependencies are stored in the `lcov-report` directory
167167
coverage_path="reports/coverage/lcov-report/index.html"
168168
top_level_report=true
@@ -204,15 +204,15 @@ main() {
204204

205205
pkg_cov="| $pkg_statements_cov_fraction <br> $cov_change_statements | $pkg_branches_cov_fraction <br> $cov_change_branches | $pkg_functions_cov_fraction <br> $cov_change_functions | $pkg_lines_cov_fraction <br> $cov_change_lines |"
206206

207-
pkg_url="https://github.com/${github_repo}/tree/${github_ref}/${package}"
208-
pkg_link="<a href="$pkg_url">$pkg</a>"
207+
pkg_url="https://coverage.stdlib.io/${pkg}"
208+
pkg_link="<a href='"$pkg_url"'>$pkg</a>"
209209
coverage="$coverage\n| $pkg_link $pkg_cov"
210210

211211
# Copy coverage report of the package to artifacts directory:
212212
if [ "$top_level_report" = true ]; then
213213
mkdir -p "artifacts/${pkg}" && cp -r "reports/coverage/lcov-report"/* "artifacts/${pkg}/"
214214
else
215-
mkdir -p "artifacts/${pkg}" && cp -r "reports/coverage/lcov-report/${pkg}/lib"/* "artifacts/${pkg}/lib/"
215+
mkdir -p "artifacts/${pkg}/lib/" && cp -r "reports/coverage/lcov-report/${pkg}/lib"/* "artifacts/${pkg}/lib/"
216216
fi
217217

218218
# Cleanup coverage reports for next package:

.github/workflows/update_contributors.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
# Create a pull request:
8282
- name: 'Create pull request'
8383
if: steps.update-contributors.outputs.changed == 'true'
84-
uses: peter-evans/create-pull-request@v4
84+
uses: peter-evans/create-pull-request@v5
8585
id: cpr
8686
with:
8787
title: 'Update list of contributors'
@@ -97,7 +97,7 @@ jobs:
9797
documentation
9898
automated-pr
9999
team-reviewers: |
100-
stdlib-reviewers
100+
reviewers
101101
branch: update-contributors
102102
delete-branch: true
103103

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2023 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: update_error_databases
21+
22+
# Workflow triggers:
23+
on:
24+
schedule:
25+
# Run the workflow once a week (Sunday at midnight):
26+
- cron: '0 0 * * 0'
27+
28+
# Allow the workflow to be manually run:
29+
workflow_dispatch:
30+
31+
# Workflow jobs:
32+
jobs:
33+
34+
# Define a job for updating the error databases:
35+
update:
36+
37+
# Define a display name:
38+
name: 'Update Error Databases'
39+
40+
# Define the type of virtual host machine:
41+
runs-on: ubuntu-latest
42+
43+
# Define the sequence of job steps...
44+
steps:
45+
46+
# Checkout the repository:
47+
- name: 'Checkout repository'
48+
uses: actions/checkout@v3
49+
with:
50+
# Specify whether to remove untracked files before checking out the repository:
51+
clean: true
52+
53+
# Limit clone depth to the most recent commit:
54+
fetch-depth: 1
55+
56+
# Specify whether to download Git-LFS files:
57+
lfs: false
58+
timeout-minutes: 10
59+
60+
# Install Node.js:
61+
- name: 'Install Node.js'
62+
uses: actions/setup-node@v3
63+
with:
64+
node-version: '16' # 'lts/*'
65+
timeout-minutes: 5
66+
67+
# Install dependencies (accounting for possible network failures, etc, when installing node module dependencies):
68+
- name: 'Install dependencies'
69+
run: |
70+
make install-node-modules || make install-node-modules || make install-node-modules
71+
timeout-minutes: 15
72+
73+
# Update the error databases:
74+
- name: 'Update error databases'
75+
run: |
76+
node lib/node_modules/@stdlib/error/tools/database/scripts/build.js
77+
node lib/node_modules/@stdlib/error/tools/pkg2id/scripts/build.js
78+
node lib/node_modules/@stdlib/error/tools/id2pkg/scripts/build.js
79+
80+
# Generate comment with Markdown table of added error codes:
81+
- name: 'Generate comment body with Markdown table of added error codes'
82+
run: |
83+
# Save the added lines from the diff to a temporary file:
84+
git diff lib/node_modules/@stdlib/error/tools/database/data/data.csv | grep '^+' | sed 's/^+//' > /tmp/diff.csv
85+
86+
# Convert the CSV file to a TSV file (and drop first line and double quotes):
87+
awk -F '",' 'NR > 1 && !/^++/ { gsub(/^"|"$/, "", $1); gsub(/^"|"$/, "", $2); gsub(/^"|"$/, "", $3); print $1 "\t" $2 "\t" $3 }' /tmp/diff.csv > /tmp/diff.tsv
88+
89+
# Create the Markdown table header:
90+
table="| Code | Error Message | Type |\n|------|---------------|------|\n"
91+
92+
# Extract added lines from the diff and append them to the Markdown table:
93+
while IFS=$'\t' read -r code error_message type; do
94+
# Check if the table length exceeds a maximum length:
95+
if [ ${#table} -gt 65000 ]; then
96+
table+="| ... | ... | ... |\nThis table has been truncated due to GitHub's comment character limit.\n"
97+
break
98+
fi
99+
100+
# Append the TSV row to the Markdown table:
101+
table+="| ${code} | ${error_message} | ${type} |\n"
102+
done < /tmp/diff.tsv
103+
104+
# Generate a comment body:
105+
body="This PR\n\n- updates the error databases\n\nThe following error codes were added:\n\n${table}"
106+
107+
# Escape '%' characters, which are interpreted as format specifiers by `printf`:
108+
body="${body//%/%%}"
109+
110+
# Write the comment body to a temporary file:
111+
printf "$body" > /tmp/body.md
112+
shell: bash
113+
114+
# Disable Git hooks:
115+
- name: 'Disable Git hooks'
116+
run: |
117+
rm -rf .git/hooks
118+
119+
# Create a pull request with the updated declarations:
120+
- name: 'Create pull request'
121+
id: cpr
122+
uses: peter-evans/create-pull-request@v5
123+
with:
124+
title: 'feat: update error databases'
125+
body-path: /tmp/body.md
126+
commit-message: 'feat: update error databases'
127+
committer: 'stdlib-bot <noreply@stdlib.io>'
128+
token: ${{ secrets.PULL_REQUEST_TOKEN }}
129+
labels: |
130+
documentation
131+
automated-pr
132+
team-reviewers: |
133+
reviewers
134+
branch: update-error-databases
135+
delete-branch: true

0 commit comments

Comments
 (0)