Skip to content

Commit 4c772c1

Browse files
committed
build: replace weekly random keepalive with daily round-robin batches
--- 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: passed - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent a921830 commit 4c772c1

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

.github/workflows/standalone_keepalive.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ name: standalone_keepalive
2121

2222
# Workflow triggers:
2323
on:
24-
# Run the workflow on the first day of each week:
24+
# Run the workflow daily:
2525
schedule:
26-
- cron: '0 0 * * 1'
26+
- cron: '0 2 * * *'
2727

2828
# Allow the workflow to be manually run:
2929
workflow_dispatch:

lib/node_modules/@stdlib/_tools/scripts/publish_packages.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ var memoize = require( '@stdlib/utils/memoize' );
4646
var repeat = require( '@stdlib/string/repeat' );
4747
var trim = require( '@stdlib/string/trim' );
4848
var copy = require( '@stdlib/utils/copy' );
49-
var sample = require( '@stdlib/random/sample' );
5049
var rootDir = require( '@stdlib/_tools/utils/root-dir' );
5150
var rescape = require( '@stdlib/utils/escape-regexp-string' );
5251
var replace = require( '@stdlib/string/replace' );
@@ -56,6 +55,8 @@ var reFromString = require( '@stdlib/utils/regexp-from-string' );
5655
var startsWith = require( '@stdlib/string/starts-with' );
5756
var substringAfterLast = require( '@stdlib/string/substring-after-last' );
5857
var currentYear = require( '@stdlib/time/current-year' );
58+
var dayOfYear = require( '@stdlib/time/day-of-year' );
59+
var ceil = require( '@stdlib/math/base/special/ceil' );
5960
var namespaceDeps = require( '@stdlib/_tools/pkgs/namespace-deps' );
6061
var depList = require( '@stdlib/_tools/pkgs/dep-list' );
6162
var name2standalone = require( '@stdlib/_tools/pkgs/name2standalone' );
@@ -77,7 +78,7 @@ var debug = logger( 'scripts:publish-packages' );
7778
var START_PKG_INDEX = parseInt( flags[ 'start-index' ], 10 ) || 0;
7879
var END_PKG_INDEX = ( flags[ 'end-index' ] === void 0 ) ? 9999 : parseInt( flags[ 'end-index' ], 10 );
7980
var MAX_TREE_DEPTH = 99;
80-
var KEEP_ALIVE_SAMPLE_SIZE = 1000;
81+
var KEEP_ALIVE_SAMPLE_SIZE = 150;
8182

8283
var topics = setTopics.factory({
8384
'token': ENV.GITHUB_TOKEN
@@ -1507,6 +1508,8 @@ function publish( pkg, clbk ) {
15071508
*/
15081509
function main() {
15091510
var repeatedTry;
1511+
var batchIndex;
1512+
var nBatches;
15101513
var fpath;
15111514
var pkgs;
15121515
var idx;
@@ -1542,10 +1545,10 @@ function main() {
15421545

15431546
pkgs = pkgs.slice( START_PKG_INDEX, END_PKG_INDEX + 1 );
15441547
if ( flags[ 'keep-alive' ] ) {
1545-
pkgs = sample( pkgs, {
1546-
'size': KEEP_ALIVE_SAMPLE_SIZE,
1547-
'replace': false
1548-
});
1548+
// Select a deterministic batch of packages based on the current day of the year, ensuring all packages get updated over a regular cycle...
1549+
nBatches = ceil( pkgs.length / KEEP_ALIVE_SAMPLE_SIZE );
1550+
batchIndex = dayOfYear() % nBatches;
1551+
pkgs = pkgs.slice( batchIndex * KEEP_ALIVE_SAMPLE_SIZE, ( batchIndex + 1 ) * KEEP_ALIVE_SAMPLE_SIZE );
15491552
}
15501553
for ( i = 0; i < pkgs.length; i++ ) {
15511554
pkgs[ i ] = replace( pkgs[ i ], '@stdlib/', '' );

0 commit comments

Comments
 (0)