Skip to content

Commit

Permalink
update ci flow (#764)
Browse files Browse the repository at this point in the history
* update ci flow
* upgrade eslint (#765)
* fix indexParam handled
* fix date validation
* add missing dep
* use trace-warnings node arg for debugging purpose
* drop deprecated PromiseLibrary usage
* rename express module name to clarify with 3rd party express
  • Loading branch information
jupe authored Mar 30, 2024
1 parent fcebf7c commit d7692e6
Show file tree
Hide file tree
Showing 14 changed files with 4,686 additions and 4,213 deletions.
21 changes: 19 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@
"one-var": ["error", { "initialized": "never" }],
"one-var-declaration-per-line": ["error", "initializations"],
"func-names": ["error", "as-needed"],
"object-shorthand": "off"
"object-shorthand": "off",
"function-paren-newline": "off",
"prefer-object-spread": "off",
"no-multiple-empty-lines": ["error", { "max": 3, "maxEOF": 2 }],
"implicit-arrow-linebreak": "off",
"function-call-argument-newline": "off",
"arrow-parens": "off",
"operator-linebreak": "off",
"import/extensions": "off",
"object-curly-newline": "off",
"import/no-useless-path-segments": "off",
"import/order": "off",
"no-promise-executor-return": "off",
"prefer-destructuring": "off",
"lines-between-class-members": "off",
"max-classes-per-file": "off",
"camelcase": "off",
"default-param-last": "off"
}
}
}
12 changes: 6 additions & 6 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ permissions:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [14.x, 16.x, 18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand All @@ -47,20 +47,20 @@ jobs:
run: sudo docker run -d -p 27017:27017 mongo:4.4.10-focal
- name: api tests
run: |
MOCHA_FILE=junit/apitests.xml grunt apitests --silent
MOCHA_FILE=junit/apitests.xml NODE_OPTIONS=--trace-warnings grunt apitests
- name: cluster tests
run: |
MOCHA_FILE=junit/clustertests.xml grunt clustertests --silent
- name: lint
run: |
npm run lint
- uses: actions/upload-artifact@v2.2.4
- uses: actions/upload-artifact@v4
if: success() || failure() # run this step even if previous step failed
with:
# Artifact name
name: logs-${{ matrix.node-version }}
path: log/*
- uses: actions/upload-artifact@v2.2.4
- uses: actions/upload-artifact@v4
with:
# Artifact name
name: coverage-report-${{ matrix.node-version }}
Expand Down
3 changes: 2 additions & 1 deletion app/addons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ class AddonManager {
logger.info(`Removing addon: [${addon.name}].`);
this.addons.splice(index, 1);
return Promise.resolve();
} else if (addon.isBusy || addon.isRegistered) {
}
if (addon.isBusy || addon.isRegistered) {
// Something is in progress, better not remove
const error = 'Should not remove addon, either busy or registered.';
const meta = {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/controllers/builds.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BuildsController extends DefaultController {
constructor() { super('Build'); }

static indexParam(req, res, next, Index) {
if (!isNaN(Index)) {
if (Number.isInteger(Number(Index))) {
req.Index = Number.parseInt(Index, 10);
return next();
}
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/passport/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class Github {
}
return user.save();
});
} else if (groupname === 'admins') {
}
if (groupname === 'admins') {
logger.info(`adding user: ${user._id} to admins.`);
return user.addToGroup(groupname);
}
Expand Down
2 changes: 0 additions & 2 deletions app/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const Promise = require('bluebird');
const _ = require('lodash');
const {MongoMemoryServer} = require('mongodb-memory-server');


const logger = require('./tools/logger');
const config = require('./tools/config');

Expand All @@ -26,7 +25,6 @@ const initialize = async function () {
const connect = async function () {
const must = {
logger: logger.info.bind(logger),
promiseLibrary: Promise,
useNewUrlParser: true,
useUnifiedTopology: true
};
Expand Down
2 changes: 1 addition & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Promise = require('bluebird');

// application modules
const logger = require('./tools/logger');
const express = require('./express');
const express = require('./app');
const Server = require('./server');
const models = require('./models');
const routes = require('./routes');
Expand Down
6 changes: 4 additions & 2 deletions app/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ class Master {
if (signal) {
logger.warn(`Master process was killed by signal: ${signal}.`);
return 2;
} else if (code !== 0) {
}
if (code !== 0) {
logger.warn(`Master process exited with error code: ${code}.`);
return 1;
}
Expand All @@ -323,7 +324,8 @@ class Master {
if (signal) {
logger.warn(`Worker#${worker.id} process was killed by signal: ${signal}.`);
return 2;
} else if (code !== 0) {
}
if (code !== 0) {
logger.warn(`Worker#${worker.id} process exited with error code: ${code}.`);
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion app/models/loan.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function objectToArrayOfObjects(obj) {

// Makes sure the provided date is valid
function isValidDate(date) {
return date !== 'Invalid Date' && !isNaN(date);
return date !== 'Invalid Date' && !Number.isNaN(Number(date));
}


Expand Down
3 changes: 2 additions & 1 deletion app/models/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ async function storeFile(file, i) {
if (fileProvider === 'mongodb') {
file.keepInMongo(i);
return Promise.resolve();
} else if (fileProvider) {
}
if (fileProvider) {
return file.storeInFiledb(filedb, i);
}
file.dumpData(i);
Expand Down
Loading

0 comments on commit d7692e6

Please sign in to comment.