keuss 1.7.4 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/Pipeline/Queue.js +0 -1
  2. package/QFactory.js +49 -17
  3. package/Queue.js +1 -4
  4. package/README.md +2 -1
  5. package/TODO +0 -9
  6. package/backends/bucket-mongo-safe.js +11 -11
  7. package/backends/intraorder.js +13 -11
  8. package/backends/mongo.js +12 -9
  9. package/backends/pl-mongo.js +8 -5
  10. package/backends/postgres.js +380 -0
  11. package/backends/ps-mongo.js +11 -8
  12. package/backends/redis-list.js +8 -8
  13. package/backends/redis-oq.js +8 -3
  14. package/backends/stream-mongo.js +10 -15
  15. package/package.json +12 -8
  16. package/stats/mem.js +0 -1
  17. package/.github/workflows/codeql-analysis.yml +0 -72
  18. package/bench/all-mongo.js +0 -108
  19. package/bench/multi-q.js +0 -85
  20. package/bench/redis-oq-consumer-producer.js +0 -52
  21. package/bench/redis-oq-consumer.js +0 -40
  22. package/bench/redis-oq-producer.js +0 -43
  23. package/docker-compose/docker-compose.yaml +0 -18
  24. package/docker-compose.yaml +0 -18
  25. package/examples/pipelines/builder/index.js +0 -99
  26. package/examples/pipelines/fromRecipe/index.js +0 -127
  27. package/examples/pipelines/simplest/index.js +0 -38
  28. package/examples/pipelines/simulation-fork/index.js +0 -115
  29. package/examples/snippets/01-simplest-pop-push.js +0 -49
  30. package/examples/snippets/02-simplest-reserve-rollback-commit.js +0 -44
  31. package/examples/snippets/03-simplest-producer-consumer-loops.js +0 -77
  32. package/examples/snippets/04-bucket-mongo-safe-insert-reserve-commit.js +0 -78
  33. package/examples/snippets/05-insert-reserve-rollback-deadletter.js +0 -105
  34. package/examples/snippets/06-random-consumer-producer.js +0 -270
  35. package/examples/snippets/07-stream-simple.js +0 -53
  36. package/examples/snippets/redislabs-consumer-producer.js +0 -44
  37. package/examples/snippets/with-redis-stats-and-signaller-consumer-producer.js +0 -52
  38. package/examples/webhooks/README.md +0 -36
  39. package/examples/webhooks/app.js +0 -70
  40. package/examples/webhooks/consumer.js +0 -98
  41. package/examples/webhooks/index.js +0 -55
  42. package/examples/webhooks/package-lock.json +0 -500
  43. package/examples/webhooks/package.json +0 -23
  44. package/examples/webhooks/wh-payload.json +0 -38
  45. package/playground/irc.js +0 -53
  46. package/playground/pl-rollback.js +0 -55
  47. package/playground/pl1.js +0 -74
  48. package/playground/q1.js +0 -34
  49. package/playground/simple-pl.js +0 -42
  50. package/playground/stream-loops.js +0 -114
  51. package/test/backends_bucket-at-least-once.js +0 -302
  52. package/test/backends_deadletter.js +0 -227
  53. package/test/backends_payload.js +0 -542
  54. package/test/backends_push-pop.js +0 -170
  55. package/test/backends_remove.js +0 -320
  56. package/test/backends_reserve-commit-rollback.js +0 -1033
  57. package/test/intraorder.js +0 -325
  58. package/test/pause.js +0 -220
  59. package/test/pipeline-Builder.js +0 -285
  60. package/test/pipeline-ChoiceLink.js +0 -241
  61. package/test/pipeline-DirectLink.js +0 -376
  62. package/test/pipeline-Sink.js +0 -175
  63. package/test/signal.js +0 -196
  64. package/test/stats.js +0 -296
  65. package/test/stream-mongo.js +0 -166
@@ -0,0 +1,380 @@
1
+ const _ = require ('lodash');
2
+ const uuid = require ('uuid');
3
+ const pg = require ('pg');
4
+
5
+ const Queue = require ('../Queue');
6
+ const QFactory = require ('../QFactory');
7
+
8
+ const debug = require('debug')('keuss:Queue:postgres');
9
+
10
+ class PGQueue extends Queue {
11
+
12
+
13
+ // TODO escape table name properly , as identifier, and check for reserved names using pg_get_keywords(), if the name is in select * from pg_get_keywords() where catdesc = 'R', then it should not be used
14
+ //////////////////////////////////////////////
15
+ constructor (name, factory, opts, orig_opts) {
16
+ super (name, factory, opts, orig_opts);
17
+ this._pool = factory._pool;
18
+ this._tbl_name = this._name;
19
+ }
20
+
21
+
22
+ /////////////////////////////////////////
23
+ static Type () {
24
+ return 'postgres:simple';
25
+ }
26
+
27
+
28
+ /////////////////////////////////////////
29
+ type () {
30
+ return 'postgres:simple';
31
+ }
32
+
33
+
34
+ //////////////////////////////////////////////
35
+ // ensure table and indexes exists
36
+ _init (cb) {
37
+ this._pool.query (`
38
+ CREATE TABLE IF NOT EXISTS ${this._tbl_name} (
39
+ _id VARCHAR(64) PRIMARY KEY,
40
+ _pl JSONB,
41
+ mature TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL,
42
+ tries INTEGER DEFAULT 0 NOT NULL,
43
+ reserved TIMESTAMPTZ
44
+ );
45
+ CREATE INDEX IF NOT EXISTS idx_${this._tbl_name}_mature ON ${this._tbl_name} (mature);
46
+ `, err => cb (err));
47
+ }
48
+
49
+
50
+ /////////////////////////////////////////
51
+ // add element to queue
52
+ insert (entry, cb) {
53
+ const _id = entry.id || uuid.v4();
54
+ const tries = entry.tries || 0;
55
+ const mature = new Date (entry.mature);
56
+
57
+ const pl = {
58
+ payload: entry.payload,
59
+ hdrs: entry.hdrs || {}
60
+ }
61
+
62
+ if (Buffer.isBuffer (pl.payload)) {
63
+ pl.payload = pl.payload.toString ('base64');
64
+ pl.type = 'buffer';
65
+ }
66
+
67
+ this._pool.query (`INSERT INTO ${this._tbl_name} VALUES($1, $2, $3, $4)`, [_id, pl, mature, tries], (err, res) => {
68
+ if (err) return cb (err);
69
+ cb (null, _id)
70
+ })
71
+ }
72
+
73
+
74
+ /////////////////////////////////////////
75
+ // get element from queue
76
+ get (cb) {
77
+ this._pool.query (`
78
+ DELETE FROM ${this._tbl_name}
79
+ WHERE _id = (
80
+ SELECT _id
81
+ FROM ${this._tbl_name}
82
+ WHERE mature < now()
83
+ ORDER BY mature
84
+ FOR UPDATE SKIP LOCKED
85
+ LIMIT 1
86
+ )
87
+ RETURNING *;
88
+ `, (err, res) => {
89
+ if (err) return cb (err);
90
+
91
+ if (_.size (res.rows) == 0) return cb (null, null); // not found
92
+
93
+ const pl = res.rows[0];
94
+
95
+ _.merge (pl, pl._pl);
96
+ delete (pl._pl);
97
+
98
+ if (pl.type == 'buffer') {
99
+ try {
100
+ pl.payload = Buffer.from (pl.payload, 'base64');
101
+ } catch (e) {
102
+ // TODO maybe log some error/Statistic?
103
+ }
104
+ }
105
+
106
+ cb (null, pl);
107
+ })
108
+ }
109
+
110
+
111
+ //////////////////////////////////
112
+ // reserve element: call cb (err, pl) where pl has an id
113
+ reserve (cb) {
114
+ const delay = this._opts.reserve_delay || 120;
115
+
116
+ this._pool.query (`
117
+ UPDATE ${this._tbl_name}
118
+ SET
119
+ tries = tries + 1,
120
+ mature = now() + make_interval(secs => ${delay}),
121
+ reserved = now()
122
+ WHERE _id = (
123
+ SELECT _id
124
+ FROM ${this._tbl_name}
125
+ WHERE mature < now()
126
+ ORDER BY mature
127
+ FOR UPDATE SKIP LOCKED
128
+ LIMIT 1
129
+ )
130
+ RETURNING *;
131
+ `, (err, res) => {
132
+ if (err) return cb (err);
133
+
134
+ if (_.size (res.rows) == 0) return cb (null, null); // not found
135
+
136
+ const pl = res.rows[0];
137
+
138
+ _.merge (pl, pl._pl);
139
+ delete (pl._pl);
140
+
141
+ // adjust tries to pre-update
142
+ pl.tries--;
143
+
144
+ if (pl.type == 'buffer') {
145
+ try {
146
+ pl.payload = Buffer.from (pl.payload, 'base64');
147
+ } catch (e) {
148
+ // TODO maybe log some error/Statistic?
149
+ }
150
+ }
151
+
152
+ cb (null, pl);
153
+ })
154
+ }
155
+
156
+
157
+ //////////////////////////////////
158
+ // commit previous reserve, by p.id
159
+ commit (id, cb) {
160
+ if (!uuid.validate (id)) return cb ('id [' + id + '] can not be used as commit id: not a valid UUID');
161
+
162
+ this._pool.query (`
163
+ DELETE FROM ${this._tbl_name}
164
+ WHERE _id = $1
165
+ AND reserved IS NOT NULL
166
+ `,
167
+ [id],
168
+ (err, res) => {
169
+ if (err) return cb (err);
170
+ cb (null, res && (res.rowCount == 1));
171
+ })
172
+ }
173
+
174
+
175
+ //////////////////////////////////
176
+ // rollback previous reserve, by p.id
177
+ rollback (id, next_t, cb) {
178
+ if (_.isFunction (next_t)) {
179
+ cb = next_t;
180
+ next_t = null;
181
+ }
182
+
183
+ if (!uuid.validate (id)) return cb ('id [' + id + '] can not be used as rollback id: not a valid UUID');
184
+
185
+ const nxt = (next_t ? new Date (next_t) : Queue.now ());
186
+
187
+ this._pool.query (`
188
+ UPDATE ${this._tbl_name}
189
+ SET
190
+ reserved = NULL,
191
+ mature = $1
192
+ WHERE _id = $2
193
+ AND reserved IS NOT NULL
194
+ `,
195
+ [nxt, id],
196
+ (err, res) => {
197
+ if (err) return cb (err);
198
+ cb (null, res && (res.rowCount == 1));
199
+ })
200
+ }
201
+
202
+
203
+ //////////////////////////////////
204
+ // queue size including non-mature elements
205
+ totalSize (cb) {
206
+ this._pool.query (`
207
+ SELECT COUNT(*)
208
+ FROM ${this._tbl_name}
209
+ `,
210
+ (err, res) => {
211
+ if (err) return cb (err);
212
+ cb (null, parseInt (res.rows[0].count));
213
+ })
214
+ }
215
+
216
+
217
+ //////////////////////////////////
218
+ // queue size NOT including non-mature elements
219
+ size (cb) {
220
+ this._pool.query (`
221
+ SELECT COUNT(*)
222
+ FROM ${this._tbl_name}
223
+ WHERE mature < now()
224
+ `,
225
+ (err, res) => {
226
+ if (err) return cb (err);
227
+ cb (null, parseInt (res.rows[0].count));
228
+ })
229
+ }
230
+
231
+
232
+ //////////////////////////////////
233
+ // queue size of non-mature elements only
234
+ schedSize (cb) {
235
+ this._pool.query (`
236
+ SELECT COUNT(*)
237
+ FROM ${this._tbl_name}
238
+ WHERE mature >= now()
239
+ AND reserved IS NULL
240
+ `,
241
+ (err, res) => {
242
+ if (err) return cb (err);
243
+ cb (null, parseInt (res.rows[0].count));
244
+ })
245
+ }
246
+
247
+
248
+ //////////////////////////////////
249
+ // queue size of reserved elements only
250
+ resvSize (cb) {
251
+ this._pool.query (`
252
+ SELECT COUNT(*)
253
+ FROM ${this._tbl_name}
254
+ WHERE mature >= now()
255
+ AND reserved IS NOT NULL
256
+ `,
257
+ (err, res) => {
258
+ if (err) return cb (err);
259
+ cb (null, parseInt (res.rows[0].count));
260
+ })
261
+ }
262
+
263
+
264
+ /////////////////////////////////////////
265
+ // get element from queue
266
+ next_t (cb) {
267
+ this._pool.query (`
268
+ SELECT mature
269
+ FROM ${this._tbl_name}
270
+ ORDER BY mature
271
+ LIMIT 1
272
+ `, (err, res) => {
273
+ if (err) return cb (err);
274
+ if (_.size (res.rows) == 0) return cb (null, null); // not found
275
+
276
+ cb (null, res.rows[0].mature);
277
+ });
278
+ }
279
+
280
+
281
+ //////////////////////////////////////////////
282
+ // remove by id
283
+ remove (id, cb) {
284
+ if (!uuid.validate (id)) return cb ('id [' + id + '] can not be used as remove id: not a valid UUID');
285
+
286
+ this._pool.query (`
287
+ DELETE FROM ${this._tbl_name}
288
+ WHERE _id = $1
289
+ AND reserved IS NULL
290
+ `,
291
+ [id],
292
+ (err, res) => {
293
+ if (err) return cb (err);
294
+ cb (null, res && (res.rowCount == 1));
295
+ })
296
+ }
297
+
298
+
299
+ ///////////////////////////////////////////////////////////////////////////////
300
+ // private parts
301
+
302
+ };
303
+
304
+
305
+
306
+ ///////////////////////////////////////////////////////////////////////////////
307
+ class Factory extends QFactory {
308
+ constructor (opts, pg_pool) {
309
+ super (opts);
310
+ this._pool = pg_pool;
311
+ debug ('crated Factory with options %j', opts);
312
+ }
313
+
314
+ queue (name, opts, cb) {
315
+ if (!cb) {
316
+ cb = opts;
317
+ opts = {};
318
+ }
319
+
320
+ const full_opts = {};
321
+ _.merge(full_opts, this._opts, opts);
322
+ debug ('creating queue with full_opts %j', full_opts);
323
+
324
+ const q = new PGQueue (name, this, full_opts, opts);
325
+ q._init (err => {
326
+ if (err) return cb (err);
327
+ cb (null, q);
328
+ });
329
+ }
330
+
331
+ close (cb) {
332
+ super.close (() => {
333
+ debug ('closing pool...');
334
+ this._pool.end (cb);
335
+ });
336
+ }
337
+
338
+ type () {
339
+ return PGQueue.Type ();
340
+ }
341
+
342
+ capabilities () {
343
+ return {
344
+ sched: true,
345
+ reserve: true,
346
+ pipeline: false,
347
+ tape: false,
348
+ remove: true
349
+ };
350
+ }
351
+ }
352
+
353
+
354
+ ///////////////////////////////////////////////////////////////////////////////
355
+ function creator (opts, cb) {
356
+ const _opts = opts || {};
357
+
358
+ debug ('Creator: creating pool with %j', _opts);
359
+
360
+ const dflt = {
361
+ user: 'pg',
362
+ password: 'pg',
363
+ host: 'localhost',
364
+ port: 5432,
365
+ database: 'pg'
366
+ }
367
+
368
+ const pool = new pg.Pool(_.merge ({}, dflt, _opts.postgres));
369
+
370
+ // ensure the pool can connect
371
+ pool.query ('select 1', err => {
372
+ if (err) return cb (err);
373
+
374
+ debug ('pool created, can connect. Creating Factory...');
375
+ const F = new Factory (_opts, pool);
376
+ F.async_init (err => cb (err, F));
377
+ });
378
+ }
379
+
380
+ module.exports = creator;
@@ -16,9 +16,7 @@ class PersistentMongoQueue extends Queue {
16
16
 
17
17
  if (!this._opts.ttl) this._opts.ttl = 3600;
18
18
 
19
- this._factory = factory;
20
19
  this._col = factory._db.collection (name);
21
- this.ensureIndexes (function (err) {});
22
20
  }
23
21
 
24
22
 
@@ -37,7 +35,6 @@ class PersistentMongoQueue extends Queue {
37
35
  insert (entry, callback) {
38
36
  this._col.insertOne (entry, {}, (err, result) => {
39
37
  if (err) return callback (err);
40
- // TODO result.insertedCount must be 1
41
38
  callback (null, result.insertedId);
42
39
  });
43
40
  }
@@ -273,10 +270,10 @@ class PersistentMongoQueue extends Queue {
273
270
 
274
271
  //////////////////////////////////////////////////////////////////
275
272
  // create needed indexes for O(1) functioning
276
- ensureIndexes (cb) {
273
+ _ensureIndexes (cb) {
277
274
  this._col.createIndex ({mature : 1}, err => {
278
275
  if (err) return cb (err);
279
- this._col.createIndex({processed: 1}, {expireAfterSeconds: this._opts.ttl}, err => cb (err));
276
+ this._col.createIndex({processed: 1}, {expireAfterSeconds: this._opts.ttl}, err => cb (err, this));
280
277
  });
281
278
  }
282
279
  }
@@ -289,10 +286,16 @@ class Factory extends QFactory_MongoDB_defaults {
289
286
  this._db = mongo_conn.db();
290
287
  }
291
288
 
292
- queue (name, opts) {
293
- var full_opts = {};
289
+ queue (name, opts, cb) {
290
+ if (!cb) {
291
+ cb = opts;
292
+ opts = {};
293
+ }
294
+
295
+ const full_opts = {};
294
296
  _.merge(full_opts, this._opts, opts);
295
- return new PersistentMongoQueue (name, this, full_opts, opts);
297
+ const q = new PersistentMongoQueue (name, this, full_opts, opts);
298
+ q._ensureIndexes (cb);
296
299
  }
297
300
 
298
301
  close (cb) {
@@ -106,10 +106,15 @@ class Factory extends QFactory {
106
106
  this._rediscl = rediscl;
107
107
  }
108
108
 
109
- queue (name, opts) {
110
- var full_opts = {};
109
+ queue (name, opts, cb) {
110
+ if (!cb) {
111
+ cb = opts;
112
+ opts = {};
113
+ }
114
+
115
+ const full_opts = {};
111
116
  _.merge(full_opts, this._opts, opts);
112
- return new RedisListQueue (name, this, full_opts, opts);
117
+ return setImmediate(() => cb (null, new RedisListQueue (name, this, full_opts, opts)));
113
118
  }
114
119
 
115
120
  close (cb) {
@@ -143,8 +148,3 @@ function creator (opts, cb) {
143
148
  }
144
149
 
145
150
  module.exports = creator;
146
-
147
-
148
-
149
-
150
-
@@ -128,10 +128,15 @@ class Factory extends QFactory {
128
128
  this._roq_factory = roq_factory;
129
129
  }
130
130
 
131
- queue (name, opts) {
132
- var full_opts = {};
131
+ queue (name, opts, cb) {
132
+ if (!cb) {
133
+ cb = opts;
134
+ opts = {};
135
+ }
136
+
137
+ const full_opts = {};
133
138
  _.merge(full_opts, this._opts, opts);
134
- return new RedisOQ (name, this, full_opts, opts);
139
+ return setImmediate (() => cb (null, new RedisOQ (name, this, full_opts, opts)));
135
140
  }
136
141
 
137
142
  close (cb) {
@@ -17,21 +17,11 @@ class StreamMongoQueue extends Queue {
17
17
 
18
18
  if (!this._opts.ttl) this._opts.ttl = 3600;
19
19
 
20
- this._factory = factory;
21
20
  this._col = factory._db.collection (name);
22
21
  this._groups_str = this._opts.groups || 'A,B:C';
23
22
  this._groups_vector = this._groups_str.split (/[:,;.-]/).map (i => i.trim());
24
23
  this._gid = this._opts.group || this._groups_vector[0];
25
24
 
26
- this.ensureIndexes (err => {
27
- if (err) {
28
- console.error ('keuss:Queue:StreamMongo: index creation failed, queues performance will be severely impacted:', err);
29
- }
30
- else {
31
- debug ('indexes created');
32
- }
33
- });
34
-
35
25
  debug ('created with groups %j and gid %s (used for pop/reserve only)', this._groups_vector, this._gid);
36
26
  }
37
27
 
@@ -70,7 +60,6 @@ class StreamMongoQueue extends Queue {
70
60
 
71
61
  this._col.insertOne (entry, {}, (err, result) => {
72
62
  if (err) return callback (err);
73
- // TODO result.insertedCount must be 1
74
63
  callback (null, result.insertedId);
75
64
  this._groups_vector.forEach (i => this._stats.incr (`stream.${i}.put`));
76
65
  });
@@ -403,7 +392,7 @@ class StreamMongoQueue extends Queue {
403
392
 
404
393
  //////////////////////////////////////////////////////////////////
405
394
  // create needed indexes for O(1) functioning
406
- ensureIndexes (cb) {
395
+ _ensureIndexes (cb) {
407
396
  const tasks = [];
408
397
 
409
398
  this._groups_vector.forEach (i => {
@@ -412,7 +401,7 @@ class StreamMongoQueue extends Queue {
412
401
  tasks.push (cb => this._col.createIndex (idx, cb));
413
402
  });
414
403
  tasks.push (cb => this._col.createIndex ({t: 1}, {expireAfterSeconds: this._opts.ttl}, cb));
415
- async.series (tasks, cb);
404
+ async.series (tasks, err => cb (err, this));
416
405
  }
417
406
  }
418
407
 
@@ -424,10 +413,16 @@ class Factory extends QFactory_MongoDB_defaults {
424
413
  this._db = mongo_conn.db();
425
414
  }
426
415
 
427
- queue (name, opts) {
416
+ queue (name, opts, cb) {
417
+ if (!cb) {
418
+ cb = opts;
419
+ opts = {};
420
+ }
421
+
428
422
  const full_opts = {};
429
423
  _.merge(full_opts, this._opts, opts);
430
- return new StreamMongoQueue (name, this, full_opts, opts);
424
+ const q = new StreamMongoQueue (name, this, full_opts, opts);
425
+ q._ensureIndexes (cb);
431
426
  }
432
427
 
433
428
  close (cb) {
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "keuss",
3
- "version": "1.7.4",
3
+ "version": "2.0.1",
4
4
  "keywords": [
5
5
  "queue",
6
6
  "persistent",
7
7
  "job",
8
8
  "mongodb",
9
+ "postgres",
10
+ "postgresql",
9
11
  "redis",
10
12
  "HA",
11
13
  "pipeline",
@@ -27,19 +29,21 @@
27
29
  "license": "MIT",
28
30
  "dependencies": {
29
31
  "@nodebb/mubsub": "~1.8.0",
30
- "async": "~3.2.4",
31
- "async-lock": "~1.3.1",
32
- "debug": "~4.3.4",
33
- "ioredis": "~5.3.2",
32
+ "async": "~3.2.5",
33
+ "async-lock": "~1.4.1",
34
+ "debug": "~4.3.5",
35
+ "ioredis": "~5.4.1",
34
36
  "lodash": "~4.17.21",
35
- "mitt": "~3.0.0",
37
+ "mitt": "~3.0.1",
36
38
  "mongodb": "~4.17.0",
37
- "uuid": "~8.3.2"
39
+ "uuid": "~8.3.2",
40
+ "pg": "~8.12.0"
38
41
  },
39
42
  "devDependencies": {
40
43
  "chance": "~1.1.11",
41
- "mocha": "~10.2.0",
44
+ "mocha": "~10.4.0",
42
45
  "should": "~13.2.3",
46
+ "nyc": "~15.1.0",
43
47
  "why-is-node-running": "^2.2.2"
44
48
  },
45
49
  "scripts": {
package/stats/mem.js CHANGED
@@ -68,7 +68,6 @@ class MemStats extends Stats {
68
68
  this._s.paused = false;
69
69
 
70
70
  // TODO remove from factory
71
-
72
71
  if (cb) cb();
73
72
  }
74
73
 
@@ -1,72 +0,0 @@
1
- # For most projects, this workflow file will not need changing; you simply need
2
- # to commit it to your repository.
3
- #
4
- # You may wish to alter this file to override the set of languages analyzed,
5
- # or to provide custom queries or build logic.
6
- #
7
- # ******** NOTE ********
8
- # We have attempted to detect the languages in your repository. Please check
9
- # the `language` matrix defined below to confirm you have the correct set of
10
- # supported CodeQL languages.
11
- #
12
- name: "CodeQL"
13
-
14
- on:
15
- push:
16
- branches: [ master ]
17
- pull_request:
18
- # The branches below must be a subset of the branches above
19
- branches: [ master ]
20
- schedule:
21
- - cron: '26 13 * * 1'
22
-
23
- jobs:
24
- analyze:
25
- name: Analyze
26
- runs-on: ubuntu-latest
27
- permissions:
28
- actions: read
29
- contents: read
30
- security-events: write
31
-
32
- strategy:
33
- fail-fast: false
34
- matrix:
35
- language: [ 'javascript' ]
36
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
- # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38
-
39
- steps:
40
- - name: Checkout repository
41
- uses: actions/checkout@v3
42
-
43
- # Initializes the CodeQL tools for scanning.
44
- - name: Initialize CodeQL
45
- uses: github/codeql-action/init@v2
46
- with:
47
- languages: ${{ matrix.language }}
48
- # If you wish to specify custom queries, you can do so here or in a config file.
49
- # By default, queries listed here will override any specified in a config file.
50
- # Prefix the list here with "+" to use these queries and those in the config file.
51
-
52
- # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
- # queries: security-extended,security-and-quality
54
-
55
-
56
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
- # If this step fails, then you should remove it and run the build manually (see below)
58
- - name: Autobuild
59
- uses: github/codeql-action/autobuild@v2
60
-
61
- # ℹ️ Command-line programs to run using the OS shell.
62
- # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63
-
64
- # If the Autobuild fails above, remove it and uncomment the following three lines.
65
- # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66
-
67
- # - run: |
68
- # echo "Run, Build Application using script"
69
- # ./location_of_script_within_repo/buildscript.sh
70
-
71
- - name: Perform CodeQL Analysis
72
- uses: github/codeql-action/analyze@v2