From 1fa766571a840f2d90f03dc5695b826338edf120 Mon Sep 17 00:00:00 2001 From: Andrew Lloyd Date: Sun, 11 Mar 2018 15:51:58 -0700 Subject: [PATCH 1/6] Add script to build coverage badge for README --- config/lcov2badge.js | 15 +++++++++++++++ package.json | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 config/lcov2badge.js diff --git a/config/lcov2badge.js b/config/lcov2badge.js new file mode 100644 index 0000000..a0df201 --- /dev/null +++ b/config/lcov2badge.js @@ -0,0 +1,15 @@ +const fs = require('fs'); +const lcov2badge = require('lcov2badge'); +const filePath = process.argv[2]; + +const options = { + filePath: filePath ? filePath : './coverage/lcov.info', + warnThreshold: 80, // default is 80 + koThreshold: 60, // default is 60 +}; + +lcov2badge.badge(options, function(err, svgBadge){ + fs.writeFile('coverageBadge.svg', svgBadge, (err) => { + if (err) throw err; + }); +}); diff --git a/package.json b/package.json index d732497..6e71398 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "test:watch": "npm run test -- --watch", "test:coverage": "cross-env NODE_ENV=test ./node_modules/.bin/istanbul cover _mocha -- --ui bdd --reporter spec --colors --compilers js:babel-core/register tests --recursive", "test:check-coverage": "npm run test:coverage && istanbul check-coverage", - "report-coverage": "coveralls < ./coverage/lcov.info" + "report-coverage": "node config/lcov2badge.js" }, "repository": { "type": "git", @@ -103,6 +103,7 @@ ] }, "devDependencies": { + "lcov2badge": "^0.1.0", "minimist": "^1.2.0", "swagger-node-express": "^2.1.3" } From 55670c2d4693f64de19fc49c77087f39dbe66c52 Mon Sep 17 00:00:00 2001 From: Andrew Lloyd Date: Sun, 11 Mar 2018 20:02:52 -0700 Subject: [PATCH 2/6] Fix linting issues --- config/lcov2badge.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/config/lcov2badge.js b/config/lcov2badge.js index a0df201..552ba8c 100644 --- a/config/lcov2badge.js +++ b/config/lcov2badge.js @@ -1,15 +1,17 @@ const fs = require('fs'); const lcov2badge = require('lcov2badge'); + const filePath = process.argv[2]; const options = { - filePath: filePath ? filePath : './coverage/lcov.info', - warnThreshold: 80, // default is 80 - koThreshold: 60, // default is 60 + filePath: filePath || './coverage/lcov.info', + warnThreshold: 80, // default is 80 + koThreshold: 60, // default is 60 }; -lcov2badge.badge(options, function(err, svgBadge){ - fs.writeFile('coverageBadge.svg', svgBadge, (err) => { - if (err) throw err; - }); +lcov2badge.badge(options, (err, svgBadge) => { + if (err) throw err; + fs.writeFile('coverageBadge.svg', svgBadge, (error) => { + if (err) throw error; + }); }); From ec9dcadd640d6cf497be6d7e93254a7497b95529 Mon Sep 17 00:00:00 2001 From: Andrew Lloyd Date: Sun, 11 Mar 2018 20:54:53 -0700 Subject: [PATCH 3/6] Use webtask API to update coverage badge --- config/lcov2badge.js | 23 +++++++++++++++++++---- package.json | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/config/lcov2badge.js b/config/lcov2badge.js index 552ba8c..ceddbc3 100644 --- a/config/lcov2badge.js +++ b/config/lcov2badge.js @@ -1,4 +1,4 @@ -const fs = require('fs'); +const request = require('request'); const lcov2badge = require('lcov2badge'); const filePath = process.argv[2]; @@ -9,9 +9,24 @@ const options = { koThreshold: 60, // default is 60 }; +function sendCoverageBadge(coverageBadge) { + const requestOptions = { + method: 'post', + body: { coverageBadge, coverageBadgeToken: process.env.COVERAGE_BADGE_TOKEN }, + json: true, + url: process.env.COVERAGE_BADGE_URL + }; + request(requestOptions, (err, res, body) => { + if (err) { + throw err; + } else { + console.log(body.result); // eslint-disable-line no-console + } + }); +} + + lcov2badge.badge(options, (err, svgBadge) => { if (err) throw err; - fs.writeFile('coverageBadge.svg', svgBadge, (error) => { - if (err) throw error; - }); + sendCoverageBadge(svgBadge); }); diff --git a/package.json b/package.json index 6e71398..b93b9d6 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,7 @@ "devDependencies": { "lcov2badge": "^0.1.0", "minimist": "^1.2.0", + "request": "^2.83.0", "swagger-node-express": "^2.1.3" } } From d7987372a34aab72e0b344c85409e06108dfb9e5 Mon Sep 17 00:00:00 2001 From: Andrew Lloyd Date: Sun, 11 Mar 2018 21:03:10 -0700 Subject: [PATCH 4/6] Add coverage badge to README --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dda85b2..2890a83 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,12 @@ The real time event processing infrastructure gateway server for the Software Engineering Daily [Android](https://github.com/SoftwareEngineeringDaily/SEDaily-Android), [iOS](https://github.com/SoftwareEngineeringDaily/se-daily-iOS), and [web front end](https://github.com/SoftwareEngineeringDaily/sedaily-front-end). The SEDaily event stream is responsible for authenticating connecting clients and validating event payload schemas before putting the event on the SED event bus. Interested clients can subscribe to events on the stream. +
+ + +
+ - ## Getting Started ```sh From 41eefba0943838abde0a8dcb8bf65f34225f5114 Mon Sep 17 00:00:00 2001 From: Andrew Lloyd Date: Sun, 11 Mar 2018 21:15:06 -0700 Subject: [PATCH 5/6] update readme --- README.md | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2890a83..cf283b0 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,21 @@ [![logo](https://i.imgur.com/3OtP3p8.png)](https://softwareengineeringdaily.com/) -# SEDaily Event Stream Processor +# SEDaily Logging, Monitoring, and Analytics -The real time event processing infrastructure gateway server for the Software Engineering Daily [Android](https://github.com/SoftwareEngineeringDaily/SEDaily-Android), [iOS](https://github.com/SoftwareEngineeringDaily/se-daily-iOS), and [web front end](https://github.com/SoftwareEngineeringDaily/sedaily-front-end). The SEDaily event stream is responsible for authenticating connecting clients and validating event payload schemas before putting the event on the SED event bus. Interested clients can subscribe to events on the stream. +The real time event processing infrastructure gateway server for the Software Engineering Daily [Android](https://github.com/SoftwareEngineeringDaily/SEDaily-Android), [iOS](https://github.com/SoftwareEngineeringDaily/se-daily-iOS), and [web front end](https://github.com/SoftwareEngineeringDaily/sedaily-front-end). The SEDaily event stream is responsible for validating event payload schemas before putting the event into InfluxDB. The resulting database is queried using Grafana to get up to the second analytics reporting.
- - ## Getting Started ```sh -$ git clone https://github.com/SoftwareEngineeringDaily/sedaily-event-stream.git -$ cd sedaily-event-stream +$ git clone https://github.com/SoftwareEngineeringDaily/sedaily-devops.git +$ cd sedaily-devops ``` ### Set up (local) - - Install and run a local [InfluxDB](https://github.com/influxdata/influxdb) client - `cp .env.local_example .env` - `npm install` or `yarn install` @@ -30,10 +27,6 @@ $ cd sedaily-event-stream - Run `docker-compose up` - If dependencies are updated in package.json, run `docker-compose down` and then `docker-compose up --build`. This will remove the old container and rebuild the API image which installs the new dependencies. -## Current State - -The current state of the SEDaily event stream is analytics focused. The event stream backend relies on Redis Streams, which is only currently available in the [`unstable`](https://github.com/antirez/redis/tree/unstable) branch. Until it is stable, the SEDaily event stream will only directly input events into InfluxDB. Data analytics can be run against queries on the InfluxDB events database. - ## Contributing We use the develop branch to perform work in. Fork the project and clone it, create a branch off of develop and perform your changes. Then submit a pull request to merge your branch into the develop branch here. We have an active Slack community that you can reach out to for more information or just to chat with anyone. Check out the [Slack Channel SED app development](https://softwaredaily.slack.com/app_redirect?channel=sed_app_development) slack channel. Also see the [Open Source Guide](https://softwareengineeringdaily.github.io/). From ef6ddbe79cfefe294ffe88d73724f3230d88a8c3 Mon Sep 17 00:00:00 2001 From: Andrew Lloyd Date: Sun, 11 Mar 2018 21:15:22 -0700 Subject: [PATCH 6/6] Report the coverage in after script --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0e88807..60d3426 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,4 @@ script: - npm run lint - npm run test:check-coverage after_script: - # - npm run report-coverage + - npm run report-coverage