Skip to content

Commit

Permalink
Merge pull request #339 from bitfinexcom/staging
Browse files Browse the repository at this point in the history
Release version to master
  • Loading branch information
prdn authored Oct 17, 2023
2 parents 73fd714 + 12d2555 commit 4aebcb7
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 14 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI
run-name: 'Run tests: Commit ${{ github.sha }}'

on:
pull_request:
types: [opened, reopened, edited]
branches:
- master
workflow_dispatch:

jobs:
linux-test-runner:
name: Linux Test Runner
timeout-minutes: 30
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
node-version: 18.17.1
- name: Setup configs
run: |
cp config/common.json.example config/common.json \
&& cp config/service.report.json.example config/service.report.json \
&& cp config/facs/grc.config.json.example config/facs/grc.config.json \
&& cp config/facs/grc-slack.config.json.example config/facs/grc-slack.config.json
- name: Install deps
run: npm i
- name: Run tests
run: npm test -- --reporter=json --reporter-option output=test-report.json
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test-results
path: test-report.json
30 changes: 30 additions & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Test Report'
run-name: 'Test Report: Commit ${{ github.sha }}'

on:
workflow_run:
workflows: ['CI']
types:
- completed

permissions:
contents: read
actions: read
checks: write

jobs:
web-page-report:
name: Web Page Report
runs-on: ubuntu-22.04
steps:
- uses: dorny/test-reporter@v1
id: test-results
with:
artifact: test-results
name: Mocha Tests
path: test-report.json
reporter: mocha-json
- name: Test Report Summary
run: |
echo "### Test Report page is ready! :rocket:" >> $GITHUB_STEP_SUMMARY
echo "And available at the following [Link](${{ steps.test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bfx-report",
"version": "4.7.0",
"version": "4.8.0",
"description": "Reporting tool",
"main": "worker.js",
"license": "Apache-2.0",
Expand All @@ -25,6 +25,7 @@
"csv": "5.5.3",
"inversify": "6.0.1",
"js-yaml": "4.1.0",
"lib-js-util-base": "git+https://github.com/bitfinexcom/lib-js-util-base.git",
"lodash": "4.17.21",
"lru": "3.1.0",
"moment": "2.29.4",
Expand Down
2 changes: 1 addition & 1 deletion workers/loc.api/helpers/check-params.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { cloneDeep } = require('lodash')
const { cloneDeep } = require('lib-js-util-base')
const Ajv = require('ajv')

const schema = require('./schema')
Expand Down
13 changes: 10 additions & 3 deletions workers/loc.api/helpers/date-param.helpers.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
'use strict'

const { min, max } = require('lodash')
const moment = require('moment-timezone')

const { TimeframeError } = require('../errors')

const MIN_START_MTS = Date.UTC(2013)

const getDateNotMoreNow = (mts, now = Date.now()) => {
return min([mts, now])
if (!Number.isFinite(mts)) {
return now
}

return Math.min(mts, now)
}

const getDateNotLessMinStart = (mts, minStart = MIN_START_MTS) => {
return max([mts, minStart])
if (!Number.isFinite(mts)) {
return minStart
}

return Math.max(mts, minStart)
}

const _setDefaultTimeIfNotExist = (args) => {
Expand Down
2 changes: 1 addition & 1 deletion workers/loc.api/helpers/get-data-from-api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { cloneDeep } = require('lodash')
const { cloneDeep } = require('lib-js-util-base')

const Interrupter = require('../interrupter')
const AbstractWSEventEmitter = require('../abstract.ws.event.emitter')
Expand Down
2 changes: 1 addition & 1 deletion workers/loc.api/helpers/normalize-filter-params.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { cloneDeep } = require('lodash')
const { cloneDeep } = require('lib-js-util-base')

const FILTER_MODELS_NAMES = require('./filter.models.names')
const FILTER_CONDITIONS = require('./filter.conditions')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { cloneDeep } = require('lodash')
const { cloneDeep } = require('lib-js-util-base')

const {
getDateNotMoreNow,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { omit } = require('lodash')
const { omit } = require('lib-js-util-base')

const OMITTING_FIELDS = [
'_events',
Expand Down
2 changes: 1 addition & 1 deletion workers/loc.api/helpers/schema.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { cloneDeep } = require('lodash')
const { cloneDeep } = require('lib-js-util-base')

const _publicTradesSymbol = {
type: ['string', 'array'],
Expand Down
2 changes: 1 addition & 1 deletion workers/loc.api/queue/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const {
omit,
cloneDeep
} = require('lodash')
} = require('lib-js-util-base')
const { promisify } = require('util')
const { pipeline } = require('stream')
const fs = require('fs')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { cloneDeep } = require('lodash')
const { cloneDeep } = require('lib-js-util-base')

const { splitSymbolPairs } = require('../../helpers')

Expand Down
2 changes: 1 addition & 1 deletion workers/loc.api/queue/write-data-to-stream/helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { cloneDeep } = require('lodash')
const { cloneDeep } = require('lib-js-util-base')
const moment = require('moment-timezone')

const dataNormalizer = require('./data-normalizer')
Expand Down
2 changes: 1 addition & 1 deletion workers/loc.api/queue/write-data-to-stream/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { cloneDeep } = require('lodash')
const { cloneDeep } = require('lib-js-util-base')

const {
writeMessageToStream,
Expand Down

0 comments on commit 4aebcb7

Please sign in to comment.